Class: Gem::Release::Cmds::Bump

Inherits:
Base
  • Object
show all
Defined in:
lib/gem/release/cmds/bump.rb

Constant Summary collapse

DESCR =
{
  version: 'Target version: next [major|minor|patch|pre|release] or a given version number [x.x.x]',
  branch:  'Check out a new branch for the target version (e.g. `v1.0.0`)',
  commit:  'Create a commit after incrementing gem version',
  message: 'Commit message template',
  skip_ci: 'Add the [skip ci] tag to the commit message',
  push:    'Push the new commit to the git remote repository',
  remote:  'Git remote to push to (defaults to origin)',
  sign:    'GPG sign the commit message',
  tag:     'Shortcut for running the `gem tag` command',
  recurse: 'Recurse into directories that contain gemspec files',
  release: 'Shortcut for the `gem release` command',
  file:    'Full path to the version file'
}.freeze
DEFAULTS =
{
  commit:  true,
  message: 'Bump %{name} to %{version} %{skip_ci}',
  push:    false,
  branch:  false,
  remote:  'origin',
  skip_ci: false,
  sign:    false,
  recurse: false,
  pretend: false
}.freeze
MSGS =
{
  bump:          'Bumping %s from version %s to %s',
  version:       'Changing version in %s from %s to %s',
  git_add:       'Staging %s',
  git_checkout:  'Checking out branch %s',
  git_commit:    'Creating commit',
  git_push:      'Pushing to the %s git repository',
  git_dirty:     'Uncommitted changes found. Please commit or stash.',
  not_found:     'Ignoring %s. Version file %s not found.',
  no_git_remote: 'Cannot push to missing git remote %s.'
}.freeze
CMDS =
{
  git_checkout: 'git checkout -b %s',
  git_add:      'git add %s',
  git_commit:   'git commit -m %p %s',
  git_push:     'git push %s'
}.freeze

Constants inherited from Base

Gem::Release::Cmds::Base::WIDTH

Constants included from Helper::Hash

Helper::Hash::MERGER

Instance Attribute Summary

Attributes inherited from Base

#args, #context, #gem, #opts

Instance Method Summary collapse

Methods inherited from Base

arg, args, #config, default, #defaults, descr, description, #in_dirs, #in_gem_dirs, inherited, #initialize, opt, opts, #pretend?, #quiet?, summary, usage

Methods included from Helper::String

#camelize, #underscore, #wrap

Methods included from Helper

#abort, #cmd, #gem_cmd

Methods included from Helper::Hash

#deep_merge, #except, #only, #symbolize_keys

Methods included from Registry

included

Constructor Details

This class inherits a constructor from Gem::Release::Cmds::Base

Instance Method Details

#runObject


138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/gem/release/cmds/bump.rb', line 138

def run
  new_version = nil
  in_gem_dirs do
    validate
    checkout if opts[:branch]
    bump
    new_version = version.to
    commit if opts[:commit]
    push   if opts[:commit] && opts[:push]
    reset
  end
  tag(new_version)     if opts[:tag]
  release(new_version) if opts[:release]
end