• Stars
    star
    512
  • Rank 86,302 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 14 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Release your ruby gems with ease.

gem release

This gem plugin aims at making gem development easier by automating repetitive work based on conventions, configuration, and templates.

It adds the commands bootstrap, gemspec, bump, tag and a release to the rubygems gem command.

Project Gem Release
Gem name gem-release
License MIT
Version Gem Version
Continuous integration GitHub Build Status
Test coverage Coverage Status
Documentation Documentation
Credits Contributors

Table of contents

Demo

This gif demos some of the things you can do with this plugin:

gem-release-demo

Installation

The gem provides a rubygems plugin, so it's just:

gem install gem-release

Configuration

Defaults for all options can be specified in a config file at either one of these locations:

  • ~/.gem_release/config.yml
  • ~/.gem_release.yml
  • ./.gem_release/config.yml
  • ./.gem_release.yml

Config files must be in the YAML format, and list options per command. Common options can be set on the root.

For instance, the following entries will set the quiet flag for all commands, and a custom host name with gem release:

quiet: true

release:
  host: https://example.com

Defaults for all options also can be specified as environment variables, for example GEM_RELEASE_PRETEND=true.

Defaults specified in config files and environment variables can be overridden as command line options when issuing the respective gem command.

Only the first config file found in the locations given above will be used, if any, and defaults from this config file will be merged with both environment variables and given command line options.

Conventions

When bootstrapping a new gem:

  • A gem name gem_name is left untouched when mapped to the path lib/gem_name, and the Ruby constant name GemName.
  • A gem name gem-name is mapped to the path lib/gem/name, and the Ruby constant name Gem::Name

When bumping the version of an existing gem gem-name the following locations are checked:

  • lib/gem/name/version.rb
  • lib/gem-name/version.rb

Piping

Output depends on a tty being available or not. I.e. when run as an individual command colorized human readable output will be printed (see the Demo screencast above). When attached to a pipe then output is kept simple and parsable.

E.g.:

$ gem bump --pretend | cat
bump gem-release 1.0.0 1.0.1
git_add lib/gem/release/version.rb
git_commit "Bump gem-release to 1.0.1"

This is useful, for example, for grabbing the next version number:

$ gem bump --pretend --no-commit | awk '{ print $4 }'
1.0.1

Reference

The gem gem-release adds the following commands to the rubygems gem command:

  • gem bootstrap - Scaffolds a new gem from template files.
  • gem bump - Bumps one, several, or all gems in this directory.
  • gem gemspec - Generates a gemspec.
  • gem release - Releases one or all gems in this directory.
  • gem tag - Tags the HEAD commit with the gem's current version.

gem bootstrap

Scaffolds a new gem from template files.

Arguments

gem_name - name of the gem (optional, will default to the current directory name if not specified)

Options

    --[no-]scaffold              Scaffold gem files (default: true)
    --dir DIR                    Directory to place the gem in (defaults to the given name, or the current working dir)
    --bin                        Create an executable ./bin/[name], add executables directive to .gemspec
-t, --template NAME              Template groups to use for scaffolding
    --rspec                      Use the rspec group (by default adds .rspec and spec/spec_helper.rb)
    --travis                     Use the travis group (by default adds .travis.yml)
-l, --[no-]license NAME          License(s) to add (default: mit)
-s, --strategy NAME              Strategy for collecting files [glob|git] in .gemspec (default: glob)
    --[no-]git                   Initialize a git repo (default: true)
    --github                     Initialize a git repo, create on github
    --remote                     Git remote repository
    --push                       Push the git repo to github
    --[no-]color
    --pretend

Description

Scaffolds a new gem from template files. Optionally initialize a git repository, set a git remote, and push to the remote repository.

If no argument is given the current directory name is used as the gem name. If one or many arguments are given then these will be used as gem names, and new directories will be created accordingly.

By default the following files will be created:

  • .gitignore
  • Gemspec
  • [gem-name].gemspec
  • LICENSE.md
  • lib/[gem]/[name].rb
  • lib/[gem]/[name]/version.rb

Templates in the first existing one of these directories will always be used to create additional files:

  • ./.gem-release/default (local)
  • ~/.gem-release/default (global)

If --template [group] is given additional files will be created from the first existing one of these directories:

  • ./.gem-release/[group] (local)
  • ~/.gem-release/[group] (global)

It is possible to specify several template groups in order to add files from several custom template directories.

If --template rspec is given then additionally the files .rspec and spec/spec_helper.rb will be created, or whatever files exist in a local or global directory .gem-release/templates/rspec.

If --template travis is given then additionally the file .travis.yml will be created, or whatever files exist in a local or global directory .gem-release/templates/travis.

The license added by default is the MIT License. If --license [name] is given then this license will be added. The only other license file shipped is the Mozilla Public License v2.0. Other licenses must be present in the local or global directory .gem-release/licenses. If --no-license is given then no license will be added.

gem bump

Bumps one, several, or all gems in this directory.

Arguments

gem_name - name of the gem (optional, will use the directory name, or all gemspecs if --recurse is given)

Options

-v, --version VERSION            Target version: next [major|minor|patch|pre|release] or a given version number [x.x.x]
-c, --[no-]commit                Create a commit after incrementing gem version (default: true)
-m, --message MESSAGE            Commit message template (default: Bump %{name} to %{version} %{skip_ci})
    --skip-ci                    Add the [skip ci] tag to the commit message
-p, --push                       Push the new commit to the git remote repository
    --remote REMOTE              Git remote to push to (defaults to origin) (default: origin)
-s, --sign                       GPG sign the commit message
    --branch [BRANCH]            Check out a new branch for the target version (e.g. `v1.0.0`)
-t, --tag                        Shortcut for running the `gem tag` command
-r, --release                    Shortcut for the `gem release` command
    --recurse                    Recurse into directories that contain gemspec files
    --file FILE                  Full path to the version file
    --[no-]color
    --pretend

Description

Bumps the version number defined in lib/[gem_name]/version.rb to a given, specific version number, or to the next major, minor, patch, or pre-release level.

Optionally it pushes to the origin repository. Also, optionally it invokes the gem tag and/or gem release command.

If no argument is given the first gemspec's name is assumed as the gem name. If one or many arguments are given then these will be used as gem names. If --recurse is given then all gem names from all gemspecs in this directory or any of its subdirectories will be used.

The version can be bumped to either one of these targets:

major
1.1.1       # Bump to the given, specific version number
major       # Bump to the next major level (e.g. 0.0.1 to 1.0.0)
minor       # Bump to the next minor level (e.g. 0.0.1 to 0.1.0)
patch       # Bump to the next patch level (e.g. 0.0.1 to 0.0.2)
pre|rc|etc  # Bump to the next pre-release level (e.g. 0.0.1 to
#   0.1.0.pre.1, 1.0.0.pre.1 to 1.0.0.pre.2)

When searching for the version file for a gem named gem-name: the following paths will be searched relative to the gemspec's directory.

  • lib/gem-name/version.rb
  • lib/gem/name/version.rb

gem gemspec

Generates a gemspec.

Arguments

gem_name - name of the gem (optional, will default to the current directory name if not specified)

Options

    --[no]-bin                   Add bin files directive to the gemspec (defaults to true if a ./bin directory exists)
    --dir DIR                    Directory to place the gem in (defaults to the given name, or the current working dir)
-l, --[no-]license NAMES         License(s) to list in the gemspec
-s, --strategy                   Strategy for collecting files [glob|git] in gemspec (default: glob)
    --[no-]color
    --pretend

Description

Generates a gemspec.

If no argument is given the current directory name is used as the gem name. If one or many arguments are given then these will be used as gem names, and new directories will be created accordingly.

The generated gemspec file will use the glob strategy for finding files by default. Known strategies are:

  • glob - uses the glob pattern {bin/*,lib/**/*,[A-Z]*}
  • git - uses the git command git ls-files app lib

gem release

Releases one or all gems in this directory.

Arguments

gem_name - name of the gem (optional, will use the first gemspec, or all gemspecs if --recurse is given)

Options

    --host HOST                  Push to a compatible host other than rubygems.org
-k, --key KEY                    Use the API key from ~/.gem/credentials
-t, --tag                        Shortcut for running the `gem tag` command
-p, --push                       Push tag to the remote git repository
    --recurse                    Recurse into directories that contain gemspec files
-g, --github                     Create a GitHub release
-d, --description DESCRIPTION    Description of the release
    --repo REPO                  Full name of the repository on GitHub, e.g. svenfuchs/gem-release (defaults to the repo name from the gemspec's homepage if this is a GitHub URL)
    --token TOKEN                GitHub OAuth token
    --[no-]color
    --pretend

Description

Builds one or many gems from the given gemspec(s), pushes them to rubygems.org (or another, compatible host), and removes the left over gem file.

Optionally invoke gem tag.

If no argument is given the first gemspec's name is assumed as the gem name. If one or many arguments are given then these will be used. If --recurse is given then all gem names from all gemspecs in this directory or any of its subdirectories will be used.

gem tag

Tags the HEAD commit with the gem's current version.

Options

-p, --[no-]push                  Push tag to the remote git repository
    --remote REMOTE              Git remote to push to (default: origin)
-s, --sign                       GPG sign the tag
    --[no-]color
    --pretend

Description

Creates an annotated tag for the current HEAD commit, using the gem's current version.

Optionally pushes the tag to the origin repository.

If one or many arguments are given then gemspecs with the same names will be searched, and the working directory changed to their respective directories. If --recurse is given then the directories all gem names from all gemspecs in this directory or any of its subdirectories will be used. This assumes that these directories are separate git repositories.

The tag name will be v[version]. For example, if the current version is 1.0.0, then The tag is created using the command git tag -am "tag v1.0.0" v1.0.0.

Scenarios

Scenario 1: Single gem in root

Setup

cd /tmp
rm -rf foo
gem bootstrap foo
cd foo
tree -a -I .git

Directory structure

.
├── Gemfile
├── LICENSE.md
├── foo.gemspec
└── lib
    ├── foo
    │   └── version.rb
    └── foo.rb

Behaviour

# this bumps foo
cd /tmp/foo; gem bump

# this also bumps foo
cd /tmp/foo; gem bump foo

Demo

gem-release-scenario-1

Scenario 2: Multiple gems in root

Setup

cd /tmp
rm -rf foo bar
gem bootstrap foo
cd foo
gem bootstrap bar --dir .
tree -a -I .git

Directory structure

.
├── Gemfile
├── LICENSE.md
├── bar.gemspec
├── foo.gemspec
└── lib
    ├── bar
    │   └── version.rb
    ├── bar.rb
    ├── foo
    │   └── version.rb
    └── foo.rb

Behaviour

# this bumps both foo and bar
cd /tmp/foo; gem bump --recurse

# this also bumps both foo and bar
cd /tmp/foo; gem bump foo bar

# this bumps foo (because it's the first gemspec found)
cd /tmp/foo; gem bump

# this bumps foo
cd /tmp/foo; gem bump foo

# this bumps bar
cd /tmp/foo; gem bump bar

Demo

gem-release-scenario-2

Scenario 3: Multiple gems in sub directories

Setup

cd /tmp
rm -rf root
mkdir root
cd root
gem bootstrap foo
gem bootstrap bar
tree -a -I .git

Directory structure

.
├── bar
│   ├── Gemfile
│   ├── LICENSE.md
│   ├── bar.gemspec
│   └── lib
│       ├── bar
│       │   └── version.rb
│       └── bar.rb
└── foo
    ├── Gemfile
    ├── LICENSE.md
    ├── foo.gemspec
    └── lib
        ├── foo
        │   └── version.rb
        └── foo.rb

Behaviour

# this bumps both foo and bar
cd /tmp/root; gem bump --recurse

# this also bumps both foo and bar
cd /tmp/root; gem bump foo bar

# this does bumps both foo and bar
cd /tmp/root; gem bump

# this bumps foo
cd /tmp/root; gem bump foo

# this bumps bar
cd /tmp/root; gem bump bar

Demo

gem-release-scenario-3

Scenario 4: Nested gem with a conventional sub directory name

Setup

cd /tmp
rm -rf sinja
gem bootstrap sinja
cd sinja
mkdir extensions
cd extensions
gem bootstrap sinja-sequel
cd /tmp/sinja
tree -a -I .git

Directory structure

.
├── Gemfile
├── LICENSE.md
├── extensions
│   └── sinja-sequel
│       ├── Gemfile
│       ├── LICENSE.md
│       ├── lib
│       │   └── sinja
│       │       ├── sequel
│       │       │   └── version.rb
│       │       └── sequel.rb
│       └── sinja-sequel.gemspec
├── lib
│   ├── sinja
│   │   └── version.rb
│   └── sinja.rb
└── sinja.gemspec

Behaviour

# this bumps both sinja and sinja-sequel
cd /tmp/sinja; gem bump --recurse

# this bumps sinja
cd /tmp/sinja; gem bump

# this also bumps sinja
cd /tmp/sinja; gem bump sinja

# this bumps sinja-sequel
cd /tmp/sinja; gem bump sinja-sequel

# this also bumps sinja-sequel
cd /tmp/sinja/extensions/sinja-sequel; gem bump

# this also bumps sinja-sequel
cd /tmp/sinja/extensions/sinja-sequel; gem bump sinja-sequel

Demo

gem-release-scenario-4

Scenario 5: Nested gem with an irregular sub directory name

Setup

cd /tmp
rm -rf sinja
gem bootstrap sinja
cd sinja
mkdir -p extensions
cd extensions
gem bootstrap sinja-sequel
mv sinja-sequel sequel
cd /tmp/sinja
tree -a -I .git

Directory structure

.
├── Gemfile
├── LICENSE.md
├── extensions
│   └── sequel
│       ├── Gemfile
│       ├── LICENSE.md
│       ├── lib
│       │   └── sinja
│       │       ├── sequel
│       │       │   └── version.rb
│       │       └── sequel.rb
│       └── sinja-sequel.gemspec
├── lib
│   ├── sinja
│   │   └── version.rb
│   └── sinja.rb
└── sinja.gemspec

Behaviour

# this bumps both sinja and sinja-sequel
cd /tmp/sinja; gem bump --recurse

# this bumps sinja
cd /tmp/sinja; gem bump

# this also bumps sinja
cd /tmp/sinja; gem bump sinja

# this bumps sinja-sequel only
cd /tmp/sinja; gem bump sinja-sequel

# this also bumps sinja-sequel only
cd /tmp/sinja/extensions/sequel; gem bump

# this also bumps sinja-sequel only
cd /tmp/sinja/extensions/sequel; gem bump sinja-sequel

Demo

gem-release-scenario-5

Development

Running tests:

bundle install
bundle exec rspec

Testing commands against a Geminabox instance:

# start geminabox
bundle install
bundle exec rackup

# workaround rubygems issue with a missing key
# see https://github.com/geminabox/geminabox/issues/153
echo ':localhost: none' >> ~/.gem/credentials

# test release
bundle exec gem release --host=http://localhost:9292 --key localhost

More Repositories

1

rails-i18n

Repository for collecting Locale data for Ruby on Rails I18n as well as other interesting, Rails related I18n stuff
Ruby
3,979
star
2

adva_cms

cutting edge cms, blog, wiki, forum ...
JavaScript
489
star
3

routing-filter

routing-filter wraps around the complex beast that the Rails routing system is, allowing for unseen flexibility and power in Rails URL recognition and generation.
Ruby
463
star
4

i18n-active_record

I18n ActiveRecord backend
Ruby
281
star
5

adva-cms2

Cutting edge Rails 3 CMS framework
Ruby
115
star
6

hashr

Simple Hash extension to make working with nested hashes (e.g. for configuration) easier and less error-prone.
Ruby
109
star
7

simple_states

A super-slim statemachine-like support library
Ruby
95
star
8

steam

Headless integration testing w/ HtmlUnit: enables testing JavaScript-driven web sites
JavaScript
51
star
9

ripper2ruby

Similar to ruby2ruby this library allows to parse Ruby code, modify and recompile it back to Ruby.
Ruby
41
star
10

simple_opts.sh

Simple Bash option parser
Shell
31
star
11

i18n-missing_translations

Find missing translations in your code more easily.
Ruby
31
star
12

scriptaculous-sortabletree

Implements a sortable tree for scriptacolous
JavaScript
29
star
13

minimal

Minimal templating engine inspired by Markaby & Erector but much smaller and targeting Rails 3
Ruby
26
star
14

rdom

experimental browser implementation in ruby using nokogiri and johnson
Ruby
25
star
15

simple_nested_set

Ruby
22
star
16

space

multi-repository monitoring and shell helper tool to ease development across multiple dependent repositories
Ruby
17
star
17

activesupport-slices

Lazy loaded vertical code slices based on ActiveSupport Dependencies
Ruby
14
star
18

capture_stdout

Adds Kernel.capture_stdout(&block). Useful e.g. for testing command line tools
Ruby
14
star
19

data_migrations

Ruby
14
star
20

vim-tree

vim filesystem tree plugin in ruby
Ruby
13
star
21

rack-cache-purge

Support for purging rack-cache
Ruby
13
star
22

cl

Object-oriented OptionParser based CLI support for rapid CLI development
Ruby
12
star
23

i18n-tools

Tools for working with ruby/rails i18n
Ruby
10
star
24

vim-todo

Provides a simple todo list similar to Textmate’s todo.bundle
Ruby
10
star
25

reference_tracking

Ruby
10
star
26

locator

Generic html element locators for testing tools
Ruby
9
star
27

taskmate

Simplistic TextMate bundle for getting more done with your favorite missing text editor.
Ruby
9
star
28

scrumtious

toying with a remote scrum tool pulling from lighthouse for
Ruby
7
star
29

mephisto_paged_article_list

Mephisto doesn't page article lists out of the box. This plugin adds that.
Ruby
6
star
30

stubby

lightweight and fast stubbing framework
Ruby
6
star
31

with

highly experimental, lightweight and flexible contexts for test/unit
Ruby
6
star
32

resque-heartbeat

Ruby
6
star
33

activemodel-error

I18n support for validation error messages in ActiveModel
Ruby
6
star
34

vim-layout

Ruby
5
star
35

simple_slugs

Ruby
5
star
36

micro_migrations

Minimal ActiveRecord standalone migrations
Ruby
5
star
37

inherited_resources_helpers

Ruby
5
star
38

google_analytics

This plugin is primarily targeted at being used with Mephisto but should be useful with other Rails based CMS or blogging plattforms, too.
Ruby
5
star
39

test_server

Playing around with a test server for Rails that keeps the environment loaded (just like spec_server)
Ruby
5
star
40

will_paginate_liquidized

This plugin allows you to use will_paginate with Liquid templates. That's it.
Ruby
4
star
41

ruby-i18n.tmbundle

Ruby
4
star
42

middleman-toc

Ruby
4
star
43

rjb-require

Adds the ability to import and map Java packages to nested Ruby modules/classes to RJB.
Ruby
4
star
44

globalize-rails.org

Ruby
3
star
45

resque-tagged_queues

Ruby
3
star
46

sh_vars

Shell variable parser
Ruby
3
star
47

em-stdout

Ruby
3
star
48

rack-cache-tags

Support for tagging rack-cache entries
Ruby
3
star
49

rbac

Ruby
3
star
50

with-sugar

Test macros for being used with With
Ruby
3
star
51

treetop_css

Treetop CSS grammar/parser
Ruby
3
star
52

i18n-message

Object-oriented abstraction for looking up translations from I18n.translate
Ruby
3
star
53

adva-cms.org

Ruby
3
star
54

mephisto_tag_cloud

Most complete, sophisticated, standard-conform and allover-awesome implementation of a tag cloud plugin for Mephisto :)
Ruby
3
star
55

mephisto_full_archives

simple plugin that adds a full archives view to Mephisto's own archives
Ruby
2
star
56

bash_opts

SImple Bash options parser
Shell
2
star
57

test_declarative

Simply adds a declarative test method syntax to test/unit
Ruby
2
star
58

simple_taggable

Ruby
2
star
59

dotfiles

Vim Script
2
star
60

mephisto_inverse_captcha

Mephisto anti-comment-spam plugin that adds an "outer floodgate" to the existing (Akismet) spam-protection
Ruby
2
star
61

trsh

Experimental Travis CI Shell using API v3 in Go
Go
2
star
62

uki_reader

Experimental Google Reader UI based on Uki
JavaScript
2
star
63

travis

2
star
64

travis-lxc

Ruby
2
star
65

vim-deliminator

Balancing brackets and quotes
Ruby
1
star
66

database_recorder

Ruby
1
star
67

identity

Ruby
1
star
68

gmail_filters

Ruby
1
star
69

ruby-i18n.org

ruby-i18n.org - static html export, see the source branch for sources
Ruby
1
star
70

command

Ruby
1
star
71

registry

Ruby Class Registry
Ruby
1
star
72

travis-worker

Ruby
1
star
73

pathname_local

Ruby
1
star
74

dom-test

Ruby export of Level 1 and 2 W3C DOM tests
Ruby
1
star
75

led-go

A line editor in Go. Inspired by linenoise, but written with extensibility and separation of concerns in mind.
Go
1
star
76

svenfuchs.github.com

jo
HTML
1
star
77

rails-i18n-chart

Ruby
1
star
78

box

C++
1
star
79

statics

Ruby
1
star
80

silence_log_tailer

Silence rails/server log tailing to console
Ruby
1
star