diff options
author | Akira Matsuda <ronnie@dio.jp> | 2011-11-09 15:42:19 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2011-11-09 15:42:19 +0900 |
commit | 6d09f275c6e3224a8ea9a738512c90ee5334e20d (patch) | |
tree | fc5dabca5cdbc56ff237740e57f8ff8a80e2f373 /railties | |
parent | 7102a3d7fc55067b6cda1a7eeb3b3452050d9b6b (diff) | |
download | rails-6d09f275c6e3224a8ea9a738512c90ee5334e20d.tar.gz rails-6d09f275c6e3224a8ea9a738512c90ee5334e20d.tar.bz2 rails-6d09f275c6e3224a8ea9a738512c90ee5334e20d.zip |
Modulize Rails console methods so that other console libraries such as Pry can include these methods
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/console/app.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/console/helpers.rb | 4 | ||||
-rw-r--r-- | railties/test/application/console_test.rb | 2 |
4 files changed, 7 insertions, 5 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 82fffe86bb..e8b160448b 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -205,6 +205,8 @@ module Rails require "pp" require "rails/console/app" require "rails/console/helpers" + + IRB::ExtendCommandBundle.send :include, Rails::ConsoleMethods end end end diff --git a/railties/lib/rails/console/app.rb b/railties/lib/rails/console/app.rb index cf081473a3..23d57379ba 100644 --- a/railties/lib/rails/console/app.rb +++ b/railties/lib/rails/console/app.rb @@ -5,8 +5,8 @@ require 'action_controller' # work around the at_exit hook in test/unit, which kills IRB Test::Unit.run = true if Test::Unit.respond_to?(:run=) -module IRB - module ExtendCommandBundle +module Rails + module ConsoleMethods # reference the global "app" instance, created on demand. To recreate the # instance, pass a non-false value as the parameter. def app(create=false) diff --git a/railties/lib/rails/console/helpers.rb b/railties/lib/rails/console/helpers.rb index 070d3c2bbf..230d3d9d04 100644 --- a/railties/lib/rails/console/helpers.rb +++ b/railties/lib/rails/console/helpers.rb @@ -1,5 +1,5 @@ -module IRB - module ExtendCommandBundle +module Rails + module ConsoleMethods def helper @helper ||= ApplicationController.helpers end diff --git a/railties/test/application/console_test.rb b/railties/test/application/console_test.rb index 5a1f71ddad..b3745f194e 100644 --- a/railties/test/application/console_test.rb +++ b/railties/test/application/console_test.rb @@ -19,7 +19,7 @@ class ConsoleTest < Test::Unit::TestCase end def irb_context - Object.new.extend(IRB::ExtendCommandBundle) + Object.new.extend(Rails::ConsoleMethods) end def test_app_method_should_return_integration_session |