lib/macros4cuke/application.rb in macros4cuke-0.5.03 vs lib/macros4cuke/application.rb in macros4cuke-0.5.06
- old
+ new
@@ -17,14 +17,14 @@
end
# Entry point for the application object.
def run!(theCmdLineArgs)
@options = options_from(theCmdLineArgs)
- if options[:setup]
- options[:setup].each do |a_path|
- setup_project(a_path)
- end
+ return unless options[:setup]
+
+ options[:setup].each do |a_path|
+ setup_project(a_path)
end
end
protected
@@ -44,11 +44,12 @@
destination = prefix + aPath.to_s + '/' + file_name + '.rb'
begin
fail SupportFileExists.new(destination) if File.exist?(destination)
- template_pathname = Macros4Cuke::RootDir + 'templates/use_macros4cuke.erb'
+ template_pathname =
+ Macros4Cuke::RootDir + 'templates/use_macros4cuke.erb'
template = File.read(template_pathname)
# Create a context for variables used in our templates
prog_version = Macros4Cuke::Version
@@ -60,9 +61,10 @@
file_text = engine.result(binding)
# Write file contents to file in binary mode in order to avoid eol
# consisting of CRLF
File.open(destination, 'wb') { |theFile| theFile.write(file_text) }
+
rescue Macros4Cuke::CmdLineError => exc
$stderr.puts exc.message
exit
end
end