lib/foreplay/engine.rb in foreplay-0.9.9 vs lib/foreplay/engine.rb in foreplay-0.9.10

- old
+ new

@@ -1,8 +1,9 @@ require 'yaml' require 'string' require 'hash' +require 'pp' # debug class Foreplay::Engine include Foreplay attr_reader :mode, :environment, :filters @@ -49,13 +50,14 @@ def explanatory_text(hsh, key) hsh.key?(key) ? "#{hsh[key].dup.yellow} #{key}" : "all #{key}s" end def build_instructions(role, additional_instructions) - instructions = defaults.supermerge(additional_instructions) - instructions['role'] = role - required_keys = %w(name environment role servers path repository) + instructions = defaults.supermerge(additional_instructions) + instructions['role'] = role + instructions['verbose'] = verbose + required_keys = %w(name environment role servers path repository) required_keys.each do |key| next if instructions.key? key terminate("Required key #{key} not found in instructions for #{environment} environment.\nCheck #{config_file}") end @@ -85,18 +87,22 @@ 'port' => 50_000 } @defaults['env'].merge! secrets @defaults['application'] = secrets - +pp @defaults # debug @defaults = @defaults.supermerge(roles_all[DEFAULTS_KEY]) if roles_all.key? DEFAULTS_KEY @defaults = @defaults.supermerge(roles[DEFAULTS_KEY]) if roles.key? DEFAULTS_KEY @defaults end # Secret environment variables def secrets @secrets ||= Foreplay::Engine::Secrets.new(environment, roles_all['secrets']).fetch || {} + end + + def verbose + @verbose ||= filters.key?('verbose') end def roles @roles ||= roles_all[environment] end