diff options
-rw-r--r-- | railties/lib/rails/application.rb | 5 | ||||
-rw-r--r-- | railties/lib/rails/configuration.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/generators.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/railtie.rb | 4 |
4 files changed, 12 insertions, 4 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 99527bb051..4a79e68c76 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -103,9 +103,10 @@ module Rails self end - def load_generators + def load_generators(app=self) initialize_generators - railties.all { |r| r.load_generators } + railties.all { |r| r.load_generators(app) } + super self end diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 66fab0a760..f8ad17773a 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -43,6 +43,7 @@ module Rails class Generators #:nodoc: attr_accessor :aliases, :options, :templates, :fallbacks, :colorize_logging + attr_reader :hidden_namespaces def initialize @aliases = Hash.new { |h,k| h[k] = {} } @@ -50,6 +51,7 @@ module Rails @fallbacks = {} @templates = [] @colorize_logging = true + @hidden_namespaces = [] end def initialize_copy(source) @@ -59,6 +61,10 @@ module Rails @templates = @templates.dup end + def hide_namespace(namespace) + @hidden_namespaces << namespace + end + def method_missing(method, *args) method = method.to_s.sub(/=$/, '').to_sym diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index 2322e581bf..34b6f7509a 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -75,6 +75,7 @@ module Rails fallbacks.merge! config.fallbacks templates_path.concat config.templates templates_path.uniq! + hide_namespaces *config.hidden_namespaces end def self.templates_path diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb index 0a65840c2b..6f0ba5bce8 100644 --- a/railties/lib/rails/railtie.rb +++ b/railties/lib/rails/railtie.rb @@ -189,8 +189,8 @@ module Rails end end - def load_generators - self.class.generators.each(&:call) + def load_generators(app) + self.class.generators.each { |block| block.call(app) } end end end |