zresume 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in zresume.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 suffering
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Zresume
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
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'zresume'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install zresume
23
+
24
+ ## Syntax
25
+ `info *array` register the attributes you need.Once you set the attribute by `info` you can set it's value simply by `attrname value`.
26
+
27
+ The Value can Be Any Kind of Ruby Object. Mostly you set it a string, number or array.
28
+
29
+ You can pass in a block as the value too. In this block, You can use the method `item(arg='string', &block)` to generate a instance of Zresume::List(a hash like Class, To store more infomations) for you. if you pass in a block to `item`, in this block, you get the freedom to write code just like construct a hash just remove ':' or '=>'. In the following example, You will see it.
30
+
31
+ ## Usage
32
+ ```ruby
33
+ require 'zresume'
34
+ class YourName
35
+ include Zresume::Person
36
+ info :name, :age, :gender, :experiences, :works, :skills, :working_env, :public_
37
+ accounts, :gembox
38
+ #register the attributes
39
+ name 'My Name'
40
+ age 25
41
+ gender 'male'
42
+
43
+ works do
44
+ item 'http://www.example.com' do
45
+ description 'From frontend to backend to deploy, Finished by myself.'
46
+ end
47
+ item 'http://www.example2.com'
48
+ item 'http://www.example3.com'
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[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
+ 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 'Rspec'
94
+ vcs 'Git'
95
+ end
96
+
97
+ public_accounts do
98
+ email 'zhuboliu@gmail.com'
99
+ qq 455912224
100
+ git 'https://github.com/suffering'
101
+ phone 11111111111
102
+ end
103
+
104
+ gembox %w{devise cancan bootstrap coffeescript rspec mongoid carrierwave simple_form ckeditor kaminari active_admin}
105
+ end
106
+ ```
107
+ TODO: Write usage instructions here
108
+
109
+ ## Contributing
110
+
111
+ 1. Fork it
112
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
113
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
114
+ 4. Push to the branch (`git push origin my-new-feature`)
115
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,15 @@
1
+ module Zresume
2
+ class List < Hash
3
+ instance_methods.each do |m|
4
+ undef_method m unless m.to_s =~ /respond_to?|method_missing|^/
5
+ end
6
+
7
+ def method_missing(m, *a)
8
+ m.to_s =~ /=$/ ? self[$`] = a[0] : a!= [] ? self[m.to_s] = a[0] : self[m.to_s]
9
+ end
10
+
11
+ def to_s
12
+ output || title
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,58 @@
1
+ #inspired by _why: http://mislav.uniqpath.com/poignant-guide/dwemthy/
2
+ require 'yaml'
3
+ require 'zresume/printable'
4
+ module Zresume
5
+ module Person
6
+ include Zresume::Printable
7
+ def self.included(base)
8
+ base.extend(Core)
9
+ end
10
+
11
+ module Core
12
+ def metaclass
13
+ class << self
14
+ self
15
+ end
16
+ end#get a metaclass
17
+
18
+ def info *attrs
19
+ return @info if attrs.empty?
20
+
21
+ attr_reader *attrs
22
+
23
+ attrs.each do |key|
24
+ metaclass.instance_eval do
25
+ define_method key do |val=nil, &block|
26
+ @info ||= {}
27
+ val = block if !val and block
28
+ @info[key] = val
29
+ end
30
+ end
31
+ end#set class method
32
+
33
+ class_eval do
34
+ define_method(:initialize) do
35
+ self.class.info.each do |k, v|
36
+ @tmpbox ||= []
37
+ v = self.instance_eval(&v) if v.respond_to? :lambda?
38
+ instance_variable_set("@#{k}", v)
39
+ self.class.info[k] = v
40
+ self.instance_eval{remove_instance_variable :@tmpbox}
41
+ end
42
+ end
43
+ end#initialize, add the instance variables
44
+ end
45
+ 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
+
54
+ def to_hash
55
+ self.class.info
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,24 @@
1
+ #coding: utf-8
2
+ require 'erb'
3
+ module Zresume
4
+ module Printable
5
+ def to_file(format = 'yaml')
6
+ # file_name = "#{name}.#{format}"
7
+ # File.open(file_name, 'w') do |out|
8
+ # out.puts self.to_yaml
9
+ # end
10
+ #pending
11
+ end
12
+
13
+ def file_exit?(format = 'yaml')
14
+ #pending
15
+ end
16
+
17
+ def to_html
18
+ #pending
19
+ end
20
+ def to_json
21
+ #pending
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module Zresume
2
+ VERSION = "0.0.1"
3
+ end
data/lib/zresume.rb ADDED
@@ -0,0 +1,8 @@
1
+ $:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
2
+ require "zresume/list"
3
+ require "zresume/person"
4
+ require "zresume/version"
5
+ require "zresume/printable"
6
+ module Zresume
7
+ # Your code goes here...
8
+ end
@@ -0,0 +1,58 @@
1
+ #coding: utf-8
2
+ require 'zresume'
3
+ describe Zresume::Person do
4
+ before(:all) do
5
+ class Zhubo
6
+ include Zresume::Person
7
+ info(:name, :age, :gender)
8
+ name 'ZhuBo'
9
+ age 27
10
+ gender 'male'
11
+ end
12
+ end
13
+
14
+ describe "inherited form Person" do
15
+ it '.info :k1, :k2,...,:kn' do
16
+ @z = Zhubo.new
17
+ @z.name.should == 'ZhuBo'
18
+ @z.age.should == 27
19
+ @z.gender.should == 'male'
20
+ end
21
+
22
+ it 'Test the list items added by block' do
23
+ class Kids
24
+ include Zresume::Person
25
+ info(:experience, :works, :delete)
26
+ experience do
27
+ item 'Web Master & Programmer' do
28
+ company "Shenzhen Goldsan electronic STD"
29
+ time '2010-2011'
30
+ position 'Web Master & Programmer'
31
+ output [time, company, position].join(', ')
32
+ end
33
+ item 'xxx'
34
+ end
35
+ works do
36
+ item 'http://www.tevogroup.com/'
37
+ item 'http://edu.tevogroup.com/'
38
+ item 'http://www.jndchina.com/'
39
+ end
40
+ delete do
41
+ item 'test'
42
+ end
43
+ end
44
+ z = Kids.new
45
+ p z.to_hash
46
+ p z
47
+ # p z.class.instance_methods(false)
48
+ z.experience[1].title.should == "xxx"
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/'
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,36 @@
1
+ #coding: utf-8
2
+ require 'zresume'
3
+ describe Zresume::Printable do
4
+ before(:all) do
5
+ class Zhubo
6
+ include Zresume::Person
7
+ info(:name, :age, :gender, :experience, :works)
8
+ name 'ZhuBo'
9
+ age 27
10
+ gender 'male'
11
+ experience do
12
+ item 'Web Master & Programmer' do
13
+ company "Shenzhen Goldsan electronic STD"
14
+ time '2010-2011'
15
+ position 'Web Master & Programmer'
16
+ output [time, company, position].join(', ')
17
+ end
18
+ item 'xxx'
19
+ end
20
+ works do
21
+ item 'http://www.tevogroup.com/'
22
+ item 'http://edu.tevogroup.com/'
23
+ item 'http://www.jndchina.com/'
24
+ end
25
+ end
26
+ @zhubo = Zhubo.new
27
+ end
28
+ describe "generate resume" do
29
+ it ".print" do
30
+ pending
31
+ end
32
+ it ".to_file(yaml)" do
33
+ pending
34
+ end
35
+ end
36
+ end
data/zresume.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'zresume/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "zresume"
8
+ spec.version = Zresume::VERSION
9
+ spec.authors = ["suffering"]
10
+ spec.email = ["zhuboliu@gmail.com"]
11
+ spec.description = %q{Use this to write a resume for you.}
12
+ spec.summary = %q{Write resume by ruby, generate serval different kids of files.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rspec", "~> 2.0.0"
23
+ spec.add_development_dependency "active_support", "~> 3.2.13"
24
+ spec.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zresume
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - suffering
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 2.0.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: active_support
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 3.2.13
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 3.2.13
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Use this to write a resume for you.
79
+ email:
80
+ - zhuboliu@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - .gitignore
86
+ - Gemfile
87
+ - LICENSE.txt
88
+ - README.md
89
+ - Rakefile
90
+ - lib/zresume.rb
91
+ - lib/zresume/list.rb
92
+ - lib/zresume/person.rb
93
+ - lib/zresume/printable.rb
94
+ - lib/zresume/version.rb
95
+ - spec/person_spec.rb
96
+ - spec/printable_spec.rb
97
+ - zresume.gemspec
98
+ homepage: ''
99
+ licenses:
100
+ - MIT
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubyforge_project:
119
+ rubygems_version: 1.8.24
120
+ signing_key:
121
+ specification_version: 3
122
+ summary: Write resume by ruby, generate serval different kids of files.
123
+ test_files:
124
+ - spec/person_spec.rb
125
+ - spec/printable_spec.rb
126
+ has_rdoc: