From fe29ddcddf92bd58e8a0651942c1dea8b487369c Mon Sep 17 00:00:00 2001 From: Norimasa Ando Date: Sat, 7 Feb 2015 17:38:46 +0900 Subject: [PATCH] Update Appraisals, add rails 5.0.0.alpha support --- Appraisals | 6 ++++++ gemfiles/rails50.gemfile | 9 +++++++++ lib/pry-rails/commands/show_routes.rb | 6 +++--- lib/pry-rails/railtie.rb | 4 ++-- 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 gemfiles/rails50.gemfile diff --git a/Appraisals b/Appraisals index 037d1f4..d42135a 100644 --- a/Appraisals +++ b/Appraisals @@ -32,3 +32,9 @@ appraise "rails42" do gem "mongoid" gem "sqlite3" end + +appraise "rails50" do + gem "rails", github: "rails/rails" + gem 'arel', github: "rails/arel" + gem "sqlite3" +end diff --git a/gemfiles/rails50.gemfile b/gemfiles/rails50.gemfile new file mode 100644 index 0000000..4151a64 --- /dev/null +++ b/gemfiles/rails50.gemfile @@ -0,0 +1,9 @@ +# This file was generated by Appraisal + +source "http://rubygems.org" + +gem "rails", :github => "rails/rails" +gem "arel", :github => "rails/arel" +gem "sqlite3" + +gemspec :path => "../" diff --git a/lib/pry-rails/commands/show_routes.rb b/lib/pry-rails/commands/show_routes.rb index e16d591..360947d 100644 --- a/lib/pry-rails/commands/show_routes.rb +++ b/lib/pry-rails/commands/show_routes.rb @@ -16,8 +16,8 @@ class PryRails::ShowRoutes < Pry::ClassCommand all_routes = Rails.application.routes.routes formatted = case Rails.version.to_s - when /^4/ - process_rails_4(all_routes) + when /^[45]/ + process_rails_4_and_5(all_routes) when /^3\.2/ process_rails_3_2(all_routes) else @@ -54,7 +54,7 @@ class PryRails::ShowRoutes < Pry::ClassCommand Rails::Application::RouteInspector.new.format(all_routes) end - def process_rails_4(all_routes) + def process_rails_4_and_5(all_routes) require 'action_dispatch/routing/inspector' ActionDispatch::Routing::RoutesInspector.new(all_routes).format(ActionDispatch::Routing::ConsoleFormatter.new).split(/\n/) end diff --git a/lib/pry-rails/railtie.rb b/lib/pry-rails/railtie.rb index c82a822..46bccf0 100644 --- a/lib/pry-rails/railtie.rb +++ b/lib/pry-rails/railtie.rb @@ -14,12 +14,12 @@ module PryRails end end - if Rails::VERSION::MAJOR == 4 + if Rails::VERSION::MAJOR == 4 || Rails::VERSION::MAJOR == 5 Rails.application.config.console = Pry end if (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 2) || - Rails::VERSION::MAJOR == 4 + Rails::VERSION::MAJOR == 4 || Rails::VERSION::MAJOR == 5 require "rails/console/app" require "rails/console/helpers" TOPLEVEL_BINDING.eval('self').extend ::Rails::ConsoleMethods