zresume 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +47 -28
- data/examples/zhubo.rb +109 -0
- data/lib/zresume/box.rb +9 -0
- data/lib/zresume/list.rb +14 -10
- data/lib/zresume/person.rb +6 -12
- data/lib/zresume/version.rb +1 -1
- data/lib/zresume.rb +3 -2
- data/spec/person_spec.rb +5 -14
- metadata +4 -2
data/README.md
CHANGED
@@ -1,12 +1,5 @@
|
|
1
1
|
# Zresume
|
2
2
|
|
3
|
-
TODO:
|
4
|
-
* Add command line interface
|
5
|
-
* `zresume new YourClassName` : generate the Scaffold of Your Personal Resume
|
6
|
-
* `zresume g [format]` : generate a static file in the format passed in .
|
7
|
-
* Add printable feature
|
8
|
-
* let the customized class support .md and html
|
9
|
-
|
10
3
|
## Installation
|
11
4
|
|
12
5
|
Add this line to your application's Gemfile:
|
@@ -22,19 +15,39 @@ Or install it yourself as:
|
|
22
15
|
$ gem install zresume
|
23
16
|
|
24
17
|
## Syntax
|
25
|
-
`info *array` register the attributes you need.Once you set the attribute by `info` you can set it's value simply
|
18
|
+
`info *array` register the attributes you need.Once you set the attribute by `info` you can set it's value simply following the syntax: `attrname value`.
|
26
19
|
|
27
|
-
The Value can Be Any Kind of Ruby Object. Mostly you set it a string, number or array.
|
20
|
+
The Value can Be Any Kind of Ruby Object. Mostly you set it a string, a number or an array.
|
28
21
|
|
29
|
-
|
22
|
+
Once you set the attributes by info, you get the freedom to set the nested attributes,for example, you want to show your working experiences, of course you have more than one experience, so you need an array to store it, you want to store the company name, the position you have been, the skills you use, ect. Just write it:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
...
|
26
|
+
experiences do
|
27
|
+
year2009_2010 'designer' do
|
28
|
+
company_name 'Google' #have you been there?
|
29
|
+
position 'Frontend Desinger'
|
30
|
+
use 'photoshop'
|
31
|
+
use 'html'
|
32
|
+
use 'css'
|
33
|
+
end
|
34
|
+
year2010_2012 'programmer' do
|
35
|
+
company_name 'home' do
|
36
|
+
desc 'Working as a freelancer'
|
37
|
+
use %W{ruby rails javascript html css photoshp}
|
38
|
+
#...
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
```
|
30
43
|
|
31
44
|
## Usage
|
45
|
+
|
32
46
|
```ruby
|
33
47
|
require 'zresume'
|
34
48
|
class YourName
|
35
49
|
include Zresume::Person
|
36
|
-
info :name, :age, :gender, :experiences, :works, :skills, :working_env, :
|
37
|
-
accounts, :gembox
|
50
|
+
info :name, :age, :gender, :experiences, :works, :skills, :working_env, :public_accounts, :gembox
|
38
51
|
#register the attributes
|
39
52
|
name 'My Name'
|
40
53
|
age 25
|
@@ -61,9 +74,10 @@ You can pass in a block as the value too. In this block, You can use the method
|
|
61
74
|
And My Job is #{do_what}.
|
62
75
|
"
|
63
76
|
EOF
|
64
|
-
#position, do_what, use, company_url, and output are not predefined methods
|
77
|
+
#position, do_what, use, company_url, and output are not predefined methods.
|
78
|
+
#You just write it, and you will get a method named by it,
|
65
79
|
#and set the value for you.right now you can access the value.
|
66
|
-
#In This Example, `YourName.new.experiences[0].do_what` will
|
80
|
+
#In This Example, `YourName.new.experiences.item[0].do_what` will
|
67
81
|
#get the value 'Web Site interface design. Convert PSD to HTML+CSS+JS.'
|
68
82
|
end
|
69
83
|
|
@@ -83,28 +97,33 @@ You can pass in a block as the value too. In this block, You can use the method
|
|
83
97
|
skills %w{ruby rails javascript jquery html css}
|
84
98
|
|
85
99
|
working_env do
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
100
|
+
operation_system 'Ubuntu Linux 12.04 LTS'
|
101
|
+
vps 'Linode 512'
|
102
|
+
webserver 'Nginx'
|
103
|
+
editor 'Sublime Text2'
|
104
|
+
language 'Ruby 1.9.3'
|
105
|
+
framework 'Rails 2.x-3.x'
|
106
|
+
database 'Mysql/Mongodb'
|
107
|
+
test_frame 'Rspec'
|
108
|
+
vcs 'Git'
|
95
109
|
end
|
96
110
|
|
97
111
|
public_accounts do
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
112
|
+
email 'zhuboliu@gmail.com'
|
113
|
+
qq 455912224
|
114
|
+
git 'https://github.com/suffering'
|
115
|
+
phone 11111111111
|
102
116
|
end
|
103
117
|
|
104
118
|
gembox %w{devise cancan bootstrap coffeescript rspec mongoid carrierwave simple_form ckeditor kaminari active_admin}
|
105
119
|
end
|
106
120
|
```
|
107
|
-
TODO:
|
121
|
+
TODO:
|
122
|
+
* Add command line interface
|
123
|
+
* `zresume new YourClassName` : generate the Scaffold of Your Personal Resume
|
124
|
+
* `zresume g [format]` : generate a static file in the format passed in .
|
125
|
+
* Add printable feature
|
126
|
+
* let the customized class support .md and html
|
108
127
|
|
109
128
|
## Contributing
|
110
129
|
|
data/examples/zhubo.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'zresume'
|
2
|
+
class YourName
|
3
|
+
include Zresume::Person
|
4
|
+
info :name, :age, :gender, :experiences, :works, :skills, :working_env, :public_accounts, :gembox
|
5
|
+
#register the attributes
|
6
|
+
name 'My Name'
|
7
|
+
#.name #=> 'My Name'
|
8
|
+
age 25
|
9
|
+
gender 'male'
|
10
|
+
#set the value in the most simplest way. yes? we set key and value just like writting a hash, but we removed the ":" sign.
|
11
|
+
works do
|
12
|
+
url 'http://www.example.com' do
|
13
|
+
description 'From frontend to backend to deploy, Finished by myself.'
|
14
|
+
end
|
15
|
+
# .works.url #=> 'http://www.example.com'
|
16
|
+
url 'http://www.example2.com'
|
17
|
+
# .works.url #=> ['http://www.example.com', 'http://www.example2.com']
|
18
|
+
url 'http://www.example3.com'
|
19
|
+
# .works.url #=> ['http://www.example.com', 'http://www.example2.com', 'http://www.example3.com']
|
20
|
+
lastdesign 'http://www.example4.com'
|
21
|
+
# .works.lastdesign #=> 'http://www.example4.com'
|
22
|
+
github 'https://github.com/xxx1' do
|
23
|
+
desc 'This gem is...' do
|
24
|
+
d1 'deep one' do
|
25
|
+
d2 'deep two' do
|
26
|
+
d3 'deep three' do
|
27
|
+
#...
|
28
|
+
dn 'deep n'
|
29
|
+
#...
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
#you can nest as deep as you like, but it is not a good idea.
|
34
|
+
d1 'deep one again' do
|
35
|
+
#...
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
# .works.github #=> {:title => 'https://github.com/xxx1', :desc => 'This gem is...'}
|
40
|
+
github 'https://github.com/xxx2'
|
41
|
+
# .works.github #=> [{:title => 'https://github.com/xxx1', :desc => 'This gem is...'}, 'https://github.com/xxx2']
|
42
|
+
github 'https://github.com/xxx3'
|
43
|
+
|
44
|
+
# The method `url`, `lastdesign` and `github` are not predefined method,
|
45
|
+
# As you write them in the block, you get these methods.
|
46
|
+
# If a word that not defined before occured in the block, you get a method that return the signed value.
|
47
|
+
# if it was called more than once, you will get an array.
|
48
|
+
# if you pass in a block as the last argument, you will get a hash.
|
49
|
+
end
|
50
|
+
|
51
|
+
experiences do
|
52
|
+
item '2009-2011' do
|
53
|
+
position 'Web Designer'
|
54
|
+
do_what 'Web Site interface design. Convert PSD to HTML+CSS+JS.'
|
55
|
+
use %w{Photoshop Html CSS Javascript}
|
56
|
+
company 'company name'
|
57
|
+
company_url 'http://www.lonwin.net/'
|
58
|
+
output <<-EOF
|
59
|
+
"#{title}: #{position} in #{company}
|
60
|
+
Using: #{use.join(',')}.
|
61
|
+
And My Job is #{do_what}.
|
62
|
+
"
|
63
|
+
EOF
|
64
|
+
#position, do_what, use, company_url, and output are not predefined methods.#You just write it, and you will get a method named by it,
|
65
|
+
#and set the value for you.right now you can access the value.
|
66
|
+
#In This Example, `YourName.new.experiences.item[0].do_what` will
|
67
|
+
#get the value 'Web Site interface design. Convert PSD to HTML+CSS+JS.'
|
68
|
+
end
|
69
|
+
|
70
|
+
item '2011-2012' do
|
71
|
+
company 'company name 2'
|
72
|
+
position 'Web Developer'
|
73
|
+
works 'works 1, works 2, ..., works N'
|
74
|
+
output <<-EOF
|
75
|
+
"#{title}: #{position} in #{company}
|
76
|
+
Do What:
|
77
|
+
#{works}
|
78
|
+
"
|
79
|
+
EOF
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
skills %w{ruby rails javascript jquery html css}
|
84
|
+
|
85
|
+
working_env do
|
86
|
+
operation_system 'Ubuntu Linux 12.04 LTS'
|
87
|
+
vps 'Linode 512'
|
88
|
+
webserver 'Nginx'
|
89
|
+
editor 'Sublime Text2'
|
90
|
+
language 'Ruby 1.9.3'
|
91
|
+
framework 'Rails 2.x-3.x'
|
92
|
+
database 'Mysql/Mongodb'
|
93
|
+
test_frame 'Rspec'
|
94
|
+
vcs 'Git'
|
95
|
+
editor 'Vim'
|
96
|
+
end
|
97
|
+
#this will get a hash that respond to the key-value pair writed before.
|
98
|
+
#.working_env.editor #=> ['Sublime Text2', 'Vim']
|
99
|
+
|
100
|
+
public_accounts do
|
101
|
+
email 'zhuboliu@gmail.com'
|
102
|
+
qq 455912224
|
103
|
+
git 'https://github.com/suffering'
|
104
|
+
phone 11111111111
|
105
|
+
end
|
106
|
+
|
107
|
+
gembox %w{devise cancan bootstrap coffeescript rspec mongoid carrierwave simple_form ckeditor kaminari active_admin}
|
108
|
+
end
|
109
|
+
p YourName.new.skills
|
data/lib/zresume/box.rb
ADDED
data/lib/zresume/list.rb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
module Zresume
|
2
2
|
class List < Hash
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
def method_missing(m, *a, &bl)
|
4
|
+
if !bl
|
5
|
+
if m.to_s =~ /=$/
|
6
|
+
self[$`.intern] = a[0]
|
7
|
+
else
|
8
|
+
return self[m] if a.empty?
|
9
|
+
self[m] ? self[m]=([self[m]].flatten << a[0]) : self[m] = a[0]
|
10
|
+
end
|
11
|
+
else
|
12
|
+
s = List[:title, a[0]]
|
13
|
+
s.instance_eval &bl
|
14
|
+
return self[m] = s if !self[m]
|
15
|
+
self[m] = [self[m]].flatten << s
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
data/lib/zresume/person.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#inspired by _why: http://mislav.uniqpath.com/poignant-guide/dwemthy/
|
2
|
-
require '
|
3
|
-
require 'zresume/printable'
|
2
|
+
require 'zresume/list'
|
4
3
|
module Zresume
|
5
4
|
module Person
|
6
5
|
include Zresume::Printable
|
@@ -33,23 +32,18 @@ module Zresume
|
|
33
32
|
class_eval do
|
34
33
|
define_method(:initialize) do
|
35
34
|
self.class.info.each do |k, v|
|
36
|
-
|
37
|
-
|
35
|
+
if v.respond_to? :lambda?
|
36
|
+
s = Zresume::List[:title, k]
|
37
|
+
s.instance_eval &v
|
38
|
+
v = s
|
39
|
+
end
|
38
40
|
instance_variable_set("@#{k}", v)
|
39
41
|
self.class.info[k] = v
|
40
|
-
self.instance_eval{remove_instance_variable :@tmpbox}
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end#initialize, add the instance variables
|
44
45
|
end
|
45
46
|
end
|
46
|
-
|
47
|
-
def item arg='', &bl
|
48
|
-
tmp = Zresume::List.new
|
49
|
-
tmp.title = arg
|
50
|
-
tmp.instance_eval &bl if block_given?
|
51
|
-
@tmpbox << tmp
|
52
|
-
end
|
53
47
|
|
54
48
|
def to_hash
|
55
49
|
self.class.info
|
data/lib/zresume/version.rb
CHANGED
data/lib/zresume.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
|
2
|
-
require "zresume/list"
|
3
|
-
require "zresume/person"
|
4
2
|
require "zresume/version"
|
3
|
+
require "zresume/list"
|
4
|
+
#require "zresume/box"
|
5
5
|
require "zresume/printable"
|
6
|
+
require "zresume/person"
|
6
7
|
module Zresume
|
7
8
|
# Your code goes here...
|
8
9
|
end
|
data/spec/person_spec.rb
CHANGED
@@ -33,26 +33,17 @@ describe Zresume::Person do
|
|
33
33
|
item 'xxx'
|
34
34
|
end
|
35
35
|
works do
|
36
|
+
url 'example.com'
|
36
37
|
item 'http://www.tevogroup.com/'
|
37
38
|
item 'http://edu.tevogroup.com/'
|
38
39
|
item 'http://www.jndchina.com/'
|
39
40
|
end
|
40
|
-
delete do
|
41
|
-
item 'test'
|
42
|
-
end
|
43
41
|
end
|
44
42
|
z = Kids.new
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
z.experience[
|
49
|
-
z.experience[0].position.should == "Web Master & Programmer"
|
50
|
-
z.experience[0].time.should == "2010-2011"
|
51
|
-
z.experience[0].output.should == "2010-2011, Shenzhen Goldsan electronic STD, Web Master & Programmer"
|
52
|
-
z.works[0].title.should == 'http://www.tevogroup.com/'
|
53
|
-
# p z.works[0]. to_s
|
54
|
-
z.works[1].title.should == 'http://edu.tevogroup.com/'
|
55
|
-
z.works[2].title.should == 'http://www.jndchina.com/'
|
43
|
+
z.experience.item[0].company.should == "Shenzhen Goldsan electronic STD"
|
44
|
+
z.works.item.should == ['http://www.tevogroup.com/', 'http://edu.tevogroup.com/', 'http://www.jndchina.com/']
|
45
|
+
z.works.url.should == 'example.com'
|
46
|
+
z.experience.item[0].output.should == "2010-2011, Shenzhen Goldsan electronic STD, Web Master & Programmer"
|
56
47
|
end
|
57
48
|
end
|
58
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zresume
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -87,7 +87,9 @@ files:
|
|
87
87
|
- LICENSE.txt
|
88
88
|
- README.md
|
89
89
|
- Rakefile
|
90
|
+
- examples/zhubo.rb
|
90
91
|
- lib/zresume.rb
|
92
|
+
- lib/zresume/box.rb
|
91
93
|
- lib/zresume/list.rb
|
92
94
|
- lib/zresume/person.rb
|
93
95
|
- lib/zresume/printable.rb
|