lib/gem/release/cmds/bump.rb in gem-release-2.0.0.dev.1 vs lib/gem/release/cmds/bump.rb in gem-release-2.0.0.dev.2
- old
+ new
@@ -51,11 +51,11 @@
release: 'Shortcut for the `gem release` command'
}
DEFAULTS = {
commit: true,
- push: true,
+ push: false,
remote: 'origin'
}
opt '-c', '--[no-]commit', DESCR[:commit] do |value|
opts[:commit] = value
@@ -84,17 +84,18 @@
opt '--recurse', DESCR[:recurse] do |value|
opts[:recurse] = value
end
MSGS = {
- not_found: 'Ignoring %s. Version file %s not found.',
- no_remote: 'Cannot push to missing git remote %s.',
- bump: 'Bumping %s from version %s to %s',
- version: 'Changing version in %s from %s to %s',
- git_add: 'Staging %s',
- git_commit: 'Creating commit',
- git_push: 'Pushing to the %s git repository'
+ bump: 'Bumping %s from version %s to %s',
+ version: 'Changing version in %s from %s to %s',
+ git_add: 'Staging %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.'
}
CMDS = {
git_add: 'git add %s',
git_commit: 'git commit -m "Bump to %s"',
@@ -114,11 +115,12 @@
end
private
def validate
- abort :not_found, gem.name, version.path unless version.exists?
- abort :no_remote, remote if push? && !git_remotes.include?(remote)
+ abort :git_dirty unless git_clean?
+ abort :not_found, gem.name, version.path || '?' unless version.exists?
+ abort :no_git_remote, remote if push? && !git_remotes.include?(remote.to_s)
end
def bump
announce :bump, gem.name, version.from, version.to
return true if pretend?