Class: Kontena::Callbacks::DefaultMasterVersion

Inherits:
Kontena::Callback show all
Defined in:
lib/kontena/callbacks/master/deploy/04_default_master_version.rb

Instance Attribute Summary

Attributes inherited from Kontena::Callback

#command

Instance Method Summary collapse

Methods inherited from Kontena::Callback

callbacks, #initialize, matches_commands, run_callbacks

Constructor Details

This class inherits a constructor from Kontena::Callback

Instance Method Details

#after_loadObject



7
8
9
10
11
12
13
14
# File 'lib/kontena/callbacks/master/deploy/04_default_master_version.rb', line 7

def after_load
  # Only run this for prerelease cli
  return unless Kontena::Cli::VERSION =~ /\d\.(?:pre|rc|beta|edge)/
  version_switch = command.recognised_options.find {|opt| opt.switches.include?('--version')}
  if version_switch
    version_switch.instance_variable_set(:@default_value, 'edge')
  end
end