diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-25 01:37:55 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-25 01:37:55 +0200 |
commit | 52e01fc59dfcadaa0fd7773fb4d9a04dff297ce8 (patch) | |
tree | 1c74d37b78b4af1c5b43df667ea5176ff60256ec /railties/lib | |
parent | 76cebf2e5364fd929f60379be636f525c6473dcc (diff) | |
download | rails-52e01fc59dfcadaa0fd7773fb4d9a04dff297ce8.tar.gz rails-52e01fc59dfcadaa0fd7773fb4d9a04dff297ce8.tar.bz2 rails-52e01fc59dfcadaa0fd7773fb4d9a04dff297ce8.zip |
Everyone receives app as argument for consistency.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 14 | ||||
-rw-r--r-- | railties/lib/rails/commands/console.rb | 3 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/railtie.rb | 10 |
4 files changed, 16 insertions, 13 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 21e6f69b92..953233d774 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -50,7 +50,9 @@ module Rails end end - attr_accessor :assets + attr_accessor :assets, :sandbox + alias_method :sandbox?, :sandbox + delegate :default_url_options, :default_url_options=, :to => :routes # This method is called just after an application inherits from Rails::Application, @@ -96,9 +98,9 @@ module Rails self end - def load_tasks + def load_tasks(app=self) initialize_tasks - railties.all { |r| r.load_tasks } + railties.all { |r| r.load_tasks(app) } super self end @@ -111,10 +113,10 @@ module Rails self end - def load_console(sandbox=false) + def load_console(app=self) initialize_console - railties.all { |r| r.load_console(sandbox) } - super() + railties.all { |r| r.load_console(app) } + super self end diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index 66dbb5d11e..32e361d421 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -23,7 +23,8 @@ module Rails opt.parse!(ARGV) end - @app.load_console(options[:sandbox]) + @app.sandbox = options[:sandbox] + @app.load_console if options[:debugger] begin diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 81a0350724..0d01a818f5 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -387,7 +387,7 @@ module Rails delegate :middleware, :root, :paths, :to => :config delegate :engine_name, :isolated?, :to => "self.class" - def load_tasks + def load_tasks(*) super paths["lib/tasks"].existent.sort.each { |ext| load(ext) } end diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb index 6f0ba5bce8..65c567d72f 100644 --- a/railties/lib/rails/railtie.rb +++ b/railties/lib/rails/railtie.rb @@ -173,18 +173,18 @@ module Rails def eager_load! end - def load_console(sandbox=false) - self.class.console.each { |block| block.call(sandbox) } + def load_console(app) + self.class.console.each { |block| block.call(app) } end - def load_tasks + def load_tasks(app) extend Rake::DSL if defined? Rake::DSL - self.class.rake_tasks.each(&:call) + self.class.rake_tasks.each { |block| block.call(app) } # load also tasks from all superclasses klass = self.class.superclass while klass.respond_to?(:rake_tasks) - klass.rake_tasks.each { |t| self.instance_exec(&t) } + klass.rake_tasks.each { |t| self.instance_exec(app, &t) } klass = klass.superclass end end |