Generator is anything what provides #generate method.

This commit is contained in:
Jakub Stastny aka botanicus 2011-03-03 16:13:55 +00:00
parent 7cca9306a8
commit dc07c46577

12
bin/ace
View file

@ -52,14 +52,14 @@ end
puts
rules.generators.each do |generator_klass|
puts "~ Running #{generator_klass}"
generator = generator_klass.new
# Generator is anything what provides #generate method.
rules.generators.each do |generator|
puts "~ Running generator #{generator}"
begin
if generator.respond_to?(:run)
generator.run
if generator.respond_to?(:generate)
generator.generate
else
abort "Generator #{generator.inspect} doesn't respond to the #run method!"
abort "Generator #{generator.inspect} doesn't respond to the #generate method!"
end
rescue Exception => exception
puts "Error in generator #{generator.inspect}: #{exception.message}"