1
0
Fork 0
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:
Ryan Fitzgerald 2012-07-06 00:51:49 -07:00
parent 811b4ca2fb
commit 28f4a431e0
3 changed files with 32 additions and 25 deletions

View file

@ -1,27 +1,6 @@
# encoding: UTF-8
require 'pry' require 'pry'
require 'pry-rails/version' require 'pry-rails/version'
require 'pry-rails/railtie'
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

26
lib/pry-rails/railtie.rb Normal file
View 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

View file

@ -1,3 +1,5 @@
# encoding: UTF-8
module PryRails module PryRails
VERSION = "0.1.6" VERSION = "0.1.6"
end end