diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-21 14:11:24 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-21 14:11:24 +0100 |
commit | 04063393f9392b83cf5ccd0a16f217cc7261e15c (patch) | |
tree | 7486a826ec2bddd02342b6faa1bd44fe0f129606 /railties/lib | |
parent | da142cd86584d56299470ee4dd6f90be7127b477 (diff) | |
download | rails-04063393f9392b83cf5ccd0a16f217cc7261e15c.tar.gz rails-04063393f9392b83cf5ccd0a16f217cc7261e15c.tar.bz2 rails-04063393f9392b83cf5ccd0a16f217cc7261e15c.zip |
Give higher priority to rails generators.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index efeeecb685..83b8c74966 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -134,9 +134,14 @@ module Rails lookups = [] lookups << "#{base}:#{name}" if base lookups << "#{name}:#{context}" if context - lookups << "#{name}:#{name}" unless name.to_s.include?(?:) - lookups << "#{name}" - lookups << "rails:#{name}" unless base || context || name.to_s.include?(?:) + + unless base || context + unless name.to_s.include?(?:) + lookups << "#{name}:#{name}" + lookups << "rails:#{name}" + end + lookups << "#{name}" + end lookup(lookups) @@ -232,9 +237,9 @@ module Rails load_generators_from_railties! paths = namespaces_to_paths(namespaces) - paths.each do |path| - ["generators", "rails_generators"].each do |base| - path = "#{base}/#{path}_generator" + paths.each do |raw_path| + ["rails_generators", "generators"].each do |base| + path = "#{base}/#{raw_path}_generator" begin require path @@ -243,9 +248,9 @@ module Rails raise unless e.message =~ /#{Regexp.escape(path)}$/ rescue NameError => e raise unless e.message =~ /Rails::Generator([\s(::)]|$)/ - warn "[WARNING] Could not load generator #{path.inspect} because it's a Rails 2.x generator, which is not supported anymore. Error: #{e.message}.\n#{e.backtrace}" + warn "[WARNING] Could not load generator #{path.inspect} because it's a Rails 2.x generator, which is not supported anymore. Error: #{e.message}.\n#{e.backtrace.join("\n")}" rescue Exception => e - warn "[WARNING] Could not load generator #{path.inspect}. Error: #{e.message}.\n#{e.backtrace}" + warn "[WARNING] Could not load generator #{path.inspect}. Error: #{e.message}.\n#{e.backtrace.join("\n")}" end end end @@ -280,7 +285,7 @@ module Rails paths = [] namespaces.each do |namespace| pieces = namespace.split(":") - paths << pieces.dup.push(pieces.last).join("/") + paths << pieces.dup.push(pieces.last).join("/") unless pieces.uniq.size == 1 paths << pieces.join("/") end paths.uniq! |