Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 9017

Show
Ignore:
Timestamp:
03/13/08 02:47:26 (4 months ago)
Author:
david
Message:

Fixed that script/generate would not look for plugin generators in plugin_paths (closes #11000) [glv]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/railties/CHANGELOG

    r9004 r9017  
    11*SVN* 
     2 
     3* Fixed that script/generate would not look for plugin generators in plugin_paths #11000 [glv] 
    24 
    35* 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  
    1313 
    1414module 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   
    1524  # The Initializer is responsible for processing the Rails configuration, such 
    1625  # as setting the $LOAD_PATH, requiring the right frameworks, initializing 
     
    6170    # in order (view execution order in source). 
    6271    def process 
     72      Rails.configuration = configuration 
     73 
    6374      check_ruby_version 
    6475      set_load_path 
  • trunk/railties/lib/rails_generator/lookup.rb

    r8437 r9017  
     1require 'pathname' 
     2 
    13require File.dirname(__FILE__) + '/spec' 
    24 
     
    105107            sources << PathSource.new(:lib, "#{::RAILS_ROOT}/lib/generators") 
    106108            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 
    109113          end 
    110114          sources << PathSource.new(:user, "#{Dir.user_home}/.rails/generators") 
  • trunk/railties/lib/rails_generator/scripts.rb

    r8991 r9017  
    4444          def usage_message 
    4545            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. 
    4749              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 
    5053              mem 
    51             end.each_pair do |label, names| 
     54            end.each do |label, names| 
    5255              usage << "  #{label}: #{names.join(', ')}\n" unless names.empty? 
    5356            end