aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-03-10 16:36:17 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2012-03-14 12:46:24 -0300
commitc825e9a5eaa8060a3745c5275b6829c37c6545a7 (patch)
treec8537c3733f588e9198426de860c59bd4a2ae9a3 /railties/lib
parent124838b508f0375ba75e09a698f6e43f24ec268d (diff)
downloadrails-c825e9a5eaa8060a3745c5275b6829c37c6545a7.tar.gz
rails-c825e9a5eaa8060a3745c5275b6829c37c6545a7.tar.bz2
rails-c825e9a5eaa8060a3745c5275b6829c37c6545a7.zip
Create generators http_only! setup and hide some common namespaces for now
[Carlos Antonio da Silva & Santiago Pastorino]
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/configuration.rb14
-rw-r--r--railties/lib/rails/generators.rb8
2 files changed, 18 insertions, 4 deletions
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index d8185bcb34..46b363c70e 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -44,14 +44,14 @@ module Rails
# Cookies, Session and Flash, BestStandardsSupport, and MethodOverride. You
# can always add any of them later manually if you want.
class MiddlewareStackProxy
+ attr_reader :http_only
+ alias :http_only? :http_only
+
def initialize
@operations = []
@http_only = false
end
- attr_reader :http_only
- alias :http_only? :http_only
-
def http_only!
@http_only = true
end
@@ -90,6 +90,9 @@ module Rails
attr_accessor :aliases, :options, :templates, :fallbacks, :colorize_logging
attr_reader :hidden_namespaces
+ attr_reader :http_only
+ alias :http_only? :http_only
+
def initialize
@aliases = Hash.new { |h,k| h[k] = {} }
@options = Hash.new { |h,k| h[k] = {} }
@@ -97,6 +100,7 @@ module Rails
@templates = []
@colorize_logging = true
@hidden_namespaces = []
+ @http_only = false
end
def initialize_copy(source)
@@ -110,6 +114,10 @@ module Rails
@hidden_namespaces << namespace
end
+ def http_only!
+ @http_only = true
+ 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 cd277c5097..44121f45ce 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -68,6 +68,7 @@ module Rails
templates_path.concat config.templates
templates_path.uniq!
hide_namespaces(*config.hidden_namespaces)
+ http_only! if config.http_only?
end
def self.templates_path
@@ -104,6 +105,11 @@ module Rails
Thor::Base.shell = Thor::Shell::Basic
end
+ # Configure generators for http only
+ def self.http_only!
+ hide_namespaces "assets", "css", "js", "session_migration"
+ end
+
# Track all generators subclasses.
def self.subclasses
@subclasses ||= []
@@ -235,7 +241,7 @@ module Rails
rails.delete("plugin_new")
print_list("rails", rails)
- hidden_namespaces.each {|n| groups.delete(n.to_s) }
+ hidden_namespaces.each { |n| groups.delete(n.to_s) }
groups.sort.each { |b, n| print_list(b, n) }
end