Class: Avm::Tools::Runner::Source::VersionBump
- Inherits:
-
Object
- Object
- Avm::Tools::Runner::Source::VersionBump
- Defined in:
- lib/avm/tools/runner/source/version_bump.rb
Instance Method Summary collapse
- #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
#current_version_uncached ⇒ Object
45 46 47 |
# File 'lib/avm/tools/runner/source/version_bump.rb', line 45 def current_version_uncached runner_context.call(:subject).if_respond('version') end |
#run ⇒ Object
20 21 22 23 |
# File 'lib/avm/tools/runner/source/version_bump.rb', line 20 def run version_changed? ? run_version_changed : run_version_unchanged end |
#run_version_changed ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/avm/tools/runner/source/version_bump.rb', line 25 def run_version_changed infom 'Version changed' if confirm? runner_context.call(:subject).version_bump(target_version) success 'Bumped' else fatal_error 'Bump unconfirmed' end end |
#run_version_unchanged ⇒ Object
35 36 37 |
# File 'lib/avm/tools/runner/source/version_bump.rb', line 35 def run_version_unchanged success 'Version unchanged' end |
#start_banner ⇒ Object
39 40 41 42 43 |
# File 'lib/avm/tools/runner/source/version_bump.rb', line 39 def infov 'Instance', runner_context.call(:subject) infov 'Current version', current_version.if_present('-') infov 'Target version', target_version.if_present('-') end |
#target_version_from_new(_current, option_value) ⇒ Object
60 61 62 |
# File 'lib/avm/tools/runner/source/version_bump.rb', line 60 def target_version_from_new(_current, option_value) ::Avm::VersionNumber.new(option_value) end |
#target_version_from_segment(current, option_value) ⇒ Object
64 65 66 |
# File 'lib/avm/tools/runner/source/version_bump.rb', line 64 def target_version_from_segment(current, option_value) current.increment_segment(option_value.to_i) end |
#target_version_uncached ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/avm/tools/runner/source/version_bump.rb', line 49 def target_version_uncached r = current_version %w[new segment major minor patch].each do |option| option_value = parsed[option] next if option_value.blank? r = send("target_version_from_#{option}", r, option_value) end r end |
#version_changed? ⇒ Boolean
74 75 76 |
# File 'lib/avm/tools/runner/source/version_bump.rb', line 74 def version_changed? target_version != current_version end |