Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update generator config to support hiding namespaces and pass the app…

… into generator blocks
  • Loading branch information...
commit 9f815ee27cf5e4c6a649c83b497b27258d91cf6b 1 parent ac3503c
@wycats wycats authored
View
5 railties/lib/rails/application.rb
@@ -103,9 +103,10 @@ def load_tasks
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
View
6 railties/lib/rails/configuration.rb
@@ -43,6 +43,7 @@ def merge_into(other)
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 @@ def initialize
@fallbacks = {}
@templates = []
@colorize_logging = true
+ @hidden_namespaces = []
end
def initialize_copy(source)
@@ -59,6 +61,10 @@ def initialize_copy(source)
@templates = @templates.dup
end
+ def hide_namespace(namespace)
+ @hidden_namespaces << namespace
+ end
+
def method_missing(method, *args)
method = method.to_s.sub(/=$/, '').to_sym
View
1  railties/lib/rails/generators.rb
@@ -75,6 +75,7 @@ def self.configure!(config = Rails.application.config.generators) #:nodoc:
fallbacks.merge! config.fallbacks
templates_path.concat config.templates
templates_path.uniq!
+ hide_namespaces *config.hidden_namespaces
end
def self.templates_path
View
4 railties/lib/rails/railtie.rb
@@ -189,8 +189,8 @@ def load_tasks
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
Please sign in to comment.
Something went wrong with that request. Please try again.