Class: Avm::Tools::Runner::LocalProject::VersionBump
- Inherits:
-
EacRubyUtils::Console::DocoptRunner
- Object
- EacRubyUtils::Console::DocoptRunner
- Avm::Tools::Runner::LocalProject::VersionBump
- Includes:
- EacCli::DefaultRunner
- Defined in:
- lib/avm/tools/runner/local_project/version_bump.rb
Instance Method Summary collapse
- #confirm? ⇒ Boolean
- #current_version_uncached ⇒ Object
- #run ⇒ Object
- #run_version_changed ⇒ Object
- #run_version_unchanged ⇒ Object
- #start_banner ⇒ Object
- #target_version_from_new(_current, option_value) ⇒ Object
- #target_version_from_segment(current, option_value) ⇒ Object
- #target_version_uncached ⇒ Object
- #version_changed? ⇒ Boolean
Instance Method Details
#confirm? ⇒ Boolean
49 50 51 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 49 def confirm? .fetch('--yes') || request_input('Confirm version bump?', bool: true) end |
#current_version_uncached ⇒ Object
53 54 55 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 53 def current_version_uncached context(:instance).if_respond('version') end |
#run ⇒ Object
24 25 26 27 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 24 def run version_changed? ? run_version_changed : run_version_unchanged end |
#run_version_changed ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 29 def run_version_changed infom 'Version changed' if confirm? context(:instance).run_job(:version_bump, target_version) success 'Bumped' else fatal_error 'Bump unconfirmed' end end |
#run_version_unchanged ⇒ Object
39 40 41 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 39 def run_version_unchanged success 'Version unchanged' end |
#start_banner ⇒ Object
43 44 45 46 47 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 43 def context(:instance_banner) infov 'Current version', current_version.if_present('-') infov 'Target version', target_version.if_present('-') end |
#target_version_from_new(_current, option_value) ⇒ Object
68 69 70 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 68 def target_version_from_new(_current, option_value) ::Avm::Version.new(option_value) end |
#target_version_from_segment(current, option_value) ⇒ Object
72 73 74 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 72 def target_version_from_segment(current, option_value) current.increment_segment(option_value.to_i) end |
#target_version_uncached ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 57 def target_version_uncached r = current_version %w[new segment major minor patch].each do |option| option_value = .fetch("--#{option}") next if option_value.blank? r = send("target_version_from_#{option}", r, option_value) end r end |
#version_changed? ⇒ Boolean
82 83 84 |
# File 'lib/avm/tools/runner/local_project/version_bump.rb', line 82 def version_changed? target_version != current_version end |