jobless 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 18fb4b473585b4be63b59644457ef7bb90fbae5b
4
+ data.tar.gz: 622e24bdd308a4454d482a6a9e22005b220c35be
5
+ SHA512:
6
+ metadata.gz: 85fbece6b3a6d89c8fd2900a87448ffc42cd30418f777b0ffa8b9f01389f94bf7665edf3d9bb7b88f44a759a757b1bf27b344024164bb883cb2bd4b678d92f3a
7
+ data.tar.gz: 4db5bf01db2afd2a23acbfbbe4ee9e63507a7edd27e1df5b65969f28487c4f2598e81ce38ed15f91be4bcca5ff3957fa82a75537ba7c41fb2217ec8d971fa5c1
data/lib/document.rb ADDED
@@ -0,0 +1,58 @@
1
+ require 'erb'
2
+
3
+ module Jobless
4
+ class Document
5
+ attr_reader :groups, :data
6
+
7
+ def initialize
8
+ @data = {}
9
+ @groups = []
10
+ @template = File.expand_path("../template.html.erb", __FILE__)
11
+ end
12
+
13
+ # Define methods for setting personal data
14
+ %w(name location address homepage email).each do |attribute_name|
15
+ define_method(attribute_name) do |attribute=nil|
16
+ if attribute
17
+ @data[attribute_name.to_sym] = attribute
18
+ else
19
+ @data[attribute_name.to_sym]
20
+ end
21
+ end
22
+ end
23
+
24
+ def group(name, type=nil, &block)
25
+ group = Group.new(name, type)
26
+ group.instance_eval &block
27
+ @groups.push group
28
+ end
29
+
30
+ def employment(&block)
31
+ group("Employment", :employment, &block)
32
+ end
33
+
34
+ def education(&block)
35
+ group("Education", :education, &block)
36
+ end
37
+
38
+ def open_source(&block)
39
+ group("Open source", :open_source, &block)
40
+ end
41
+
42
+ def other_experience(&block)
43
+ group("Other experience", :other_experience, &block)
44
+ end
45
+
46
+ def template(template)
47
+ @template = template
48
+ end
49
+
50
+ def write_to_file(filename)
51
+ renderer = ERB.new(File.read(@template))
52
+ generated_html = renderer.result(binding)
53
+ File.open(filename, 'w') do |file|
54
+ file.write(generated_html)
55
+ end
56
+ end
57
+ end
58
+ end
data/lib/group.rb ADDED
@@ -0,0 +1,19 @@
1
+ module Jobless
2
+ class Group
3
+ attr_reader :items, :name, :type
4
+
5
+ def initialize(name, type=nil)
6
+ @name = name
7
+ @type = type
8
+ @items = []
9
+ end
10
+
11
+ def item(&block)
12
+ item = Item.new
13
+ item.instance_eval &block
14
+ @items.push item
15
+ end
16
+
17
+ alias_method :entry, :item
18
+ end
19
+ end
data/lib/item.rb ADDED
@@ -0,0 +1,25 @@
1
+ module Jobless
2
+ class Item
3
+ attr_reader :data, :bulletins
4
+
5
+ def initialize
6
+ @data = {}
7
+ @bulletins = []
8
+ end
9
+
10
+ # Define methods for setting personal data
11
+ %w(title company homepage technologies description start_date end_date).each do |attribute_name|
12
+ define_method(attribute_name) do |attribute=nil|
13
+ if attribute
14
+ @data[attribute_name.to_sym] = attribute
15
+ else
16
+ @data[attribute_name.to_sym]
17
+ end
18
+ end
19
+ end
20
+
21
+ def bulletin(content)
22
+ @bulletins.push content
23
+ end
24
+ end
25
+ end
data/lib/jobless.rb ADDED
@@ -0,0 +1,12 @@
1
+ require_relative 'document'
2
+ require_relative 'group'
3
+ require_relative 'item'
4
+
5
+ module Jobless
6
+ def self.cv(filename = "cv.html", &block)
7
+ instance = Document.new
8
+ instance.instance_eval &block
9
+ instance.write_to_file(filename)
10
+ end
11
+ end
12
+
@@ -0,0 +1,99 @@
1
+ <html>
2
+ <head>
3
+ <title>CV</title>
4
+ <style>
5
+ @media screen {
6
+ body {
7
+ padding: 0 10% 5em;
8
+ }
9
+ }
10
+ body {
11
+ color: #333;
12
+ font-family: helvetica;
13
+ }
14
+ h1, h2, h3, .title {
15
+ color: #000;
16
+ font-family: helvetica;
17
+ }
18
+ h1 {
19
+ float: left;
20
+ font-size: 50px;
21
+ margin-top: 20px;
22
+ }
23
+ h3 {
24
+ border-bottom: 3px solid #bbb;
25
+ font-size: 26px;
26
+ margin-top: 3em 0 0.25em 0;
27
+ }
28
+ .technologies {
29
+ font-size: 14px;
30
+ font-style: italic;
31
+ margin-top: 0;
32
+ }
33
+ .time-span {
34
+ position: absolute;
35
+ right: 0;
36
+ top: 0;
37
+ }
38
+ .item {
39
+ border-bottom: 1px solid #ddd;
40
+ margin-bottom: 1em;
41
+ position: relative;
42
+ }
43
+ .homepage {
44
+ font-size: 14px;
45
+ }
46
+ .personal-info {
47
+ float: right;
48
+ margin-top: 20px;
49
+ text-align: right;
50
+ }
51
+ </style>
52
+ </head>
53
+ <body>
54
+ <h1><%= name %></h1>
55
+ <div class="personal-info">
56
+ <% if email %><%= email %></br><% end %>
57
+ <% if location %><%= location %></br><% end %>
58
+ <% if address %><%= address %></br><% end %>
59
+ <% if homepage %><a href="<%= homepage %>"><%= homepage %></a><% end %>
60
+ </div>
61
+ <div style="clear:both;"></div>
62
+
63
+ <% groups.each do |group| %>
64
+ <div class="group">
65
+ <h3> <%= group.name %> </h3>
66
+ <% group.items.each do |item| %>
67
+ <div class="item">
68
+ <b class="title"><%= item.title %></b>
69
+ <% if item.company %> - <%= item.company %> <% end %>
70
+ <% if item.homepage %>
71
+ <span class="homepage">
72
+ (<a href="<%= item.homepage %>"><%= item.homepage %></a>)
73
+ </span>
74
+ <% end %>
75
+ <% if item.technologies %>
76
+ <p class="technologies">
77
+ <%= item.technologies %>
78
+ </p>
79
+ <% end %>
80
+ <p><%= item.description %></p>
81
+ <% if item.bulletins %>
82
+ <ul>
83
+ <% item.bulletins.each do |bulletin| %>
84
+ <li><%= bulletin %></li>
85
+ <% end %>
86
+ </ul>
87
+ <% end %>
88
+ <div class="time-span">
89
+ <%= item.start_date %>
90
+ <% if item.end_date %> - <%= item.end_date %> <% end %>
91
+ </div>
92
+ </div>
93
+ <% end %>
94
+ </div>
95
+ <% end %>
96
+ </body>
97
+ </html>
98
+
99
+
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jobless
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Filip Defar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Jobless is a simple DSL for creating a CV in HTML format.
14
+ email: filip.defar@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/document.rb
20
+ - lib/group.rb
21
+ - lib/item.rb
22
+ - lib/jobless.rb
23
+ - lib/template.html.erb
24
+ homepage: https://github.com/dabrorius/jobless
25
+ licenses:
26
+ - MIT
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 2.4.5
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Generate your CV with Ruby
48
+ test_files: []
49
+ has_rdoc: