class Madness::Commands::Config
Public Instance Methods
new_command()
click to toggle source
# File lib/madness/commands/config.rb, line 13 def new_command raise InitError, "Configuration file #{config.filename} already exists" if File.exist? config.filename FileUtils.cp File.expand_path('../templates/madness.yml', __dir__), config.filename say "Created g`#{config.filename}` config file" end
show_command()
click to toggle source
# File lib/madness/commands/config.rb, line 20 def show_command errors_found = false config.data.each do |key, value| value_color = config.defaults[key] == value ? 'n' : 'bb' if config.defaults.has_key?(key) key_color = 'g' else key_color = 'r' value_color = 'r' errors_found = true end say "#{key_color}`#{key.to_s.rjust 20}`: #{value_color}`#{value || '~'}`" end say '' if config.file_exist? say "Values in bb`blue` loaded from g`#{config.filename}`" end return unless errors_found say 'Keys in r`red` are not recognized' end