Changeset 9017
- Timestamp:
- 03/13/08 02:47:26 (4 months ago)
- Files:
-
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/lib/initializer.rb (modified) (2 diffs)
- trunk/railties/lib/rails_generator/lookup.rb (modified) (2 diffs)
- trunk/railties/lib/rails_generator/scripts.rb (modified) (1 diff)
- trunk/railties/test/fixtures/plugins/alternate/a/generators (added)
- trunk/railties/test/fixtures/plugins/alternate/a/generators/a_generator (added)
- trunk/railties/test/fixtures/plugins/alternate/a/generators/a_generator/a_generator.rb (added)
- trunk/railties/test/fixtures/plugins/default/stubby/generators (added)
- trunk/railties/test/fixtures/plugins/default/stubby/generators/stubby_generator (added)
- trunk/railties/test/fixtures/plugins/default/stubby/generators/stubby_generator/stubby_generator.rb (added)
- trunk/railties/test/generator_lookup_test.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/railties/CHANGELOG
r9004 r9017 1 1 *SVN* 2 3 * Fixed that script/generate would not look for plugin generators in plugin_paths #11000 [glv] 2 4 3 5 * Fix database rake tasks to work with charset/collation and show proper error messages on failure. Closes #11301 [matt] trunk/railties/lib/initializer.rb
r9015 r9017 13 13 14 14 module Rails 15 # The Configuration instance used to configure the Rails environment 16 def self.configuration 17 @@configuration 18 end 19 20 def self.configuration=(configuration) 21 @@configuration = configuration 22 end 23 15 24 # The Initializer is responsible for processing the Rails configuration, such 16 25 # as setting the $LOAD_PATH, requiring the right frameworks, initializing … … 61 70 # in order (view execution order in source). 62 71 def process 72 Rails.configuration = configuration 73 63 74 check_ruby_version 64 75 set_load_path trunk/railties/lib/rails_generator/lookup.rb
r8437 r9017 1 require 'pathname' 2 1 3 require File.dirname(__FILE__) + '/spec' 2 4 … … 105 107 sources << PathSource.new(:lib, "#{::RAILS_ROOT}/lib/generators") 106 108 sources << PathSource.new(:vendor, "#{::RAILS_ROOT}/vendor/generators") 107 sources << PathSource.new(:plugins, "#{::RAILS_ROOT}/vendor/plugins/*/**/generators") 108 sources << PathSource.new(:plugins, "#{::RAILS_ROOT}/vendor/plugins/*/**/rails_generators") 109 Rails.configuration.plugin_paths.each do |path| 110 relative_path = Pathname.new(File.expand_path(path)).relative_path_from(Pathname.new(::RAILS_ROOT)) 111 sources << PathSource.new(:"plugins (#{relative_path})", "#{path}/**/{,rails_}generators") 112 end 109 113 end 110 114 sources << PathSource.new(:user, "#{Dir.user_home}/.rails/generators") trunk/railties/lib/rails_generator/scripts.rb
r8991 r9017 44 44 def usage_message 45 45 usage = "\nInstalled Generators\n" 46 Rails::Generator::Base.sources.inject({}) do |mem, source| 46 Rails::Generator::Base.sources.inject([]) do |mem, source| 47 # Using an association list instead of a hash to preserve order, 48 # for esthetic reasons more than anything else. 47 49 label = source.label.to_s.capitalize 48 mem[label] ||= [] 49 mem[label] |= source.names 50 pair = mem.assoc(label) 51 mem << (pair = [label, []]) if pair.nil? 52 pair[1] |= source.names 50 53 mem 51 end.each _pairdo |label, names|54 end.each do |label, names| 52 55 usage << " #{label}: #{names.join(', ')}\n" unless names.empty? 53 56 end