lib/percheron/commands/abstract.rb in percheron-0.7.11 vs lib/percheron/commands/abstract.rb in percheron-0.7.12

- old
+ new

@@ -1,11 +1,11 @@ module Percheron module Commands class Abstract < Clamp::Command - option([ '-c', '--config_file' ], 'CONFIG', 'Config file', - default: Config::DEFAULT_CONFIG_FILE) + option([ '-c', '--config_file' ], 'CONFIG', 'Config file', default: + ENV.fetch('PERCHERON_CONFIG', Config::DEFAULT_CONFIG_FILE)) option('--version', :flag, 'show version') do puts Percheron::VERSION exit(0) end @@ -20,14 +20,10 @@ def self.default_create_parameters! default_parameters! option('--start', :flag, 'Start unit', default: false) end - def default_config_file - ENV.fetch('PERCHERON_CONFIG', Config::DEFAULT_CONFIG_FILE) - end - def execute stack.valid? rescue => e puts "%s\n\n%s\n\n" % [ e.inspect, e.backtrace.join("\n") ] signal_usage_error(e.message) @@ -38,10 +34,10 @@ Percheron::Stack.new(config, stack_name) end def config @config ||= begin - Percheron::Config.new(config_file).tap do |c| + Percheron::Config.load!(config_file).tap do |c| Percheron::Connection.load!(c) end end rescue Errors::ConfigFileInvalid => e $logger.error e.inspect