json_resume 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acf2282c64d06aec9a41ee9711be3fbef3725af4
4
- data.tar.gz: 5825e7757c7026569f602b1f3aac407f741d8397
3
+ metadata.gz: 65eb011e84de52ee1e5c96fb447a999a200dd077
4
+ data.tar.gz: ee059110bda4d86bfa5b1efaeb9200feeecbf315
5
5
  SHA512:
6
- metadata.gz: b58c2ec0930cb4b90e0d97cb7444875cb0de50b3e452b1df77e7012ccb5258e9ccc742d7c227486013646c9cb59f0173bc3117ad6427923c7bc931e5b684cb7c
7
- data.tar.gz: c97844ae83da74cbf7f0f5bdbfe09846e514a8424c2d71d165ab5007186194ab711db07116998feef8dd0bf9840df5b05a1fa14cc45f0eecfd4774e97f5dcae6
6
+ metadata.gz: acb9433b5f95a9e833577d246c0175be49305a1df3cd6878f8bb0142395a505aae0973a86b04671c1704ea87f0a55536ed12a5e47a709d88d8cdf079d9234d8e
7
+ data.tar.gz: c9a29c045e7e384991675fd6f444c233eefe68822b7965b0afce626c6bf304374c6650d94f5611c3f501c9a0655a65958d2b1237ef36f30d3e1b455326f1a40f
@@ -43,7 +43,7 @@ class JsonResumeCLI < Thor
43
43
  tgz = Zlib::GzipReader.new(File.open("#{@@orig_locn}/../extras/resume_html.tar.gz", 'rb'))
44
44
  Minitar.unpack(tgz, "#{dest}/#{dir_name}")
45
45
  msg = generate_file(json_input, template, "html", "#{dest}/#{dir_name}/page.html")
46
- msg += " Place it in /var/www/ to host."
46
+ msg += " Place #{dest}/#{dir_name}/ in /var/www/ to host."
47
47
  end
48
48
 
49
49
  def convert_to_html_pdf(json_input, template, dest=Dir.pwd)
@@ -77,11 +77,38 @@ class JsonResumeCLI < Thor
77
77
  end
78
78
 
79
79
  def convert_to_tex_pdf(json_input, template, dest=Dir.pwd)
80
- #ToDo: Test for presence of pdflatex
81
- convert_to_tex(json_input, template, dest, ".tmp_resume.tex")
82
- tex_file = File.read("#{dest}/.tmp_resume.tex")
80
+ file1 = "resume"; filename = "#{file1}.tex"
81
+ convert_to_tex(json_input, template, dest, filename)
82
+ if `which pdflatex` == ""
83
+ puts "It looks like pdflatex is not installed..."
84
+ puts "Either install it with instructions at..."
85
+ puts "http://dods.ipsl.jussieu.fr/fast/pdflatex_install.html"
86
+ return use_write_latex(dest, filename)
87
+ end
88
+ if `kpsewhich moderncv.cls` == ""
89
+ puts "It looks liks moderncv package for tex is not installed"
90
+ puts "Read about it here: http://ctan.org/pkg/moderncv"
91
+ return use_write_latex(dest, filename)
92
+ end
93
+ system("pdflatex -shell-escape -interaction=nonstopmode #{dest}/#{filename}")
94
+ [".tex",".out",".aux",".log"].each do |ext|
95
+ FileUtils.rm "#{dest}/#{file1}#{ext}"
96
+ end
97
+ msg = "\nPDF is ready at #{dest}/#{file1}.pdf"
98
+ end
99
+
100
+ def use_write_latex(dest, filename)
101
+ reply = ask "Create PDF online using writeLatex ([y]n)?"
102
+ if reply == "" || reply == "y"
103
+ return convert_using_writeLatex(dest, filename)
104
+ end
105
+ msg = "Latex file created at #{dest}/#{filename}"
106
+ end
107
+
108
+ def convert_using_writeLatex(dest, filename)
109
+ tex_file = File.read("#{dest}/#{filename}")
83
110
  RestClient.post(WL_URL, :snip => tex_file, :splash => "none") do |response, req, res, &bb|
84
- FileUtils.rm "#{dest}/.tmp_resume.tex"
111
+ FileUtils.rm "#{dest}/#{filename}"
85
112
  msg = "\nPDF is ready at #{response.headers[:location]}"
86
113
  end
87
114
  end
@@ -1,3 +1,3 @@
1
1
  module JsonResume
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_resume
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prateek Agarwal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-31 00:00:00.000000000 Z
11
+ date: 2014-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler