Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions bin/bump_version
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class VersionBumper < Thor::Group
class_exclusive do
class_option :patch, type: :boolean, lazy_default: false, desc: 'Bump patch version instead of minor version'
class_option :major, type: :boolean, lazy_default: false, desc: 'Bump major version instead of minor version'
class_option :version, type: :string, desc: 'Bump to a specific version (overrides patch and major options)'
end

source_root File.expand_path('../', __FILE__)
Expand Down Expand Up @@ -43,18 +44,19 @@ class VersionBumper < Thor::Group

def new_version_string
@new_version_string ||= begin
nv = current_version.bump
nv = nv.bump if options[:major]
nv = current_version
nv = nv.bump unless options.version?
nv = nv.bump if options.major?
nv.segments.fill(0, nv.segments.size, 3 - nv.segments.size).join('.')
end
end

def current_version
Gem::Version.new(
if options[:patch]
if options.patch?
RolemodelRails::VERSION + '.0'
else
RolemodelRails::VERSION
options[:version] || RolemodelRails::VERSION
end
)
end
Expand All @@ -64,6 +66,11 @@ class VersionBumper < Thor::Group
run "#{Gem.bin_path("bundler", "bundle")} install --quiet"
end
end

class << self
def banner = 'bin/bump_version [--patch|--major|--version VERSION]'
def desc = 'Update Gem Version & Sync Example Apps'
end
end

VersionBumper.start(ARGV)