gem_polisher

Gem Version GitHub issues GitHub license Downloads

Description

This Gem provides Rake tasks to assist Ruby Gem development workflow.

Utilization

  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]

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.