Sha256: 088b5ddced49d0d1ee9f322bddd60731fe737d2bb1cb9422c56ec5397f3e65a6
Contents?: true
Size: 847 Bytes
Versions: 8
Compression:
Stored size: 847 Bytes
Contents
module Runbook::CLIBase def self.included(base) base.extend(ClassMethods) base.check_unknown_options! base.class_option( :config, aliases: "-c", type: :string, group: :base, desc: "Path to runbook config file" ) end def initialize(args = [], local_options = {}, config = {}) super(args, local_options, config) cmd_name = config[:current_command].name _set_cli_config(options[:config], cmd_name) if options[:config] end module ClassMethods def exit_on_failure? true end end protected def _set_cli_config(config, cmd) unless File.exist?(config) raise Thor::InvocationError, "#{cmd}: cannot access #{config}: No such file or directory" end Runbook::Configuration.cli_config_file = config Runbook::Configuration.reconfigure end end
Version data entries
8 entries across 8 versions & 2 rubygems