latex_curriculum_vitae 1.0.0 → 1.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.
@@ -8,65 +8,127 @@
8
8
 
9
9
  # Dependencies
10
10
  require 'rainbow/ext/string'
11
+ require 'pony'
12
+ require File.expand_path(File.join(File.dirname(__FILE__), 'get-config'))
11
13
 
12
14
  # rubocop:disable Metrics/LineLength
13
15
  # Module for creating the CV
14
- module CVEmail
15
- # Method for creating the email
16
- # rubocop:disable Metrics/MethodLength
17
- # rubocop:disable Metrics/AbcSize
18
- # @param [String] contact Name of the contact
19
- # @param [String] emailaddress Email address of the contact
20
- # @param [String] jobtitle Title of the target job
21
- # @param [String] contact_sex Can be male, female or unknown
22
- # @param [String] proactive Can be yes or no
23
- def self.create_email(contact, emailaddress, jobtitle, contact_sex, proactive)
24
- # Hex codes from http://www.obkb.com/dcljr/charstxt.html
25
- space = '%20'
26
- crlf = '%0D%0A'
27
- ampersand = '%26'
16
+ module LatexCurriculumVitae
17
+ module Email
18
+ # Method for creating the email
19
+ # rubocop:disable Metrics/MethodLength
20
+ # rubocop:disable Metrics/AbcSize
21
+ # @param [String] contact Name of the contact
22
+ # @param [String] emailaddress Email address of the contact
23
+ # @param [String] jobtitle Title of the target job
24
+ # @param [String] contact_sex Can be male, female or unknown
25
+ # @param [String] proactive Can be yes or no
26
+ def self.create_email(contact, emailaddress, jobtitle, contact_sex, proactive, letter, name_of_pdf)
27
+ own_name, own_email_address, own_smtp, own_username, own_password = LatexCurriculumVitae::GetConfig.get_smtp
28
+ introduction = LatexCurriculumVitae::Email.introduction(contact, contact_sex)
29
+ subject = LatexCurriculumVitae::Email.subject(proactive, jobtitle)
30
+ body = LatexCurriculumVitae::Email.get_body(introduction, letter)
31
+ home = Dir.home
32
+ prefix = "#{home}/.rvm/rubies/default"
33
+ datadir = "#{prefix}/share"
34
+ filename = "#{home}/.latex_curriculum_vitae/#{name_of_pdf}.pdf"
28
35
 
29
- if contact == ''
30
- introduction = 'Sehr geehrte Damen und Herren,'
31
- else
32
- contact.gsub!(/ /, '%20')
33
- if contact_sex == 'male'
34
- introduction = "Sehr geehrter Herr #{contact},"
36
+ Pony.mail({
37
+ :to => emailaddress,
38
+ :bcc => own_email_address,
39
+ :from => own_email_address,
40
+ :subject => subject,
41
+ :body => body,
42
+ :attachments => {'Bewerbungsunterlagen_Manns.pdf' => File.read(filename)},
43
+ :via => :smtp,
44
+ :via_options => {
45
+ :address => own_smtp,
46
+ :port => '25',
47
+ :user_name => own_username,
48
+ :password => own_password,
49
+ :authentication => :plain, # :plain, :login, :cram_md5, no auth by default
50
+ :domain => 'localhost.localdomain', # the HELO domain provided by the client to the server
51
+ }
52
+ })
53
+ end
54
+
55
+ # Method for building the introduction
56
+ # @param [String] contact Name of the contact
57
+ # @param [String] contact_sex Can be male, female or unknown
58
+ def self.introduction(contact, contact_sex)
59
+ if contact == ''
60
+ introduction = 'Sehr geehrte Damen und Herren,'
35
61
  else
36
- introduction = "Sehr geehrte Frau #{contact},"
62
+ if contact_sex == 'male'
63
+ introduction = "Sehr geehrter Herr #{contact},"
64
+ else
65
+ introduction = "Sehr geehrte Frau #{contact},"
66
+ end
37
67
  end
38
68
  end
39
- introduction.gsub!(/ /, "#{space}")
40
-
41
- jobtitle.gsub!('\&', "#{ampersand}")
42
- jobtitle.gsub!(/ /, "#{space}")
43
69
 
44
- if proactive == 'yes'
45
- subject = "Initiativbewerbung um einen Arbeitsplatz als #{jobtitle}"
46
- else
47
- subject = "Bewerbung um einen Arbeitsplatz als #{jobtitle}"
70
+ # Method for building the subject
71
+ # @param [String] proactive Can be yes or no
72
+ # @param [String] jobtitle Title of the target job
73
+ def self.subject(proactive, jobtitle)
74
+ if proactive == 'yes'
75
+ subject = "Initiativbewerbung um einen Arbeitsplatz als #{jobtitle}"
76
+ else
77
+ subject = "Bewerbung um einen Arbeitsplatz als #{jobtitle}"
78
+ end
48
79
  end
49
80
 
50
- subject.gsub!(/ /, "#{space}")
51
-
52
- # rubocop:disable Style/MultilineOperationIndentation
53
- body = "#{introduction}" + "#{crlf}" + "#{crlf}" +
54
- 'gerne möchte ich mich bei Ihnen für die obige Stelle bewerben.' + "#{crlf}" +
55
- 'Ich kann auf einige Jahre im IT-Bereich zurückblicken und war' + "#{crlf}" +
56
- 'hauptsächlich in den Bereichen Support und Geschäftsprozess- ' + "#{ampersand}" + "#{crlf}" +
57
- 'Anwendungsdokumentation tätig, zuletzt im Bankbereich.' + "#{crlf}" + "#{crlf}" +
58
- 'Auf die übliche übertriebene Selbstdarstellung verzichte ich an dieser' + "#{crlf}" +
59
- 'Stelle, da dies nicht mein Stil ist und Sie tatsächlich ohne mich' + "#{crlf}" +
60
- 'auskommen würden.' + "#{crlf}" + "#{crlf}" +
61
- 'Dennoch freue ich mich auf eine Einladung zum Vorstellungsgespräch.' + "#{crlf}" + "#{crlf}" +
62
- 'Meine Bewerbungsunterlagen sind der Mail als Anhang beigefügt.' + "#{crlf}"
63
- body.gsub!(/ /, "#{space}")
81
+ # Method for building the email body
82
+ # @param [String] introduction EMail introduction
83
+ # @param [String] letter With motivational letter? Can be yes or no
84
+ def self.get_body(introduction, letter)
85
+ # rubocop:disable Style/MultilineOperationIndentation
86
+ if letter == 'no'
87
+ body =<<EOF
88
+ #{introduction}
89
+ Wie ich Ihrer Anzeige entnommen habe, suchen Sie jemanden für die obige Position, um
90
+ die ich mich bewerbe. Mit meinen vielfältigen Erfahrungen als Kaufmann, Community Ma-
91
+ nager, Buchautor und Customer Supporter (Level 1&2), sowie Autor Geschäftsprozess- &
92
+ Anwendungsdokumentation könnte ich Ihr neuer Mitarbeiter sein.
93
+ Seit dieser Zeit habe ich an teamgesteuerten Projekten für Kunden mitgearbeitet, wo-
94
+ bei mein Schwerpunkt im Bereich Kundenpflege via Telefon und Email, Dispatching und
95
+ Teamcontrolling lag.
96
+ In für mich fremde Arbeitsgebiete werde ich mich rasch einarbeiten.
97
+ Meine Kenntnisse in IT und Organisationsfähigkeiten kann ich für Ihr Unternehmen im
98
+ Bereich des Managements gewinnbringend umsetzen.
99
+ Persönlich runde ich das Profil mit den Eigenschaften: Teamfähigkeit, Kommunikations-
100
+ stärke und Leistungsbereitschaft ab.
101
+ Ich bin mir sicher, die von Ihnen gewünschten Kenntnisse und Fähigkeiten mitzubringen,
102
+ und würde mich sehr über ein Vorstellungsgespräch freuen.
103
+ EOF
104
+ else
105
+ body =<<EOF
106
+ #{introduction}
107
+ gerne möchte ich mich bei Ihnen für die obige Stelle bewerben.
108
+ Meine Bewerbungsunterlagen samt des offiziellen Anschreibens sind der Mail als Anhang beigefügt.
109
+ EOF
110
+ end
111
+ end
64
112
 
65
- home = Dir.home
66
- prefix = "#{home}/.rvm/rubies/default"
67
- datadir = "#{prefix}/share"
68
- attachment = "#{datadir}/latex_curriculum_vitae/Bewerbungsunterlagen_Manns.pdf"
69
- puts 'Opening Email'.colour(:green)
70
- system("thunderbird mailto:#{emailaddress}?subject=#{subject}\\&body=#{body}\\&attach=#{attachment}")
113
+ # Method for checking the result
114
+ # @param [String] contact Name of the contact
115
+ # @param [String] emailaddress Email address from the contact
116
+ # @param [String] jobtitle The given jobtitle
117
+ # @param [String] contact_sex Can be male, female or unknown
118
+ # @param [String] proactive Can be yes or no
119
+ # @param [String] letter With motivational letter? Can be yes or no
120
+ # @param [String] name_of_pdf Name of the resulting PDF file
121
+ def self.resultok(contact, emailaddress, jobtitle, contact_sex, proactive, letter, name_of_pdf)
122
+ resultfileok = `yad --title="Resulting file" --center --on-top --form \
123
+ --item-separator=, --separator="|" \
124
+ --field="Resulting file ok?:CBE" \
125
+ "yes,no"`
126
+ ok = resultfileok.chomp.split('|')
127
+ if ok.include? 'yes'
128
+ LatexCurriculumVitae::Email.create_email(contact, emailaddress, jobtitle, contact_sex, proactive, letter, name_of_pdf)
129
+ else
130
+ abort('Aborted')
131
+ end
132
+ end
71
133
  end
72
134
  end
@@ -11,13 +11,14 @@ require 'fileutils'
11
11
  require 'rainbow/ext/string'
12
12
 
13
13
  # Module for creating the entityfile
14
- module Entityfile
15
- # rubocop:disable Metrics/LineLength
16
- # Method for getting information
17
- # @param [String] entitytex Path to the entity.tex
18
- # @return [Array] contact, emailaddress, jobtitle, contact_sex, company, proactive:q:q
19
- def self.get_information(entitytex)
20
- resume = `yad --title="Create application" --center --on-top --form \
14
+ module LatexCurriculumVitae
15
+ module Entityfile
16
+ # rubocop:disable Metrics/LineLength
17
+ # Method for getting information
18
+ # @param [String] entitytex Path to the entity.tex
19
+ # @return [Array] contact, emailaddress, jobtitle, contact_sex, company, proactive:q:q
20
+ def self.get_information(entitytex)
21
+ resume = `yad --title="Create application" --center --on-top --form \
21
22
  --item-separator=, --separator="|" \
22
23
  --field="What is the jobtitle of your application? Escape amp with backslash:TEXT" \
23
24
  --field="Is it a proactive application?:CBE" \
@@ -29,67 +30,67 @@ module Entityfile
29
30
  --field="If you have a contact so give me the name of him/her. Leave blank if unknown contact:TEXT" \
30
31
  --field="Tell me the email address for sending the application:TEXT" \
31
32
  --button="Go!" "" "yes,no" "" "yes,no" "" "" "male,female,unknown" "" ""`
32
- jobtitle, proactive, company, letter, street, city, contact_sex, contact, emailaddress = resume.chomp.split('|')
33
- [jobtitle, proactive, company, letter, street, city, contact_sex, contact, emailaddress].each do |s|
34
- puts s
35
- end
33
+ jobtitle, proactive, company, letter, street, city, contact_sex, contact, emailaddress = resume.chomp.split('|')
34
+ [jobtitle, proactive, company, letter, street, city, contact_sex, contact, emailaddress].each do |s|
35
+ puts s
36
+ end
36
37
 
37
- create_file(jobtitle, company, street, city, contact, entitytex, contact_sex, proactive)
38
- [contact, emailaddress, jobtitle, contact_sex, company, letter, proactive]
39
- end
38
+ create_file(jobtitle, company, street, city, contact, entitytex, contact_sex, proactive)
39
+ [contact, emailaddress, jobtitle, contact_sex, company, letter, proactive]
40
+ end
40
41
 
41
- # # Method for getting information through a real gui
42
- # def self.get_information_gui(entitytex)
43
- # # TODO: Extend code for using the gtk GUI
44
- # require 'gtk2'
45
- # require 'libglade2'
46
- # @threads = []
47
- #
48
- # Gtk.init
49
- #
50
- # @glade = GladeXML.new('glade/latexcv.glade')
51
- # @glade.widget_names.each do |name|
52
- # instance_variable_set("@#{name}".intern, @glade[name])
53
- # end
54
- # end
42
+ # # Method for getting information through a real gui
43
+ # def self.get_information_gui(entitytex)
44
+ # # TODO: Extend code for using the gtk GUI
45
+ # require 'gtk2'
46
+ # require 'libglade2'
47
+ # @threads = []
48
+ #
49
+ # Gtk.init
50
+ #
51
+ # @glade = GladeXML.new('glade/latexcv.glade')
52
+ # @glade.widget_names.each do |name|
53
+ # instance_variable_set("@#{name}".intern, @glade[name])
54
+ # end
55
+ # end
55
56
 
56
- # Method for creating the entity.tex
57
- # @param [String] jobtitle Title of the target job
58
- # @param [String] company Comanys name
59
- # @param [String] street Companies street
60
- # @param [String] city City of the company
61
- # @param [String] contact Name of the contact
62
- # @param [String] entitytex Path to the entity.tex
63
- def self.create_file(jobtitle, company, street, city, contact, entitytex, contact_sex, proactive)
64
- if contact == ''
65
- introduction = 'Sehr geehrte Damen und Herren,'
66
- else
67
- if contact_sex == 'male'
68
- introduction = "Sehr geehrter Herr #{contact},"
57
+ # Method for creating the entity.tex
58
+ # @param [String] jobtitle Title of the target job
59
+ # @param [String] company Comanys name
60
+ # @param [String] street Companies street
61
+ # @param [String] city City of the company
62
+ # @param [String] contact Name of the contact
63
+ # @param [String] entitytex Path to the entity.tex
64
+ def self.create_file(jobtitle, company, street, city, contact, entitytex, contact_sex, proactive)
65
+ if contact == ''
66
+ introduction = 'Sehr geehrte Damen und Herren,'
69
67
  else
70
- introduction = "Sehr geehrte Frau #{contact},"
68
+ if contact_sex == 'male'
69
+ introduction = "Sehr geehrter Herr #{contact},"
70
+ else
71
+ introduction = "Sehr geehrte Frau #{contact},"
72
+ end
73
+ end
74
+ if proactive == 'yes'
75
+ subject = "Initiativbewerbung um einen Arbeitsplatz als #{jobtitle}"
76
+ intro = 'Gerne möchte ich mich bei Ihnen um die obige oder eine vergleichbare Stelle bewerben.'
77
+ else
78
+ subject = "Bewerbung um einen Arbeitsplatz als #{jobtitle}"
79
+ intro = 'Wie ich Ihrer Anzeige entnommen habe, suchen Sie jemanden für die obige Position, um die ich mich bewerbe.'
71
80
  end
72
- end
73
- if proactive == 'yes'
74
- subject = "Initiativbewerbung um einen Arbeitsplatz als #{jobtitle}"
75
- intro = 'Gerne möchte ich mich bei Ihnen um die obige oder eine vergleichbare Stelle bewerben.'
76
- else
77
- subject = "Bewerbung um einen Arbeitsplatz als #{jobtitle}"
78
- intro = "Wie ich Ihrer Anzeige entnommen habe, stellen Sie einen #{jobtitle} ein. Um diese Position bewerbe ich mich und übersende Ihnen hiermit meine Unterlagen."
79
- end
80
81
 
81
- addressstring = "#{company} \\\\"
82
- if contact == ''
83
- addressstring << 'z.Hd. Personalabteilung \\\\'
84
- else
85
- addressstring << "z.Hd. #{contact} \\\\"
86
- end
87
- addressstring << "#{street} \\\\" if street != ''
88
- addressstring << "#{city}" if city != ''
82
+ addressstring = "#{company} \\\\"
83
+ if contact == ''
84
+ addressstring << 'z.Hd. Personalabteilung \\\\'
85
+ else
86
+ addressstring << "z.Hd. #{contact} \\\\"
87
+ end
88
+ addressstring << "#{street} \\\\" if street != ''
89
+ addressstring << "#{city}" if city != ''
89
90
 
90
- FileUtils.rm(entitytex) if File.exist?(entitytex)
91
- FileUtils.touch(entitytex)
92
- File.write "#{entitytex}", <<EOF
91
+ FileUtils.rm(entitytex) if File.exist?(entitytex)
92
+ FileUtils.touch(entitytex)
93
+ File.write "#{entitytex}", <<EOF
93
94
  \\def\\jobtitle{#{jobtitle}}
94
95
  \\def\\company{#{company}}
95
96
  \\def\\contact{#{contact}}
@@ -100,5 +101,6 @@ module Entityfile
100
101
  \\def\\addressstring{#{addressstring}}
101
102
  \\def\\intro{#{intro}}
102
103
  EOF
104
+ end
103
105
  end
104
106
  end
@@ -10,16 +10,33 @@
10
10
  require 'parseconfig'
11
11
 
12
12
  # Module for creating the GetConfig
13
- module Getconfig
14
- # This method gets the configs from the config file
15
- # @return [String] name_of_pdf Names the output PDF file
16
- def self.get
17
- home = Dir.home
18
- config = ParseConfig.new("#{home}/.latex_curriculum_vitae/latex_curriculum_vitae.cfg")
19
- name_of_pdf = config['name_of_pdf']
20
- name_of_cover = config['name_of_cover']
21
- name_of_resume = config['name_of_resume']
22
- name_of_letter = config['name_of_letter']
23
- [name_of_pdf, name_of_cover, name_of_resume, name_of_letter]
13
+ module LatexCurriculumVitae
14
+ module GetConfig
15
+ # This method gets the configs from the config file
16
+ # @return [Array] name_of_pdf, name_of_cover, name_of_resume, name_of_letter
17
+ def self.get
18
+ home = Dir.home
19
+ config = ParseConfig.new("#{home}/.latex_curriculum_vitae/latex_curriculum_vitae.cfg")
20
+ name_of_pdf = config['name_of_pdf']
21
+ name_of_cover = config['name_of_cover']
22
+ name_of_resume = config['name_of_resume']
23
+ name_of_letter = config['name_of_letter']
24
+ [name_of_pdf, name_of_cover, name_of_resume, name_of_letter]
25
+ end
26
+
27
+ # Method for getting smtp configuration
28
+ # @return [Array] own_name, own_email_address, own_smtp, own_username, own_password
29
+ def self.get_smtp
30
+ home = Dir.home
31
+ config = ParseConfig.new("#{home}/.latex_curriculum_vitae/latex_curriculum_vitae.cfg")
32
+ own_name = config['own_name']
33
+ own_email_address = config['own_email_address']
34
+ own_smtp = config['own_smtp']
35
+ own_username = config['own_username']
36
+ own_password = config['own_password']
37
+
38
+ [own_name, own_email_address, own_smtp, own_username, own_password]
39
+ end
40
+
24
41
  end
25
42
  end
@@ -11,13 +11,15 @@ require 'fileutils'
11
11
  require 'rainbow/ext/string'
12
12
 
13
13
  # Module for creating the motivational letter
14
- module Letter
15
- # Method for creating a pdf from tex
16
- def self.create_letter(tmpdir, name_of_letter)
17
- puts 'Compiling motivational letter'.colour(:yellow)
18
- system("pdflatex #{name_of_letter}.tex")
19
- puts 'Done compiling motivational letter'.colour(:green)
20
- system("cp #{name_of_letter}.pdf #{tmpdir}")
21
- puts 'Copied motivational letter to tmpdir'.colour(:green)
14
+ module LatexCurriculumVitae
15
+ module Letter
16
+ # Method for creating a pdf from tex
17
+ def self.create_letter(tmpdir, name_of_letter)
18
+ puts 'Compiling motivational letter'.colour(:yellow)
19
+ system("pdflatex #{name_of_letter}.tex")
20
+ puts 'Done compiling motivational letter'.colour(:green)
21
+ system("cp #{name_of_letter}.pdf #{tmpdir}")
22
+ puts 'Copied motivational letter to tmpdir'.colour(:green)
23
+ end
22
24
  end
23
25
  end
@@ -4,23 +4,25 @@
4
4
  # @abstract Notifier Module for latex_curriculum_vitae
5
5
  #
6
6
  # Copyright (C) 2015 Sascha Manns <samannsml@directbox.com>
7
- # License: GPL-3
7
+ # License: MIT
8
8
 
9
9
  # Dependencies
10
10
 
11
11
  # Module for notify the user
12
12
  require 'notifier'
13
13
 
14
- module Notifier
15
- def self.run
16
- home = Dir.home
17
- prefix = "#{home}/.rvm/rubies/default"
18
- datadir = "#{prefix}/share"
19
- img = "#{datadir}/latex_curriculum_vitae/Pictures/arbeitsagentur.png"
20
- Notifier.notify(
21
- :image => "#{img}",
22
- :title => "Your Job Application",
23
- :message => "Your Job Application was created now."
24
- )
14
+ module LatexCurriculumVitae
15
+ module Notify
16
+ def self.run(jobtitle)
17
+ home = Dir.home
18
+ prefix = "#{home}/.rvm/rubies/default"
19
+ datadir = "#{prefix}/share"
20
+ img = "#{datadir}/latex_curriculum_vitae/Pictures/arbeitsagentur.png"
21
+ Notifier.notify(
22
+ :image => "#{img}",
23
+ :title => "Your Job Application",
24
+ :message => "Your Job Application #{jobtitle} was created now."
25
+ )
26
+ end
25
27
  end
26
- end
28
+ end
@@ -4,32 +4,34 @@
4
4
  # @abstract CV Module for latex_curriculum_vitae
5
5
  #
6
6
  # Copyright (C) 2015 Sascha Manns <samannsml@directbox.com>
7
- # License: GPL-3
7
+ # License: MIT
8
8
 
9
9
  # Dependencies
10
10
  require 'csv'
11
11
 
12
12
  # Module for creating and appending the outfile
13
- module CVOutfile
14
- # Method to adding the data into the csv file
15
- def self.add_to_outfile(jobtitle, company, contact, emailaddress, csvout)
16
- home = Dir.home
17
- time = Time.new
18
- date = time.strftime('%Y-%m-%d')
19
- contact.gsub!('%20', ' ')
20
- jobtitle.gsub!('%20', ' ')
21
- jobtitle.gsub!('%26', '&')
22
- if File.exist?(csvout)
23
- puts 'do nothing'
24
- else
25
- FileUtils.touch(csvout)
26
- File.write "#{csvout}", <<EOF
13
+ module LatexCurriculumVitae
14
+ module CVOutfile
15
+ # Method to adding the data into the csv file
16
+ def self.add_to_outfile(jobtitle, company, contact, emailaddress, csvout)
17
+ home = Dir.home
18
+ time = Time.new
19
+ date = time.strftime('%Y-%m-%d')
20
+ contact.gsub!('%20', ' ')
21
+ jobtitle.gsub!('%20', ' ')
22
+ jobtitle.gsub!('%26', '&')
23
+ if File.exist?(csvout)
24
+ puts 'do nothing'
25
+ else
26
+ FileUtils.touch(csvout)
27
+ File.write "#{csvout}", <<EOF
27
28
  date,company,job,contact,email,status
28
29
  EOF
29
- end
30
- CSV.open("#{csvout}", 'a+') do |csv|
31
- #datum,firma,stelle,kontakt,email,status
32
- csv << ["#{date}","#{company}","#{jobtitle}","#{contact}","#{emailaddress}",'Open']
30
+ end
31
+ CSV.open("#{csvout}", 'a+') do |csv|
32
+ #datum,firma,stelle,kontakt,email,status
33
+ csv << ["#{date}", "#{company}", "#{jobtitle}", "#{contact}", "#{emailaddress}", 'Open']
34
+ end
33
35
  end
34
36
  end
35
37
  end