latex_curriculum_vitae 2.1.1 → 2.1.2

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.
@@ -1,186 +1,186 @@
1
- # Copyright (C) 2015-2018 Sascha Manns <Sascha.Manns@mailbox.org>
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/>.
15
-
16
- # Dependencies
17
- require 'fileutils'
18
- require 'rainbow/ext/string'
19
- require 'url_shortener'
20
-
21
- # main module
22
- module LatexCurriculumVitae
23
- # Module for creating the entityfile
24
- module Entityfile
25
- # TODO: Try to fix this in future
26
- # rubocop:disable Metrics/LineLength
27
- # Method for getting 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)
31
- resume = `yad --title="Create application" --center --on-top --form --item-separator=, --separator="|" \
32
- --field="What is the jobtitle of your application? Escape amp with backslash:TEXT" \
33
- --field="Is it a proactive application?:CBE" \
34
- --field="Create a motivational letter?:CBE" \
35
- --field="What is the companies name? Escape amp with backslash:TEXT" \
36
- --field="Give me the street of the company:TEXT" \
37
- --field="What is the zip-code (german PLZ) and city from the company:TEXT" \
38
- --field="Is your contact male or female? Leave blank if unknown contact:CBE" \
39
- --field="If you have a contact so give me the name of him/her. Leave blank if unknown contact:TEXT" \
40
- --field="Tell me the email address for sending the application:TEXT" \
41
- --field="What kind of target:CBE" \
42
- --field="Tell me the URL of the job offer:TEXT" \
43
- --button="Go!" "" "no,yes" "yes,no" "" "" "" "male,female,unknown" "" "" "doku,support,kaufm"`
44
- job_title, proactive, letter, company, street, city, contact_sex, contact, email_address,
45
- target, job_url = resume.chomp.split('|')
46
-
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]
49
- end
50
-
51
- # Method for shorten the URL
52
- # @param [String] job_url The Url to the job offer
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}"
60
- client = UrlShortener::Client.new authorize
61
-
62
- shorten = client.shorten("#{job_url}") # => UrlShortener::Response::Shorten object
63
- shorten.result # => returns a hash of all data returned from bitly
64
- shorten.urls # => Only returns the short urls look for more convenience methods in the UrlShortener::Response::Shorten class
65
- puts shorten.urls
66
- job_url_checked = shorten.urls
67
- return job_url_checked
68
- end
69
-
70
- # Method for creating the entity.tex
71
- # @param [String] job_title Title of the target job
72
- # @param [String] company Comanys name
73
- # @param [String] street Companies street
74
- # @param [String] city City of the company
75
- # @param [String] contact Name of the contact
76
- # @param [String] contact_sex Sex of the contact
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)
81
- introduction = LatexCurriculumVitae::Entityfile.get_introduction(contact, contact_sex)
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)
85
-
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}}
92
- \\def\\company{#{company}}
93
- \\def\\contact{#{contact}}
94
- \\def\\street{#{street}}
95
- \\def\\city{#{city}}
96
- \\def\\introduction{#{introduction}}
97
- \\def\\subject{#{subject}}
98
- \\def\\addressstring{#{address_string}}
99
- \\def\\intro{#{intro}}
100
- \\def\\targetblock{#{target_block}}
101
- TEXFILE
102
- end
103
-
104
- # Method for preparing the introduction variable
105
- # @param [String] contact Name of the contact
106
- # @param [String] contact_sex Sex of the contact
107
- # @return [String] introduction
108
- # TODO: Try to fix this in future
109
- # rubocop:disable Style/IfInsideElse
110
- # This method smells of :reek:ControlParameter
111
- def self.get_introduction(contact, contact_sex)
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
121
- return introduction
122
- end
123
-
124
- # Method for preparing the subject and intro variables
125
- # @param [String] proactive Can be yes or no
126
- # @param [String] job_title Title of the target job
127
- # @return [Array] subject intro
128
- # TODO: Try to fix this in future
129
- # This method smells of :reek:ControlParameter
130
- def self.get_subject_intro(proactive, job_title)
131
- if proactive == 'yes'
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."
134
- else
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}."
137
- end
138
- [subject, intro]
139
- end
140
-
141
- # Method for preparing the address_string
142
- # @param [String] company Comanys name
143
- # @param [String] street Companies street
144
- # @param [String] city City of the company
145
- # @param [String] contact Name of the contact
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
164
- end
165
-
166
- # Method for getting the target code block
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
171
- def self.get_target_block(target)
172
- if target == 'doku'
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).\\\\'
176
- elsif target == 'support'
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).\\\\'
179
- else
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.\\\\'
182
- end
183
- return target_block
184
- end
185
- end
186
- end
1
+ # Copyright (C) 2015-2018 Sascha Manns <Sascha.Manns@outlook.de>
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/>.
15
+
16
+ # Dependencies
17
+ require 'fileutils'
18
+ require 'rainbow/ext/string'
19
+ require 'url_shortener'
20
+
21
+ # main module
22
+ module LatexCurriculumVitae
23
+ # Module for creating the entityfile
24
+ module Entityfile
25
+ # TODO: Try to fix this in future
26
+ # rubocop:disable Metrics/LineLength
27
+ # Method for getting 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)
31
+ resume = `yad --title="Create application" --center --on-top --form --item-separator=, --separator="|" \
32
+ --field="What is the jobtitle of your application? Escape amp with backslash:TEXT" \
33
+ --field="Is it a proactive application?:CBE" \
34
+ --field="Create a motivational letter?:CBE" \
35
+ --field="What is the companies name? Escape amp with backslash:TEXT" \
36
+ --field="Give me the street of the company:TEXT" \
37
+ --field="What is the zip-code (german PLZ) and city from the company:TEXT" \
38
+ --field="Is your contact male or female? Leave blank if unknown contact:CBE" \
39
+ --field="If you have a contact so give me the name of him/her. Leave blank if unknown contact:TEXT" \
40
+ --field="Tell me the email address for sending the application:TEXT" \
41
+ --field="What kind of target:CBE" \
42
+ --field="Tell me the URL of the job offer:TEXT" \
43
+ --button="Go!" "" "no,yes" "yes,no" "" "" "" "male,female,unknown" "" "" "doku,support,kaufm"`
44
+ job_title, proactive, letter, company, street, city, contact_sex, contact, email_address,
45
+ target, job_url = resume.chomp.split('|')
46
+
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]
49
+ end
50
+
51
+ # Method for shorten the URL
52
+ # @param [String] job_url The Url to the job offer
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}"
60
+ client = UrlShortener::Client.new authorize
61
+
62
+ shorten = client.shorten("#{job_url}") # => UrlShortener::Response::Shorten object
63
+ shorten.result # => returns a hash of all data returned from bitly
64
+ shorten.urls # => Only returns the short urls look for more convenience methods in the UrlShortener::Response::Shorten class
65
+ puts shorten.urls
66
+ job_url_checked = shorten.urls
67
+ return job_url_checked
68
+ end
69
+
70
+ # Method for creating the entity.tex
71
+ # @param [String] job_title Title of the target job
72
+ # @param [String] company Comanys name
73
+ # @param [String] street Companies street
74
+ # @param [String] city City of the company
75
+ # @param [String] contact Name of the contact
76
+ # @param [String] contact_sex Sex of the contact
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)
81
+ introduction = LatexCurriculumVitae::Entityfile.get_introduction(contact, contact_sex)
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)
85
+
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}}
92
+ \\def\\company{#{company}}
93
+ \\def\\contact{#{contact}}
94
+ \\def\\street{#{street}}
95
+ \\def\\city{#{city}}
96
+ \\def\\introduction{#{introduction}}
97
+ \\def\\subject{#{subject}}
98
+ \\def\\addressstring{#{address_string}}
99
+ \\def\\intro{#{intro}}
100
+ \\def\\targetblock{#{target_block}}
101
+ TEXFILE
102
+ end
103
+
104
+ # Method for preparing the introduction variable
105
+ # @param [String] contact Name of the contact
106
+ # @param [String] contact_sex Sex of the contact
107
+ # @return [String] introduction
108
+ # TODO: Try to fix this in future
109
+ # rubocop:disable Style/IfInsideElse
110
+ # This method smells of :reek:ControlParameter
111
+ def self.get_introduction(contact, contact_sex)
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
121
+ return introduction
122
+ end
123
+
124
+ # Method for preparing the subject and intro variables
125
+ # @param [String] proactive Can be yes or no
126
+ # @param [String] job_title Title of the target job
127
+ # @return [Array] subject intro
128
+ # TODO: Try to fix this in future
129
+ # This method smells of :reek:ControlParameter
130
+ def self.get_subject_intro(proactive, job_title)
131
+ if proactive == 'yes'
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."
134
+ else
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}."
137
+ end
138
+ [subject, intro]
139
+ end
140
+
141
+ # Method for preparing the address_string
142
+ # @param [String] company Comanys name
143
+ # @param [String] street Companies street
144
+ # @param [String] city City of the company
145
+ # @param [String] contact Name of the contact
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
164
+ end
165
+
166
+ # Method for getting the target code block
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
171
+ def self.get_target_block(target)
172
+ if target == 'doku'
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).\\\\'
176
+ elsif target == 'support'
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).\\\\'
179
+ else
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.\\\\'
182
+ end
183
+ return target_block
184
+ end
185
+ end
186
+ end
@@ -1,58 +1,58 @@
1
- # Copyright (C) 2015-2018 Sascha Manns <Sascha.Manns@mailbox.org>
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/>.
15
-
16
- # Dependencies
17
- require 'parseconfig'
18
-
19
- # main module
20
- module LatexCurriculumVitae
21
- # Module for creating the GetConfig
22
- module GetConfig
23
- # This method gets the configs from the config file
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")
29
- name_of_pdf = config['name_of_pdf']
30
- name_of_cover = config['name_of_cover']
31
- name_of_resume = config['name_of_resume']
32
- name_of_letter = config['name_of_letter']
33
- pdf_reader = config['pdf_reader']
34
- shorten_url = config['shorten_url']
35
- bit_ly_user = config['bitly_user']
36
- bit_ly_apikey = config['bitly_apikey']
37
- mail_backend = config['mail_backend']
38
-
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]
41
- end
42
-
43
- # Method for getting smtp configuration
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")
48
- # own_name = config['own_name']
49
- own_email_address = config['own_email_address']
50
- own_smtp = config['own_smtp']
51
- own_username = config['own_username']
52
- own_password = config['own_password']
53
- own_port = config['own_port'].to_i
54
-
55
- [own_email_address, own_smtp, own_username, own_password, own_port]
56
- end
57
- end
58
- end
1
+ # Copyright (C) 2015-2018 Sascha Manns <Sascha.Manns@outlook.de>
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/>.
15
+
16
+ # Dependencies
17
+ require 'parseconfig'
18
+
19
+ # main module
20
+ module LatexCurriculumVitae
21
+ # Module for creating the GetConfig
22
+ module GetConfig
23
+ # This method gets the configs from the config file
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")
29
+ name_of_pdf = config['name_of_pdf']
30
+ name_of_cover = config['name_of_cover']
31
+ name_of_resume = config['name_of_resume']
32
+ name_of_letter = config['name_of_letter']
33
+ pdf_reader = config['pdf_reader']
34
+ shorten_url = config['shorten_url']
35
+ bit_ly_user = config['bitly_user']
36
+ bit_ly_apikey = config['bitly_apikey']
37
+ mail_backend = config['mail_backend']
38
+
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]
41
+ end
42
+
43
+ # Method for getting smtp configuration
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")
48
+ # own_name = config['own_name']
49
+ own_email_address = config['own_email_address']
50
+ own_smtp = config['own_smtp']
51
+ own_username = config['own_username']
52
+ own_password = config['own_password']
53
+ own_port = config['own_port'].to_i
54
+
55
+ [own_email_address, own_smtp, own_username, own_password, own_port]
56
+ end
57
+ end
58
+ end