json_resume 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.
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+ require 'json_resume/formatter'
3
+
4
+ describe "#cleanser" do
5
+ context "when given a hash" do
6
+ it 'removes empty keys in a single level' do
7
+ hash = {"key1" => "", "key2" => ""}
8
+ formatter = JsonResume::Formatter.new hash
9
+ expect(formatter.cleanse.hash).to eq({})
10
+ end
11
+
12
+ it 'removes empty keys in a nested level' do
13
+ hash = {"key1"=> "non-empty", "key2" => {"key3" => [], "key4" => ""}}
14
+ formatter = JsonResume::Formatter.new hash
15
+ expect(formatter.cleanse.hash).to eq({"key1"=> "non-empty"})
16
+ end
17
+ end
18
+ end
19
+
20
+ describe "#format_to_output_type" do
21
+ it 'should make format calls to all valid strings' do
22
+ hash = {"key1"=> "non-empty", "key2" => {"key3" => ["test [Hello]{http://google.com}"]}}
23
+ formatter = JsonResume::Formatter.new hash
24
+ expect(formatter).to receive(:format_string).with("non-empty")
25
+ expect(formatter).to receive(:format_string).with("test [Hello]{http://google.com}")
26
+ formatter.format_to_output_type
27
+ end
28
+ end
29
+
30
+ describe "#add_linkedin_github_url" do
31
+ it 'creates linkedin url if id present' do
32
+ hash = {"linkedin_id"=>"xyz"}
33
+ formatter = JsonResume::Formatter.new hash
34
+ formatter.add_linkedin_github_url
35
+ expect(formatter.hash["linkedin_url"]).to eq("http://linkedin.com/in/xyz")
36
+ end
37
+
38
+ it 'creates github url if github id present' do
39
+ hash = {"github_id"=>"xyz"}
40
+ formatter = JsonResume::Formatter.new hash
41
+ formatter.add_linkedin_github_url
42
+ expect(formatter.hash["github_url"]).to eq("http://github.com/xyz")
43
+ end
44
+
45
+ it 'doesnt create url if id isnt present' do
46
+ hash = {}
47
+ formatter = JsonResume::Formatter.new hash
48
+ formatter.add_linkedin_github_url
49
+ expect(formatter.hash["linkedin_url"]).to be_nil
50
+ expect(formatter.hash["github_url"]).to be_nil
51
+ end
52
+ end
53
+
54
+ describe "#gpa_purger" do
55
+ it 'removes gpa if not opted for' do
56
+ hash = {'bio_data' => {'education' => {'show_gpa' => false, 'schools' => []}}}
57
+ formatter = JsonResume::Formatter.new hash
58
+ formatter.purge_gpa
59
+ expect(formatter.hash['bio_data']['education']['show_gpa']).to be_nil
60
+ end
61
+
62
+ it 'removes gpa if gpa not mentioned' do
63
+ hash = {'bio_data' => {'education' => {'show_gpa' => true, 'schools' => [{}]}}}
64
+ formatter = JsonResume::Formatter.new hash
65
+ formatter.purge_gpa
66
+ expect(formatter.hash['bio_data']['education']['show_gpa']).to be_nil
67
+ end
68
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+ require 'json_resume/reader'
3
+ require 'json_resume/formatter'
4
+
5
+ describe "#reader" do
6
+ context "when given a json file name" do
7
+ it 'reads in the file' do
8
+ File.should_receive(:read).with('test.json').and_return("{\"test\":1}")
9
+ reader = JsonResume::Reader.new 'test.json', {}
10
+ expect(reader.hash).to eq({"test"=>1})
11
+ end
12
+ end
13
+
14
+ context "when given a json string" do
15
+ it 'reads in the string' do
16
+ reader = JsonResume::Reader.new "{\"test\":1}", {}
17
+ expect(reader.hash).to eq({"test"=>1})
18
+ end
19
+ end
20
+
21
+ context "when doing a format!" do
22
+ it 'updates the hash by calling the proper formatter' do
23
+ expect_any_instance_of(JsonResume::FormatterHtml).to receive(:format).and_return(double(:hash =>{}))
24
+ JsonResume::Reader.new("{\"test\":1}",{}).format!
25
+ end
26
+
27
+ it 'updates the hash by calling the proper formatter(Latex)' do
28
+ expect_any_instance_of(JsonResume::FormatterLatex).to receive(:format).and_return(double(:hash =>{}))
29
+ JsonResume::Reader.new("{\"test\":1}", {:output_type=>"latex"}).format!
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,6 @@
1
+ RSpec.configure do |config|
2
+ config.expect_with :rspec do |c|
3
+ c.syntax = :expect
4
+ end
5
+ end
6
+
@@ -0,0 +1,219 @@
1
+ <div id="page">
2
+ {{#bio_data}}
3
+ <div class="contact-details">
4
+ {{#email}}
5
+ <span class="glyphicon glyphicon-envelope"></span> {{email}}<br/>
6
+ {{/email}}
7
+ {{#phone}}
8
+ <span class="glyphicon glyphicon-earphone"></span> {{phone}}<br/>
9
+ {{/phone}}
10
+ {{#website}}
11
+ <span class="glyphicon glyphicon-globe"></span>
12
+ <a href="{{website}}"> {{website}}</a>
13
+ {{/website}}
14
+ </div>
15
+
16
+ <h1 class="emphnext">{{firstname}} {{familyname}}</h1><br/>
17
+ {{#stars}}
18
+ <span class="stars">
19
+ {{#items}}
20
+ {{name}} {{^last}}<span class="glyphicon glyphicon-star-empty"></span>{{/last}}
21
+ {{/items}}
22
+ </span>
23
+ {{/stars}}
24
+ <br/>
25
+
26
+ {{#summary}}
27
+ <h2><span class="glyphicon glyphicon-compressed"></span> Qualification Summary</h2>
28
+ <ul>
29
+ {{#points}}
30
+ <li>{{{.}}}</li>
31
+ {{/points}}
32
+ </ul>
33
+ {{/summary}}
34
+
35
+ {{#github_projects}}
36
+ <h2><img src="public/images/github.png" style="width:22px"></img> GitHub Projects</h2>
37
+ <ul>
38
+ {{#details}}
39
+ <li><a href="https://github.com/{{project_name}}">{{project_name}}</a>
40
+ {{#tagline}} &raquo; {{{tagline}}}{{/tagline}}
41
+ <ul>
42
+ {{#description}}
43
+ <li>{{{.}}}</li>
44
+ {{/description}}
45
+ </ul>
46
+ </li>
47
+ {{/details}}
48
+ </ul>
49
+ {{/github_projects}}
50
+
51
+ {{#skills}}
52
+ <h2><span class="glyphicon glyphicon-th-list"></span> Technical skills</h2>
53
+ <ul class="languages">
54
+ {{#details}}
55
+ <li>{{type}}:
56
+ {{#items}}
57
+ <span class="label label-default">{{name}}</span>
58
+ {{/items}}
59
+ </li>
60
+ {{/details}}
61
+ </ul>
62
+ {{/skills}}
63
+
64
+ {{#education}}
65
+ <h2><span class="glyphicon glyphicon-book"></span> Education</h2>
66
+ <table class="table education">
67
+ <tr>
68
+ <th>Degree</th><th>Major</th><th>Institution</th><th nowrap>Graduation Year</th>{{#show_gpa}}<th>GPA</th>{{/show_gpa}}
69
+ </tr>
70
+ {{#schools}}
71
+ <tr>
72
+ <td>{{degree}}</td><td>{{major}}</td><td>{{institution}}</td><td align="center">{{graduation_year}}</td>{{#show_gpa}}<td>{{gpa}}</td>{{/show_gpa}}
73
+ </tr>
74
+ {{/schools}}
75
+ </table>
76
+ {{/education}}
77
+
78
+ {{#acad_achievements}}
79
+ <h2><span class="glyphicon glyphicon-tower"></span> Academic Achievements</h2>
80
+ <ul>
81
+ {{#items}}
82
+ <li>{{{.}}}</li>
83
+ {{/items}}
84
+ </ul>
85
+ {{/acad_achievements}}
86
+
87
+ {{#experience}}
88
+ <h2><span class="glyphicon glyphicon-briefcase"></span> Professional Experience</h2>
89
+ <ul>
90
+ {{#items}}
91
+ <li>{{title}} at {{{organisation}}}{{#location}}, {{{location}}}{{/location}}
92
+ <span class="right">({{from}} – {{to}})</span>
93
+ <ul>
94
+ {{#details}}
95
+ <li>{{{.}}}</li>
96
+ {{/details}}
97
+ {{#technology_used}}
98
+ <li>Technologies got to work on:
99
+ {{#tools}}
100
+ <span class="label label-default">{{name}}</span>
101
+ {{/tools}}
102
+ </li>
103
+ {{/technology_used}}
104
+ </ul>
105
+ </li>
106
+ {{/items}}
107
+ </ul>
108
+ {{/experience}}
109
+
110
+ {{#other_projects}}
111
+ <h2><span class="glyphicon glyphicon-cog"></span> Other Personal Projects</h2>
112
+ <ul>
113
+ {{#items}}
114
+ <li>
115
+ {{{headline}}}
116
+ <ul>
117
+ {{#points}}
118
+ <li>{{{.}}}</li>
119
+ {{/points}}
120
+ {{#technology_used}}
121
+ <li>Technologies got to work on:
122
+ {{#tools}}
123
+ <span class="label label-default">{{name}}</span>
124
+ {{/tools}}
125
+ </li>
126
+ {{/technology_used}}
127
+ </ul>
128
+ </li>
129
+ {{/items}}
130
+ </ul>
131
+ {{/other_projects}}
132
+
133
+ {{#grad_courses}}
134
+ <h2><span class="glyphicon glyphicon-bookmark"></span> Graduate Courses Taken</h2>
135
+ <table class="table education">
136
+ {{#rows}}
137
+ <tr>
138
+ {{#columns}}
139
+ <td><a href="{{url}}">{{name}}</a></td>
140
+ {{/columns}}
141
+ </tr>
142
+ {{/rows}}
143
+ </table>
144
+ {{/grad_courses}}
145
+
146
+ {{#undergrad_courses}}
147
+ <h2><span class="glyphicon glyphicon-bookmark"></span> Undergraduate Courses Taken</h2>
148
+ <table class="table education">
149
+ {{#rows}}
150
+ <tr>
151
+ {{#columns}}
152
+ <td><a href="{{url}}">{{name}}</a></td>
153
+ {{/columns}}
154
+ </tr>
155
+ {{/rows}}
156
+ </table>
157
+ {{/undergrad_courses}}
158
+
159
+ {{#research_experience}}
160
+ <h2><span class="glyphicon glyphicon-pencil"></span> Research Experience</h2>
161
+ <ul>
162
+ {{#items}}
163
+ <li>
164
+ {{title}} at {{{organisation}}}
165
+ <span class="right">({{from}} – {{to}})</span>
166
+ <ul>
167
+ {{#points}}
168
+ <li>{{{.}}}</li>
169
+ {{/points}}
170
+ </ul>
171
+ </li>
172
+ {{/items}}
173
+ </ul>
174
+ {{/research_experience}}
175
+
176
+ {{#patents}}
177
+ <h2><span class="glyphicon glyphicon-file"></span> Patents</h2>
178
+ <ul>
179
+ {{#items}}
180
+ <li>{{patent_id}}
181
+ <a href="{{url}}">{{title}}</a>
182
+ {{#issuance_date}}, issued {{issuance_date}}{{/issuance_date}}.
183
+ </li>
184
+ {{/items}}
185
+ </ul>
186
+ {{/patents}}
187
+
188
+ {{#papers}}
189
+ <h2><span class="glyphicon glyphicon-edit"></span> Publications</h2>
190
+ <ul>
191
+ {{#items}}
192
+ <li>{{authors}}
193
+ <a href="{{url}}">{{title}},</a>
194
+ {{{misc}}}.
195
+ </li>
196
+ {{/items}}
197
+ </ul>
198
+ {{/papers}}
199
+
200
+ {{#memberships}}
201
+ <h2><span class="glyphicon glyphicon-globe"></span> Memberships</h2>
202
+ <ul>
203
+ {{#committees}}
204
+ <li>{{{.}}}</li>
205
+ {{/committees}}
206
+ </ul>
207
+ {{/memberships}}
208
+
209
+ {{#extra_curricular}}
210
+ <h2><span class="glyphicon glyphicon-music"></span> Extra Curricular Awards</h2>
211
+ <ul>
212
+ {{#items}}
213
+ <li>{{{.}}}</li>
214
+ {{/items}}
215
+ </ul>
216
+ {{/extra_curricular}}
217
+
218
+ {{/bio_data}}
219
+ </div><!-- End Page -->
@@ -0,0 +1,130 @@
1
+ {{#bio_data}}
2
+ ##{{firstname}} {{familyname}}
3
+ [{{website}}]({{website}}) {{#email}}`{{email}}`{{/email}} {{#phone}}`{{phone}}`{{/phone}}
4
+
5
+ {{#stars}}
6
+ {{#items}}{{name}}{{^last}} - {{/last}}{{/items}}
7
+ {{/stars}}
8
+
9
+ {{#summary}}
10
+ ###Qualifications summary
11
+ {{#points}}
12
+ * {{{.}}}
13
+ {{/points}}
14
+ {{/summary}}
15
+
16
+ {{#github_projects}}
17
+ ###GitHub Projects
18
+ {{#details}}
19
+ * [{{project_name}}](http://github.com/{{project_name}}){{#tagline}} : {{tagline}}{{/tagline}}
20
+ {{#description}}
21
+ - {{{.}}}
22
+ {{/description}}
23
+ {{/details}}
24
+ {{/github_projects}}
25
+
26
+ {{#skills}}
27
+ ###Technical Skills
28
+ {{#details}}
29
+ * **{{type}}**: {{#items}}`{{name}}` {{/items}}
30
+ {{/details}}
31
+ {{/skills}}
32
+
33
+ {{#education}}
34
+ ###Education
35
+ Degree | Major | Institution | Graduation Year{{#show_gpa}} | GPA{{/show_gpa}}
36
+ :--:|:--:|:--:|:--:{{#show_gpa}}|:--:{{/show_gpa}}
37
+ {{#schools}}
38
+ {{degree}} | {{major}} | {{institution}} | {{graduation_year}}{{#show_gpa}} | {{gpa}}{{/show_gpa}}
39
+ {{/schools}}
40
+ {{/education}}
41
+
42
+ {{#acad_achievements}}
43
+ ###Academic Achievements
44
+ {{#items}}
45
+ * {{{.}}}
46
+ {{/items}}
47
+ {{/acad_achievements}}
48
+
49
+ {{#experience}}
50
+ ###Professional Experience
51
+ {{#items}}
52
+ * {{title}} at {{{organisation}}}{{#location}}, {{{location}}}{{/location}} ({{from}} – {{to}})
53
+ {{#details}}
54
+ - {{{.}}}
55
+ {{/details}}
56
+ {{#technology_used}}
57
+ - Technologies got to work on: {{#tools}}`{{name}}` {{/tools}}
58
+ {{/technology_used}}
59
+ {{/items}}
60
+ {{/experience}}
61
+
62
+ {{#other_projects}}
63
+ ###Other Personal Projects
64
+ {{#items}}
65
+ * {{{headline}}}
66
+ {{#points}}
67
+ - {{{.}}}
68
+ {{/points}}
69
+ {{#technology_used}}
70
+ - Technologies got to work on: {{#tools}}`{{name}}` {{/tools}}
71
+ {{/technology_used}}
72
+ {{/items}}
73
+ {{/other_projects}}
74
+
75
+ {{#grad_courses}}
76
+ ###Graduate Courses Taken
77
+ {{#rows}}
78
+ {{#columns}}
79
+ {{#name}}* [{{name}}]({{url}}){{/name}}
80
+ {{/columns}}
81
+ {{/rows}}
82
+ {{/grad_courses}}
83
+
84
+ {{#undergrad_courses}}
85
+ ###Undergraduate Courses Taken
86
+ {{#rows}}
87
+ {{#columns}}
88
+ {{#name}}* [{{name}}]({{url}}){{/name}}
89
+ {{/columns}}
90
+ {{/rows}}
91
+ {{/undergrad_courses}}
92
+
93
+ {{#research_experience}}
94
+ ###Research Experience
95
+ {{#items}}
96
+ * {{title}} at {{{organisation}}} ({{from}} – {{to}})
97
+ {{#points}}
98
+ - {{{.}}}
99
+ {{/points}}
100
+ {{/items}}
101
+ {{/research_experience}}
102
+
103
+ {{#patents}}
104
+ ###Patents
105
+ {{#items}}
106
+ * {{patent_id}} - **[{{title}}]({{url}})**{{#issuance_date}}, issued {{issuance_date}}{{/issuance_date}}.
107
+ {{/items}}
108
+ {{/patents}}
109
+
110
+ {{#papers}}
111
+ ###Publications
112
+ {{#items}}
113
+ * {{authors}} **[{{title}}]({{url}})** {{{misc}}}.
114
+ {{/items}}
115
+ {{/papers}}
116
+
117
+ {{#memberships}}
118
+ ###Memberships
119
+ {{#committees}}
120
+ * {{{.}}}
121
+ {{/committees}}
122
+ {{/memberships}}
123
+
124
+ {{#extra_curricular}}
125
+ ###Extra Curricular Awards
126
+ {{#items}}
127
+ * {{{.}}}
128
+ {{/items}}
129
+ {{/extra_curricular}}
130
+ {{/bio_data}}