multiformat-cv 0.0.2 → 0.0.3

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: b6677b813b81fb570431de8d0879e0fd7f03688d
4
- data.tar.gz: 5341b0590756511b160d9ea80af26122d8ed423a
3
+ metadata.gz: a643b32c69c2ac50f666e61501e37af3f9b9d683
4
+ data.tar.gz: 490e3e5358ffa569d44897d9568fa3fc4be4fa1e
5
5
  SHA512:
6
- metadata.gz: e7d2d60c6602c4583ea0f7745f735e1019655306457d8622c972d668aea42c59d6af380a2e46e8fe864c0a7d898a08370a0cc28bad2b6170878d483ce23f701d
7
- data.tar.gz: 8b7e24762a0cf2e6a096bf7a396b746758264f072129805ece8b59c2af43b7fd71102ae785851b33d6b5f7085c091ea3f4f589ae29ccde9ed5677a92b6f5ca1a
6
+ metadata.gz: 1aeac7364aa79a92cf5c89f152e527dcea9eda4ef5d78066937737901a8418dcd25c53eb077ec45881773c83c8502faef156837878708364f9c42c040ffcb3fd
7
+ data.tar.gz: eb735e434860c919026f7dd3c6bfa51e89a60e688b6d84b4311b25753ce49945e9cd4b2d4982bae4c6a287e98057afbd956e2e62f33a7159e719e44197236397
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2004-2019 David Heinemeier Hansson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # Multiformat CV
2
+
3
+ Multi-format CV generator from YAML files
4
+
5
+ ## TODO
6
+
7
+ * [x] Add template engine for outputs
8
+ * [x] Add parameter for input data directory
data/bin/multiformatcv ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "multiformatcv"
5
+ require "mercenary"
6
+
7
+ Mercenary.program(:multiformatcv) do |p|
8
+ p.version MultiformatCV::VERSION
9
+ p.description "Generate your CV in different formats"
10
+ p.syntax "multiformatcv <format> [-d './data'] [-t <directory>] [-o <file>]"
11
+
12
+ p.option "format", "-f FORMAT", "--format FORMAT", "Output format", String
13
+ p.option "data_dir", "-d DIR", "--data DIR", "YAML data files directory", String
14
+ p.option "templates", "-s DIR", "--templates DIR", "Templates directory, MUST contain cv.<format>.erb file", String
15
+ p.option "output", "-o FILE", "--outpu FILEt", "Output where to write result, defaults to STDOUT", String
16
+
17
+ p.action do |args, options|
18
+ MultiformatCV::generate(options)
19
+ end
20
+ end
data/lib/multiformatcv.rb CHANGED
@@ -18,22 +18,28 @@ module MultiformatCV
18
18
  # @see https://www.rubydoc.info/gems/erubi/1.8.0 Erubi documentation
19
19
  # @see Erubi::Engine
20
20
  def self.generate(opts = {})
21
- opts[:format] ||= :html
22
- opts[:data_dir] ||= 'data'
23
- opts[:templates] ||= File.expand_path("../multiformatcv/templates", __FILE__)
21
+ opts['format'] ||= 'html'
22
+ opts['data_dir'] ||= 'data'
23
+ opts['templates'] ||= File.expand_path("../multiformatcv/templates", __FILE__)
24
+ opts['output'] ||= STDOUT
24
25
 
25
- template = File.read("#{ opts[:templates] }/cv.#{ opts[:format].to_s }.erb")
26
+ template = File.read("#{ opts['templates'] }/cv.#{ opts['format'] }.erb")
26
27
  resume = Resume.new
27
28
  yml = nil
28
29
 
29
30
  YML_FILES.each do |f|
30
- yml = YAML.load_file("#{ opts[:data_dir] }/#{ f }.yml")
31
+ yml = YAML.load_file("#{ opts['data_dir'] }/#{ f }.yml")
31
32
  if yml then
32
33
  resume.send("add_#{ f }", yml[f])
33
34
  end
34
35
  end
35
36
 
36
- eval Erubi::Engine.new(template).src
37
+ result = eval Erubi::Engine.new(template).src
38
+ if opts['output'] == STDOUT then
39
+ puts result
40
+ else
41
+ File.open(opts['output'], "w") { |f| f.write(result) }
42
+ end
37
43
  end
38
44
  end
39
45
 
@@ -42,3 +48,4 @@ require 'multiformatcv/job'
42
48
  require 'multiformatcv/personal'
43
49
  require 'multiformatcv/project'
44
50
  require 'multiformatcv/resume'
51
+ require 'multiformatcv/version'
@@ -0,0 +1 @@
1
+ module MultiformatCV VERSION = "0.0.3" end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiformat-cv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - JuanKman94
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-10 00:00:00.000000000 Z
11
+ date: 2019-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubi
@@ -24,12 +24,30 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mercenary
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.3
27
41
  description: Multi-format CV generator from YAML files
28
42
  email: juan.carlos.menonita@gmail.com
29
- executables: []
43
+ executables:
44
+ - multiformatcv
30
45
  extensions: []
31
46
  extra_rdoc_files: []
32
47
  files:
48
+ - MIT-LICENSE
49
+ - README.md
50
+ - bin/multiformatcv
33
51
  - lib/multiformatcv.rb
34
52
  - lib/multiformatcv/contact.rb
35
53
  - lib/multiformatcv/job.rb
@@ -38,6 +56,7 @@ files:
38
56
  - lib/multiformatcv/resume.rb
39
57
  - lib/multiformatcv/templates/cv.html.erb
40
58
  - lib/multiformatcv/templates/cv.tex.erb
59
+ - lib/multiformatcv/version.rb
41
60
  homepage: https://www.gitlab.com/juankman94/multiformat-cv
42
61
  licenses:
43
62
  - MIT