bin/rconf in rconf-0.5.1 vs bin/rconf in rconf-0.5.3

- old
+ new

@@ -18,11 +18,11 @@ include ProgressReporter def self.run opts = Trollop::options do - version 'rconf 0.1 (c) 2011 RightScale' + version "rconf #{VERSION} (c) 2011 RightScale" banner <<-EOS #{DESCRIPTION} Usage: rconf [options] @@ -31,10 +31,11 @@ EOS opt :configurators, 'Show available configurators' opt :config, 'Set path to configuration file', :type => :string opt :output, 'Output file (output to STDOUT by default)', :type => :string + opt :verbose, 'Print debug output' end if opts[:config].nil? opts[:config] = Dir['./*.rc'] if opts[:config].empty? Trollop::die :config, "not used and could not find a '.rc' file in the working directory" @@ -81,19 +82,20 @@ end exit 0 end ProgressReporter.report_to_stdout ProgressReporter.report_to_file(options[:output]) if options[:output] + Command.set_verbose if options[:verbose] begin lang = Language.load(options[:config]) report_fatal("Validation of configuration file failed:\n -#{lang.validation_errors.join("\n -").map(&:red)}") unless lang.validation_errors.empty? Dir.chdir(File.dirname(options[:config])) { lang.configurators.each(&:run) } report("Successfully configured #{File.basename(options[:config], '.rc').blue} for #{Platform.family.to_s.blue}") rescue Exception => e raise if e.is_a?(SystemExit) report_fatal("Execution failed with exception '#{e.message.red}'\n#{e.backtrace.join("\n").map(&:grey)}") ensure - lang.configurators.each { |c| report("!!NOTE: #{c.post_note}") if c.post_note } + lang.configurators.each { |c| report("\n!!NOTE: #{c.post_note}\n".green) if c.post_note } end end end end