bin/rconf in rconf-0.6.11 vs bin/rconf in rconf-0.6.13
- old
+ new
@@ -37,13 +37,13 @@
opt :output, 'Output file (output to STDOUT by default)', :type => :string
opt :force, 'Run rconf even if configuration file has not changed'
opt :verbose, 'Print debug output'
end
if opts[:config].nil? && !opts[:configurators]
- opts[:config] = Dir['./*.rc']
+ opts[:config] = Dir["./*#{CONFIG_EXTENSION}"]
if opts[:config].empty?
- Trollop::die :config, "not used and could not find a '.rc' file in the working directory"
+ Trollop::die :config, "not used and could not find a '#{CONFIG_EXTENSION}' file in the working directory"
else
opts[:config] = opts[:config].first
end
end
if opts[:output]
@@ -91,17 +91,24 @@
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?
+ aborted = false
Dir.chdir(File.dirname(options[:config])) do
lang.configurators.each do |c|
c.run
- break if c.aborting
+ break if aborted = c.aborting
c.post_process
end
end
- report("Successfully configured #{File.basename(options[:config], '.rc').blue} for #{Platform.family.to_s.blue}")
+ project = File.basename(options[:config], CONFIG_EXTENSION).blue
+ platform = Platform.family.to_s.blue
+ if aborted
+ report("Configuration of #{project} stopped, please follow instructions above to proceed")
+ else
+ report("Successfully configured #{project} for #{platform}")
+ end
rescue Exception => e
raise if e.is_a?(SystemExit)
report_fatal("Execution failed with exception '#{e.message.red}'\n#{e.backtrace.join("\n").grey}")
ensure
lang.configurators.each { |c| report("\n!!NOTE: #{c.post_note}\n".green) if c.post_note }