Class: MSPRelease::CLI::Bump
Constant Summary
Constants included
from Helpers
Helpers::PROJECT_FILE
Instance Attribute Summary
#git, #project
Instance Method Summary
collapse
#initialize
Methods included from Helpers
#author, #changelog, #data, #data=, #data_exists?, #fail_if_modified_wc, #fail_if_push_pending, #git_version, #load_data, #msp_version, #on_release_branch?, #remove_data, #save_data, #time, #time_rfc, #timestamp
#exec
Instance Method Details
#check_bump_allowed!(segment) ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/msp_release/cli/bump.rb', line 34
def check_bump_allowed!(segment)
force = options[:force]
not_on_master = !git.on_master?
if not_on_master && segment != 'bugfix' && ! force
raise CLI::Exit, "You must be on master to bump the #{segment} version" +
", or pass --force if you are sure this is what you want to do"
end
end
|
#revert_bump(changed_files) ⇒ Object
44
45
46
|
# File 'lib/msp_release/cli/bump.rb', line 44
def revert_bump(changed_files)
exec "git checkout -- #{project.config_file} #{changed_files.join(' ')}"
end
|
#run ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/msp_release/cli/bump.rb', line 18
def run
segment = arguments[:segment]
check_bump_allowed!(segment)
new_version, *changed_files = project.bump_version(segment)
files = [project.config_file, *changed_files].compact
files.each do |file|
exec "git add #{file}"
end
exec "git commit -m 'BUMPED VERSION TO #{new_version}'"
puts "New version: #{new_version}"
end
|