latex_curriculum_vitae 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +10 -8
- data/Gemfile.lock +53 -52
- data/History.rdoc +15 -0
- data/LICENSE.rdoc +619 -24
- data/Manifest.txt +7 -12
- data/NEWS +69 -0
- data/README.rdoc +103 -43
- data/Rakefile +31 -42
- data/STATUS.rdoc +23 -0
- data/bin/latexcv.rb +13 -8
- data/data/latex_curriculum_vitae/Cover/Cover.tex +12 -4
- data/data/latex_curriculum_vitae/Motivational_Letter/bwanschreiben.tex +23 -6
- data/data/latex_curriculum_vitae/Pictures/codealike.png +0 -0
- data/data/latex_curriculum_vitae/Pictures/codestats.png +0 -0
- data/data/latex_curriculum_vitae/Pictures/openhub.png +0 -0
- data/data/latex_curriculum_vitae/Pictures/signatur1.png +0 -0
- data/data/latex_curriculum_vitae/Pictures/wakatime.jpg +0 -0
- data/data/latex_curriculum_vitae/Resume/cv_10.tex +28 -10
- data/etc/latex_curriculum_vitae.cfg +2 -1
- data/etc/personal_data.tex +2 -1
- data/lib/latex_curriculum_vitae.rb +60 -51
- data/lib/latex_curriculum_vitae/cover.rb +17 -9
- data/lib/latex_curriculum_vitae/cv.rb +41 -27
- data/lib/latex_curriculum_vitae/email.rb +168 -94
- data/lib/latex_curriculum_vitae/entityfile.rb +99 -68
- data/lib/latex_curriculum_vitae/get-config.rb +28 -18
- data/lib/latex_curriculum_vitae/letter.rb +19 -12
- data/lib/latex_curriculum_vitae/notifier.rb +20 -13
- data/lib/latex_curriculum_vitae/outfile.rb +30 -19
- metadata +89 -56
- data/.autotest +0 -25
- data/.codeclimate.yml +0 -8
- data/.coveralls.yml +0 -2
- data/.gemnasium.yml +0 -5
- data/.rspec +0 -2
- data/.rubocop.yml +0 -38
- data/.scrutinizer.yml +0 -21
- data/.travis.yml +0 -29
- data/CODE_OF_CONDUCT.md +0 -17
- data/CONTRIBUTING.md +0 -25
- data/config.reek +0 -111
- data/data/latex_curriculum_vitae/Appendix/Employers_Reference/wtg.pdf +0 -0
@@ -1,10 +1,17 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
# @author Sascha Manns
|
4
|
-
# @abstract module for creating the entity file for latex
|
5
|
-
#
|
6
1
|
# Copyright (C) 2015-2017 Sascha Manns <Sascha.Manns@mailbox.org>
|
7
|
-
#
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
8
15
|
|
9
16
|
# Dependencies
|
10
17
|
require 'fileutils'
|
@@ -15,11 +22,12 @@ require 'url_shortener'
|
|
15
22
|
module LatexCurriculumVitae
|
16
23
|
# Module for creating the entityfile
|
17
24
|
module Entityfile
|
25
|
+
# TODO: Try to fix this in future
|
18
26
|
# rubocop:disable Metrics/LineLength
|
19
27
|
# Method for getting information
|
20
|
-
# @param [String]
|
21
|
-
# @return [Array] contact,
|
22
|
-
def self.get_information(
|
28
|
+
# @param [String] entity_tex Path to the entity.tex
|
29
|
+
# @return [Array] contact, email_address, job_title, contact_sex, company, proactive, job_url
|
30
|
+
def self.get_information(entity_tex)
|
23
31
|
resume = `yad --title="Create application" --center --on-top --form --item-separator=, --separator="|" \
|
24
32
|
--field="What is the jobtitle of your application? Escape amp with backslash:TEXT" \
|
25
33
|
--field="Is it a proactive application?:CBE" \
|
@@ -33,123 +41,146 @@ module LatexCurriculumVitae
|
|
33
41
|
--field="What kind of target:CBE" \
|
34
42
|
--field="Tell me the URL of the job offer:TEXT" \
|
35
43
|
--button="Go!" "" "no,yes" "yes,no" "" "" "" "male,female,unknown" "" "" "doku,support,kaufm"`
|
36
|
-
|
37
|
-
|
38
|
-
puts s
|
39
|
-
end
|
44
|
+
job_title, proactive, letter, company, street, city, contact_sex, contact, email_address,
|
45
|
+
target, job_url = resume.chomp.split('|')
|
40
46
|
|
41
|
-
create_file(
|
42
|
-
[contact,
|
47
|
+
create_file(job_title, company, street, city, contact, entity_tex, contact_sex, proactive, target)
|
48
|
+
[contact, email_address, job_title, contact_sex, company, letter, proactive, job_url, target]
|
43
49
|
end
|
44
50
|
|
45
51
|
# Method for shorten the URL
|
46
52
|
# @param [String] job_url The Url to the job offer
|
47
|
-
# @param [String]
|
48
|
-
# @param [String]
|
49
|
-
# @return [String]
|
50
|
-
def self.shorten_url(job_url,
|
51
|
-
|
53
|
+
# @param [String] bit_ly_user The Username in Bit.ly
|
54
|
+
# @param [String] bit_ly_apikey The Apikey from your Bit.ly User
|
55
|
+
# @return [String] job_url_checked Returns the shortened Bit.ly URL
|
56
|
+
def self.shorten_url(job_url, bit_ly_user, bit_ly_apikey)
|
57
|
+
# TODO: Try to fix this in future
|
58
|
+
# rubocop:disable Style/UnneededInterpolation
|
59
|
+
authorize = UrlShortener::Authorize.new "#{bit_ly_user}", "#{bit_ly_apikey}"
|
52
60
|
client = UrlShortener::Client.new authorize
|
53
61
|
|
54
62
|
shorten = client.shorten("#{job_url}") # => UrlShortener::Response::Shorten object
|
55
63
|
shorten.result # => returns a hash of all data returned from bitly
|
56
64
|
shorten.urls # => Only returns the short urls look for more convenience methods in the UrlShortener::Response::Shorten class
|
57
65
|
puts shorten.urls
|
58
|
-
|
59
|
-
return
|
66
|
+
job_url_checked = shorten.urls
|
67
|
+
return job_url_checked
|
60
68
|
end
|
61
69
|
|
62
70
|
# Method for creating the entity.tex
|
63
|
-
# @param [String]
|
71
|
+
# @param [String] job_title Title of the target job
|
64
72
|
# @param [String] company Comanys name
|
65
73
|
# @param [String] street Companies street
|
66
74
|
# @param [String] city City of the company
|
67
75
|
# @param [String] contact Name of the contact
|
68
76
|
# @param [String] contact_sex Sex of the contact
|
69
|
-
# @param [String]
|
70
|
-
|
77
|
+
# @param [String] entity_tex Path to the entity.tex
|
78
|
+
# TODO: Try to fix this in future
|
79
|
+
# This method smells of :reek:LongParameterList
|
80
|
+
def self.create_file(job_title, company, street, city, contact, entity_tex, contact_sex, proactive, target)
|
71
81
|
introduction = LatexCurriculumVitae::Entityfile.get_introduction(contact, contact_sex)
|
72
|
-
subject, intro = LatexCurriculumVitae::Entityfile.get_subject_intro(proactive,
|
73
|
-
|
74
|
-
|
82
|
+
subject, intro = LatexCurriculumVitae::Entityfile.get_subject_intro(proactive, job_title)
|
83
|
+
address_string = LatexCurriculumVitae::Entityfile.get_address_string(company, contact, contact_sex, street, city)
|
84
|
+
target_block = LatexCurriculumVitae::Entityfile.get_target_block(target)
|
75
85
|
|
76
|
-
FileUtils.rm(
|
77
|
-
FileUtils.touch(
|
78
|
-
|
79
|
-
|
86
|
+
FileUtils.rm(entity_tex) if File.exist?(entity_tex)
|
87
|
+
FileUtils.touch(entity_tex)
|
88
|
+
# TODO: Try to fix this in future
|
89
|
+
# rubocop:disable Layout/IndentHeredoc
|
90
|
+
File.write "#{entity_tex}", <<TEXFILE
|
91
|
+
\\def\\jobtitle{#{job_title}}
|
80
92
|
\\def\\company{#{company}}
|
81
93
|
\\def\\contact{#{contact}}
|
82
94
|
\\def\\street{#{street}}
|
83
95
|
\\def\\city{#{city}}
|
84
96
|
\\def\\introduction{#{introduction}}
|
85
97
|
\\def\\subject{#{subject}}
|
86
|
-
\\def\\addressstring{#{
|
98
|
+
\\def\\addressstring{#{address_string}}
|
87
99
|
\\def\\intro{#{intro}}
|
88
|
-
\\def\\targetblock{#{
|
89
|
-
|
100
|
+
\\def\\targetblock{#{target_block}}
|
101
|
+
TEXFILE
|
90
102
|
end
|
91
103
|
|
92
104
|
# Method for preparing the introduction variable
|
93
105
|
# @param [String] contact Name of the contact
|
94
106
|
# @param [String] contact_sex Sex of the contact
|
95
107
|
# @return [String] introduction
|
108
|
+
# TODO: Try to fix this in future
|
109
|
+
# rubocop:disable Style/IfInsideElse
|
110
|
+
# This method smells of :reek:ControlParameter
|
96
111
|
def self.get_introduction(contact, contact_sex)
|
97
|
-
if contact == ''
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
112
|
+
introduction = if contact == ''
|
113
|
+
'Sehr geehrte Damen und Herren,'
|
114
|
+
else
|
115
|
+
if contact_sex == 'male'
|
116
|
+
"Sehr geehrter Herr #{contact},"
|
117
|
+
else
|
118
|
+
"Sehr geehrte Frau #{contact},"
|
119
|
+
end
|
120
|
+
end
|
106
121
|
return introduction
|
107
122
|
end
|
108
123
|
|
109
124
|
# Method for preparing the subject and intro variables
|
110
125
|
# @param [String] proactive Can be yes or no
|
111
|
-
# @param [String]
|
126
|
+
# @param [String] job_title Title of the target job
|
112
127
|
# @return [Array] subject intro
|
113
|
-
|
128
|
+
# TODO: Try to fix this in future
|
129
|
+
# This method smells of :reek:ControlParameter
|
130
|
+
def self.get_subject_intro(proactive, job_title)
|
114
131
|
if proactive == 'yes'
|
115
|
-
subject = "Initiativbewerbung um einen Arbeitsplatz als #{
|
116
|
-
intro = "gerne möchte ich mich bei Ihnen um die Stelle als #{
|
132
|
+
subject = "Initiativbewerbung um einen Arbeitsplatz als #{job_title}"
|
133
|
+
intro = "gerne möchte ich mich bei Ihnen um die Stelle als #{job_title} oder einer ähnlichen Position bewerben."
|
117
134
|
else
|
118
|
-
subject = "Bewerbung um einen Arbeitsplatz als #{
|
119
|
-
intro = "mit großem Interesse bin ich auf die ausgeschriebene Position aufmerksam geworden. Aus diesem Grund bewerbe ich mich bei Ihnen als #{
|
135
|
+
subject = "Bewerbung um einen Arbeitsplatz als #{job_title}"
|
136
|
+
intro = "mit großem Interesse bin ich auf die ausgeschriebene Position aufmerksam geworden. Aus diesem Grund bewerbe ich mich bei Ihnen als #{job_title}."
|
120
137
|
end
|
121
138
|
[subject, intro]
|
122
139
|
end
|
123
140
|
|
124
|
-
# Method for preparing the
|
141
|
+
# Method for preparing the address_string
|
125
142
|
# @param [String] company Comanys name
|
126
143
|
# @param [String] street Companies street
|
127
144
|
# @param [String] city City of the company
|
128
145
|
# @param [String] contact Name of the contact
|
129
|
-
# @return [String]
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
146
|
+
# @return [String] address_string
|
147
|
+
# TODO: Try to fix this in future
|
148
|
+
# This method smells of :reek:LongParameterList
|
149
|
+
# This method smells of :reek:ControlParameter
|
150
|
+
def self.get_address_string(company, contact, contact_sex, street, city)
|
151
|
+
address_string = "#{company} \\\\"
|
152
|
+
address_string << if contact == ''
|
153
|
+
'z.Hd. Personalabteilung \\\\'
|
154
|
+
else
|
155
|
+
if contact_sex == 'male'
|
156
|
+
"z.Hd. Herrn #{contact} \\\\"
|
157
|
+
else
|
158
|
+
"z.Hd. Frau #{contact} \\\\"
|
159
|
+
end
|
160
|
+
end
|
161
|
+
address_string << "#{street} \\\\" if street != ''
|
162
|
+
address_string << "#{city}" if city != ''
|
163
|
+
return address_string
|
140
164
|
end
|
141
165
|
|
142
166
|
# Method for getting the target code block
|
143
|
-
# @param [String] target The
|
144
|
-
# @returns [String]
|
167
|
+
# @param [String] target The chosen target
|
168
|
+
# @returns [String] target_block Returns a Block with the chosen Information
|
169
|
+
# TODO: Try to fix this in future
|
170
|
+
# This method smells of :reek:ControlParameter
|
145
171
|
def self.get_target_block(target)
|
146
172
|
if target == 'doku'
|
147
|
-
|
173
|
+
target_block = 'Neben der Beschreibungssprache DocBook samt XSL-FO lernte ich die Satzsprache \\LaTeX. \\\\
|
174
|
+
Selbstständig erarbeitete ich mir Kenntnisse in der Programmiersprache Ruby, Python, sowie der Web-App-Entwicklung
|
175
|
+
(TH Mittelrhein).\\\\'
|
148
176
|
elsif target == 'support'
|
149
|
-
|
177
|
+
target_block = 'Im IT-Support hatte ich bereits erste Führungserfahrung als Dispatcher \\&Controller.
|
178
|
+
Selbstständig erarbeitete ich mir Kenntnisse in den Programmiersprachen Bash, Ruby und Python, sowie der Web-App-Entwicklung (TH Mittelrhein).\\\\'
|
150
179
|
else
|
151
|
-
|
180
|
+
target_block = 'Im kaufmännischen Bereich habe ich bereits vielfältige Erfahrungen im Einkauf, Verkauf,
|
181
|
+
Öffentlichkeitsarbeit und Vertrieb gemacht und bin stets bereit neues zu lernen.\\\\'
|
152
182
|
end
|
183
|
+
return target_block
|
153
184
|
end
|
154
185
|
end
|
155
|
-
end
|
186
|
+
end
|
@@ -1,10 +1,17 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
# @author Sascha Manns
|
4
|
-
# @abstract module for getting information from a config file
|
5
|
-
#
|
6
1
|
# Copyright (C) 2015-2017 Sascha Manns <Sascha.Manns@mailbox.org>
|
7
|
-
#
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
8
15
|
|
9
16
|
# Dependencies
|
10
17
|
require 'parseconfig'
|
@@ -14,35 +21,38 @@ module LatexCurriculumVitae
|
|
14
21
|
# Module for creating the GetConfig
|
15
22
|
module GetConfig
|
16
23
|
# This method gets the configs from the config file
|
17
|
-
# @
|
18
|
-
|
19
|
-
|
24
|
+
# @param [String] sysconf_dir
|
25
|
+
# @return [Array] name_of_pdf, name_of_cover, name_of_resume, name_of_letter, pdf_reader, shorten_url,
|
26
|
+
# bit_ly_user, bit_ly_apikey
|
27
|
+
def self.get(sysconf_dir)
|
28
|
+
config = ParseConfig.new("#{sysconf_dir}/latex_curriculum_vitae.cfg")
|
20
29
|
name_of_pdf = config['name_of_pdf']
|
21
30
|
name_of_cover = config['name_of_cover']
|
22
31
|
name_of_resume = config['name_of_resume']
|
23
32
|
name_of_letter = config['name_of_letter']
|
24
33
|
pdf_reader = config['pdf_reader']
|
25
34
|
shorten_url = config['shorten_url']
|
26
|
-
|
27
|
-
|
35
|
+
bit_ly_user = config['bitly_user']
|
36
|
+
bit_ly_apikey = config['bitly_apikey']
|
37
|
+
mail_backend = config['mail_backend']
|
28
38
|
|
29
|
-
[name_of_pdf, name_of_cover, name_of_resume, name_of_letter, pdf_reader, shorten_url,
|
39
|
+
[name_of_pdf, name_of_cover, name_of_resume, name_of_letter, pdf_reader, shorten_url, bit_ly_user, bit_ly_apikey,
|
40
|
+
mail_backend]
|
30
41
|
end
|
31
42
|
|
32
43
|
# Method for getting smtp configuration
|
33
|
-
# @
|
34
|
-
|
35
|
-
|
44
|
+
# @param [String] sysconf_dir
|
45
|
+
# @return [Array] own_name, own_email_address, own_smtp, own_username, own_password, own_port, own_domain
|
46
|
+
def self.get_smtp(sysconf_dir)
|
47
|
+
config = ParseConfig.new("#{sysconf_dir}/latex_curriculum_vitae.cfg")
|
36
48
|
# own_name = config['own_name']
|
37
49
|
own_email_address = config['own_email_address']
|
38
50
|
own_smtp = config['own_smtp']
|
39
51
|
own_username = config['own_username']
|
40
52
|
own_password = config['own_password']
|
41
53
|
own_port = config['own_port'].to_i
|
42
|
-
own_tls = config['own_tls']
|
43
54
|
|
44
|
-
[own_email_address, own_smtp, own_username, own_password, own_port
|
55
|
+
[own_email_address, own_smtp, own_username, own_password, own_port]
|
45
56
|
end
|
46
|
-
|
47
57
|
end
|
48
58
|
end
|
@@ -1,10 +1,17 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
# @author Sascha Manns
|
4
|
-
# @abstract module for creating a motivational letter
|
5
|
-
#
|
6
1
|
# Copyright (C) 2015-2017 Sascha Manns <Sascha.Manns@mailbox.org>
|
7
|
-
#
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
8
15
|
|
9
16
|
# Dependencies
|
10
17
|
require 'fileutils'
|
@@ -15,14 +22,14 @@ module LatexCurriculumVitae
|
|
15
22
|
# Module for creating the motivational letter
|
16
23
|
module Letter
|
17
24
|
# Method for creating a pdf from tex
|
18
|
-
# @param [String]
|
25
|
+
# @param [String] tmp_dir Name of the Tempdir
|
19
26
|
# @param [String] name_of_letter Filename of the Letter
|
20
|
-
def self.create_letter(
|
21
|
-
puts 'Compiling motivational letter'.
|
27
|
+
def self.create_letter(tmp_dir, name_of_letter)
|
28
|
+
puts 'Compiling motivational letter'.color(:yellow)
|
22
29
|
system("pdflatex #{name_of_letter}.tex")
|
23
|
-
puts 'Done compiling motivational letter'.
|
24
|
-
system("cp #{name_of_letter}.pdf #{
|
25
|
-
puts 'Copied motivational letter to tmpdir'.
|
30
|
+
puts 'Done compiling motivational letter'.color(:green)
|
31
|
+
system("cp #{name_of_letter}.pdf #{tmp_dir}")
|
32
|
+
puts 'Copied motivational letter to tmpdir'.color(:green)
|
26
33
|
end
|
27
34
|
end
|
28
35
|
end
|
@@ -1,11 +1,17 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
# @author Sascha Manns
|
4
|
-
# @abstract module for notify the user about finishing the email send
|
5
|
-
# process
|
6
|
-
#
|
7
1
|
# Copyright (C) 2015-2017 Sascha Manns <Sascha.Manns@mailbox.org>
|
8
|
-
#
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
9
15
|
|
10
16
|
# Dependencies
|
11
17
|
|
@@ -16,13 +22,14 @@ require 'notifier'
|
|
16
22
|
module LatexCurriculumVitae
|
17
23
|
# Method for notifying the user
|
18
24
|
module Notify
|
19
|
-
# @param [String]
|
20
|
-
|
21
|
-
|
25
|
+
# @param [String] job_title The Title of your job application
|
26
|
+
# @param [String] data_dir Path to data dir
|
27
|
+
def self.run(job_title, data_dir)
|
28
|
+
img = "#{data_dir}/share/icons/arbeitsagentur.png"
|
22
29
|
Notifier.notify(
|
23
|
-
|
24
|
-
|
25
|
-
|
30
|
+
image: img.to_s,
|
31
|
+
title: 'Your Job Application',
|
32
|
+
message: "Your Job Application #{job_title} was created now."
|
26
33
|
)
|
27
34
|
end
|
28
35
|
end
|
@@ -1,10 +1,17 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
# @author Sascha Manns
|
4
|
-
# @abstract module for adding new applications on the csv table
|
5
|
-
#
|
6
1
|
# Copyright (C) 2015-2017 Sascha Manns <Sascha.Manns@mailbox.org>
|
7
|
-
#
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
8
15
|
|
9
16
|
# Dependencies
|
10
17
|
require 'csv'
|
@@ -14,29 +21,33 @@ module LatexCurriculumVitae
|
|
14
21
|
# Module for creating and appending the outfile
|
15
22
|
module CVOutfile
|
16
23
|
# Method to adding the data into the csv file
|
17
|
-
# @param [String]
|
24
|
+
# @param [String] job_title Title of the job application
|
18
25
|
# @param [String] company Companyname for the application
|
19
26
|
# @param [String] contact Name of the Contact in the Company
|
20
|
-
# @param [String]
|
21
|
-
# @param [String]
|
22
|
-
# @param [String]
|
23
|
-
|
27
|
+
# @param [String] email_address Emailaddress of the Contact
|
28
|
+
# @param [String] csv_out Name of the CSV-Outfile
|
29
|
+
# @param [String] job_url_checked The shortened URL
|
30
|
+
# TODO: Try to fix this in future
|
31
|
+
# rubocop:disable Metrics/AbcSize
|
32
|
+
# This method smells of :reek:LongParameterList
|
33
|
+
def self.add_to_outfile(job_title, company, contact, email_address, csv_out, job_url_checked)
|
24
34
|
time = Time.new
|
25
35
|
date = time.strftime('%Y-%m-%d')
|
26
36
|
contact.gsub!('%20', ' ')
|
27
|
-
|
28
|
-
|
29
|
-
if File.exist?(
|
37
|
+
job_title.gsub!('%20', ' ')
|
38
|
+
job_title.gsub!('%26', '&')
|
39
|
+
if File.exist?(csv_out)
|
30
40
|
puts 'do nothing'
|
31
41
|
else
|
32
|
-
FileUtils.touch(
|
33
|
-
|
42
|
+
FileUtils.touch(csv_out)
|
43
|
+
# rubocop:disable IndentHeredoc
|
44
|
+
File.write csv_out.to_s, <<CSV
|
34
45
|
date,company,job,contact,email,status, joburl
|
35
|
-
|
46
|
+
CSV
|
36
47
|
end
|
37
|
-
CSV.open(
|
48
|
+
CSV.open(csv_out.to_s, 'a+') do |csv|
|
38
49
|
# datum,firma,stelle,kontakt,email,status,joburl
|
39
|
-
csv << [
|
50
|
+
csv << [date.to_s, company.to_s, job_title.to_s, contact.to_s, email_address.to_s, 'Open', job_url_checked.to_s]
|
40
51
|
end
|
41
52
|
end
|
42
53
|
end
|