gem_polisher
- Home: https://github.com/fornellas/gem_polisher/
- RubyGems.org: https://rubygems.org/gems/gem_polisher/
- Bugs: https://github.com/fornellas/gem_polisher/issues
Description
This Gem provides Rake tasks to assist Ruby Gem development workflow.
Utilization
- Create a new Gem (see http://guides.rubygems.org/make-your-own-gem/)
- Follow already established naming conventions.
- Tip: if you does not use strict camel casing (eg: RDoc and not Rdoc), see GemPolisher#initialize's gem_main_constant_s option.
- Follow already established naming conventions.
- When creating your .gemspec file, point its version attribute to an external file. Eg:
require_relative 'lib/my/gem/with_long_name/version'
Gem::Specification.new do |s|
s.version = ::My::Gem::WithLongName::VERSION
s.add_development_dependency 'rake', '~>10.4' # Change to latest available version!
s.add_development_dependency 'gem_polisher', '~>0.4' # Change to latest available version!
end
- Create the version file accordingly. Eg:
class My
class Gem
class WithLongName
VERSION = '0.0.0'
end
end
end
- Add this to your Rakefile:
require 'bundler'
Bundler.require
require 'gem_polisher'
GemPolisher.new
- Create your Gemfile and Gemfile.lock using Bundler.
At this point, you have at your disposal some Rake tasks:
$ rake -T
rake gem:release[type] # Update bundle, run tests, increment version, build and publish Gem; type can be major, minor or patch
rake test # Run all tests
That you can use to generate new releases. The gem:release[type] task will:
- Make sure you are at master, with everything commited.
- Update your bundle (Gemfile.lock).
- Execute Rake task test.
- Tip: You can define your own test tasks tied to this. Eg:
desc "Run RSpec"
task :rspec do
sh 'bundle exec rspec'
end
task test: [:rspec]
- Build your .gem.
- Publish it to https://rubygems.org/.
Documentation
Documentation is provided via RDoc. The easiest way to read it:
gem install --rdoc gem_polisher
gem install bdoc
bdoc
You can read it with ri also, of course.