mirror of
https://github.com/pry/pry-rails.git
synced 2022-11-09 12:36:03 -05:00
Split Railtie into separate file
This commit is contained in:
parent
811b4ca2fb
commit
28f4a431e0
3 changed files with 32 additions and 25 deletions
|
@ -1,27 +1,6 @@
|
|||
# encoding: UTF-8
|
||||
|
||||
require 'pry'
|
||||
|
||||
require 'pry-rails/version'
|
||||
|
||||
module PryRails
|
||||
class Railtie < Rails::Railtie
|
||||
console do
|
||||
if Rails::VERSION::MAJOR == 3
|
||||
Rails::Console::IRB = Pry
|
||||
|
||||
unless defined? Pry::ExtendCommandBundle
|
||||
Pry::ExtendCommandBundle = Module.new
|
||||
end
|
||||
end
|
||||
|
||||
if Rails::VERSION::MAJOR == 4
|
||||
Rails.application.config.console = Pry
|
||||
end
|
||||
|
||||
if (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 2) ||
|
||||
Rails::VERSION::MAJOR == 4
|
||||
require "rails/console/app"
|
||||
require "rails/console/helpers"
|
||||
TOPLEVEL_BINDING.eval('self').extend ::Rails::ConsoleMethods
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
require 'pry-rails/railtie'
|
||||
|
|
26
lib/pry-rails/railtie.rb
Normal file
26
lib/pry-rails/railtie.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
# encoding: UTF-8
|
||||
|
||||
module PryRails
|
||||
class Railtie < Rails::Railtie
|
||||
console do
|
||||
if Rails::VERSION::MAJOR == 3
|
||||
Rails::Console::IRB = Pry
|
||||
|
||||
unless defined? Pry::ExtendCommandBundle
|
||||
Pry::ExtendCommandBundle = Module.new
|
||||
end
|
||||
end
|
||||
|
||||
if Rails::VERSION::MAJOR == 4
|
||||
Rails.application.config.console = Pry
|
||||
end
|
||||
|
||||
if (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 2) ||
|
||||
Rails::VERSION::MAJOR == 4
|
||||
require "rails/console/app"
|
||||
require "rails/console/helpers"
|
||||
TOPLEVEL_BINDING.eval('self').extend ::Rails::ConsoleMethods
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,3 +1,5 @@
|
|||
# encoding: UTF-8
|
||||
|
||||
module PryRails
|
||||
VERSION = "0.1.6"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue