Class: R10K::Action::Deploy::Display
- Includes:
- DeployHelpers
- Defined in:
- lib/r10k/action/deploy/display.rb
Constant Summary
Constants included from Logging
Logging::LOG_LEVELS, Logging::SYSLOG_LEVELS_MAP
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(opts, argv, settings = {}) ⇒ Display
constructor
A new instance of Display.
Methods included from DeployHelpers
#check_write_lock!, #expect_config!
Methods included from Logging
add_outputters, debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level
Constructor Details
#initialize(opts, argv, settings = {}) ⇒ Display
Note:
All arguments will be required in the next major version
Returns a new instance of Display.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/r10k/action/deploy/display.rb', line 22 def initialize(opts, argv, settings = {}) super @settings = @settings.merge({ overrides: { environments: { preload_environments: @fetch, requested_environments: @argv.map { |arg| arg.gsub(/\W/, '_') } }, modules: {}, output: { format: @format, trace: @trace, detail: @detail }, purging: {} } }) end |
Instance Method Details
#call ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/r10k/action/deploy/display.rb', line 42 def call expect_config! deployment = R10K::Deployment.new(@settings) if @settings.dig(:overrides, :environments, :preload_environments) deployment.preload! deployment.validate! end output = { :sources => deployment.sources.map { |source| source_info(source, @settings.dig(:overrides, :environments, :requested_environments)) } } case @settings.dig(:overrides, :output, :format) when 'json' then json_format(output) else yaml_format(output) end # exit 0 true rescue => e logger.error R10K::Errors::Formatting.format_exception(e, @settings.dig(:overrides, :output, :trace)) false end |