jeweler上手初体验(create your rubygem using jeweler)

访问量: 1366

传统的gem的建立方式很繁琐, 需要手动控制版本啊,依赖啊。(the problems that creating a rubygem using the official way are:  not very easy to control the version(minor, major, path), and dependencies.  so we use jeweler)

steps:

1. $ gem install jeweler

2. $ rbenv rehash

3. $ jeweler auditable_controller

4. 发现jeweler 都帮你用git 做了提交了( jeweler helps you commited the code)

	create	.gitignore
	create	Rakefile
	create	Gemfile
	create	LICENSE.txt
	create	README.rdoc
	create	.document
	create	lib
	create	lib/auditable_controller.rb
	create	test
	create	test/helper.rb
	create	test/test_auditable_controller.rb
       Jeweler has prepared your gem in ./auditable_controller

5. 修改Gem, 使用 gem "simplecov"  (use simplecov instead of rcov in Gemfile) 

# Gemfile
group :development do
  gem "shoulda", ">= 0"
  gem "rdoc", "~> 3.12"
  gem "bundler", "~> 1.0"
  gem "jeweler", "~> 2.0.0"
  gem "simplecov"   # don't use gem 'rcov' if you are using Ruby 1.9
end

6. bundle install 

7. 修改RakeFile  (remove the rcov code segment from Rakefile)

 35 #require 'rcov/rcovtask'
 36 #Rcov::RcovTask.new do |test|
 37 #  test.libs << 'test'
 38 #  test.pattern = 'test/**/test_*.rb'
 39 #  test.verbose = true
 40 #  test.rcov_opts << '--exclude "gems/*"'
 41 #end

8. create your gem's version: 

$ rake version:write MAJOR=1 MINOR=0 PATCH=1
Updated version: 1.0.1

订阅/RSS Feed

Subscribe

分类/category