diff options
author | Richard Schneeman <richard.schneeman@gmail.com> | 2014-05-24 14:19:17 +0200 |
---|---|---|
committer | Richard Schneeman <richard.schneeman@gmail.com> | 2014-05-24 14:19:17 +0200 |
commit | 7466d6a9f989a1a8f90899b79b34f1152e440b7c (patch) | |
tree | 9db42ae082de13b828eef5604325b2ad03e8b745 | |
parent | b850c4c540e8f0c15742f67c532f521a4a123655 (diff) | |
parent | 3915c459801ee2ce03b5ab38f2512f9317aa1d82 (diff) | |
download | rails-7466d6a9f989a1a8f90899b79b34f1152e440b7c.tar.gz rails-7466d6a9f989a1a8f90899b79b34f1152e440b7c.tar.bz2 rails-7466d6a9f989a1a8f90899b79b34f1152e440b7c.zip |
Merge pull request #15293 from schneems/schneems/generator-output-in-error
print generators on failed generate
-rw-r--r-- | railties/lib/rails/generators.rb | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index dce734b54e..0ad3dbaeaa 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -156,7 +156,8 @@ module Rails args << "--help" if args.empty? && klass.arguments.any? { |a| a.required? } klass.start(args, config) else - puts "Could not find generator #{namespace}." + puts "Could not find generator #{namespace.inspect}." + print_generators end end @@ -199,17 +200,6 @@ module Rails # Show help message with available generators. def self.help(command = 'generate') - lookup! - - namespaces = subclasses.map{ |k| k.namespace } - namespaces.sort! - - groups = Hash.new { |h,k| h[k] = [] } - namespaces.each do |namespace| - base = namespace.split(':').first - groups[base] << namespace - end - puts "Usage: rails #{command} GENERATOR [args] [options]" puts puts "General options:" @@ -222,6 +212,20 @@ module Rails puts "Please choose a generator below." puts + print_generators + end + + def self.print_generators + lookup! + + namespaces = subclasses.map{ |k| k.namespace } + namespaces.sort! + + groups = Hash.new { |h,k| h[k] = [] } + namespaces.each do |namespace| + base = namespace.split(':').first + groups[base] << namespace + end # Print Rails defaults first. rails = groups.delete("rails") rails.map! { |n| n.sub(/^rails:/, '') } |