pry-rails 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21af77dd8aded805e37ee7ce77e5385bd205670b
4
- data.tar.gz: bfd11e6d4dce9e3a632c2efcff9b0cc92f533df5
3
+ metadata.gz: 41aa1ef9e06430dee0459e3bd3d33e532917e53b
4
+ data.tar.gz: ba1c80d4a6d03aacd095cb8d809ac26666dd4c10
5
5
  SHA512:
6
- metadata.gz: 43224d8a22bdb7eaf256130f77612e8c65c841e9d979c7aa0fa69090c5d06bc491e0e0ffd517fc76ded8812f0d9050f0844edc0f3eed024bd7145c292c4b1400
7
- data.tar.gz: 48fc50022caf324a382e5474d5900b421c4bcc7ed7812808733bcab94f041361a476bc4ff7a2832016f54ea4bf612d4125766e3fee72ccdc5824c43a6f6d66ee
6
+ metadata.gz: 4a454d20554dde8a311f9d30d839ea768b5906e4cad43c758d6783d972744aca56cd0c75ed7df56449fc18aca8b882c32df7b59266980d3ec0c79258a96c7cd0
7
+ data.tar.gz: cc3610d5d6e7691dc34f4f2f0f668fc4e0af999956fab25cfc6fb200347df8e9346d222aa94fd92066d4e9aa29382c8e566d232427c4ea77e99f35965ea0912e
data/Rakefile CHANGED
@@ -23,7 +23,8 @@ end
23
23
 
24
24
  desc 'Start the Rails console'
25
25
  task :console => :development_env do
26
- if (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1)
26
+ if (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1) ||
27
+ Rails::VERSION::MAJOR >= 6
27
28
  require 'rails/command'
28
29
  require 'rails/commands/console/console_command'
29
30
  else
@@ -40,6 +40,10 @@ class PryRails::ShowModels < Pry::ClassCommand
40
40
  models = []
41
41
 
42
42
  ObjectSpace.each_object do |o|
43
+ # If this is deprecated, calling any methods on it will emit a warning,
44
+ # so just back away slowly.
45
+ next if ActiveSupport::Deprecation::DeprecationProxy === o
46
+
43
47
  is_model = false
44
48
 
45
49
  begin
@@ -17,10 +17,12 @@ class PryRails::ShowRoutes < Pry::ClassCommand
17
17
  Rails.application.reload_routes!
18
18
  all_routes = Rails.application.routes.routes
19
19
 
20
- formatted = case Rails.version.to_s
21
- when /^[45]/
20
+ formatted =
21
+ if Rails::VERSION::MAJOR >= 6
22
+ process_rails_6_and_higher(all_routes)
23
+ elsif Rails::VERSION::MAJOR == 4 || Rails::VERSION::MAJOR == 5
22
24
  process_rails_4_and_5(all_routes)
23
- when /^3\.2/
25
+ elsif Rails::VERSION::MAJOR >= 3 && Rails::VERSION::MINOR >= 2
24
26
  process_rails_3_2(all_routes)
25
27
  else
26
28
  process_rails_3_0_and_3_1(all_routes)
@@ -64,12 +66,26 @@ class PryRails::ShowRoutes < Pry::ClassCommand
64
66
 
65
67
  def process_rails_3_2(all_routes)
66
68
  require 'rails/application/route_inspector'
69
+
67
70
  Rails::Application::RouteInspector.new.format(all_routes)
68
71
  end
69
72
 
70
73
  def process_rails_4_and_5(all_routes)
71
74
  require 'action_dispatch/routing/inspector'
72
- ActionDispatch::Routing::RoutesInspector.new(all_routes).format(ActionDispatch::Routing::ConsoleFormatter.new).split(/\n/)
75
+
76
+ ActionDispatch::Routing::RoutesInspector.
77
+ new(all_routes).
78
+ format(ActionDispatch::Routing::ConsoleFormatter.new).
79
+ split(/\n/)
80
+ end
81
+
82
+ def process_rails_6_and_higher(all_routes)
83
+ require 'action_dispatch/routing/inspector'
84
+
85
+ ActionDispatch::Routing::RoutesInspector.
86
+ new(all_routes).
87
+ format(ActionDispatch::Routing::ConsoleFormatter::Sheet.new).
88
+ split(/\n/)
73
89
  end
74
90
 
75
91
  PryRails::Commands.add_command(self)
@@ -13,7 +13,11 @@ module PryRails
13
13
  end
14
14
 
15
15
  def project_name
16
- Rails.application.class.parent_name.underscore
16
+ if Rails::VERSION::MAJOR >= 6
17
+ Rails.application.class.module_parent_name.underscore
18
+ else
19
+ Rails.application.class.parent_name.underscore
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -14,14 +14,12 @@ module PryRails
14
14
  end
15
15
  end
16
16
 
17
- if Rails::VERSION::MAJOR == 4 || Rails::VERSION::MAJOR == 5 ||
18
- Rails::VERSION::MAJOR == 6
17
+ if Rails::VERSION::MAJOR >= 4
19
18
  Rails.application.config.console = Pry
20
19
  end
21
20
 
22
21
  if (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 2) ||
23
- Rails::VERSION::MAJOR == 4 || Rails::VERSION::MAJOR == 5 ||
24
- Rails::VERSION::MAJOR == 6
22
+ Rails::VERSION::MAJOR >= 4
25
23
  require "rails/console/app"
26
24
  require "rails/console/helpers"
27
25
  TOPLEVEL_BINDING.eval('self').extend ::Rails::ConsoleMethods
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module PryRails
4
- VERSION = "0.3.8"
4
+ VERSION = "0.3.9"
5
5
  end
@@ -2,7 +2,7 @@ project: pryrails
2
2
 
3
3
  shared:
4
4
  from: ruby:2.4
5
- cmd: "(bundle check || bundle install) && bundle exec rake"
5
+ cmd: "(bundle check || (gem install bundler && bundle install)) && bundle exec rake"
6
6
  service:
7
7
  volumes:
8
8
  - bundle_{{scenario_name}}:/usr/local/bundle
@@ -25,3 +25,6 @@ scenarios:
25
25
  rails42: {}
26
26
  rails50: {}
27
27
  rails51: {}
28
+ rails52: {}
29
+ rails60:
30
+ from: ruby:2.5
@@ -2,4 +2,4 @@ FROM ruby:2.0
2
2
  RUN mkdir -p /scenario
3
3
  WORKDIR /scenario
4
4
  ENV LANG=C.UTF-8
5
- CMD (bundle check || bundle install) && bundle exec rake
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -2,4 +2,4 @@ FROM ruby:2.0
2
2
  RUN mkdir -p /scenario
3
3
  WORKDIR /scenario
4
4
  ENV LANG=C.UTF-8
5
- CMD (bundle check || bundle install) && bundle exec rake
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -2,4 +2,4 @@ FROM ruby:2.0
2
2
  RUN mkdir -p /scenario
3
3
  WORKDIR /scenario
4
4
  ENV LANG=C.UTF-8
5
- CMD (bundle check || bundle install) && bundle exec rake
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -2,4 +2,4 @@ FROM ruby:2.3
2
2
  RUN mkdir -p /scenario
3
3
  WORKDIR /scenario
4
4
  ENV LANG=C.UTF-8
5
- CMD (bundle check || bundle install) && bundle exec rake
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -2,4 +2,4 @@ FROM ruby:2.3
2
2
  RUN mkdir -p /scenario
3
3
  WORKDIR /scenario
4
4
  ENV LANG=C.UTF-8
5
- CMD (bundle check || bundle install) && bundle exec rake
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -2,4 +2,4 @@ FROM ruby:2.4
2
2
  RUN mkdir -p /scenario
3
3
  WORKDIR /scenario
4
4
  ENV LANG=C.UTF-8
5
- CMD (bundle check || bundle install) && bundle exec rake
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -2,4 +2,4 @@ FROM ruby:2.4
2
2
  RUN mkdir -p /scenario
3
3
  WORKDIR /scenario
4
4
  ENV LANG=C.UTF-8
5
- CMD (bundle check || bundle install) && bundle exec rake
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -2,4 +2,4 @@ FROM ruby:2.4
2
2
  RUN mkdir -p /scenario
3
3
  WORKDIR /scenario
4
4
  ENV LANG=C.UTF-8
5
- CMD (bundle check || bundle install) && bundle exec rake
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -0,0 +1,15 @@
1
+ ---
2
+ version: "2"
3
+ services:
4
+ scenario:
5
+ build:
6
+ context: ..
7
+ dockerfile: scenarios/rails52.dockerfile
8
+ image: pryrails_scenario_rails52
9
+ volumes:
10
+ - "..:/scenario"
11
+ - "bundle_rails52:/usr/local/bundle"
12
+ environment:
13
+ BUNDLE_GEMFILE: scenarios/rails52.gemfile
14
+ volumes:
15
+ bundle_rails52: {}
@@ -0,0 +1,5 @@
1
+ FROM ruby:2.4
2
+ RUN mkdir -p /scenario
3
+ WORKDIR /scenario
4
+ ENV LANG=C.UTF-8
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 5.2.0"
4
+ gem "mongoid"
5
+ gem "sqlite3"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,15 @@
1
+ ---
2
+ version: "2"
3
+ services:
4
+ scenario:
5
+ build:
6
+ context: ..
7
+ dockerfile: scenarios/rails60.dockerfile
8
+ image: pryrails_scenario_rails60
9
+ volumes:
10
+ - "..:/scenario"
11
+ - "bundle_rails60:/usr/local/bundle"
12
+ environment:
13
+ BUNDLE_GEMFILE: scenarios/rails60.gemfile
14
+ volumes:
15
+ bundle_rails60: {}
@@ -0,0 +1,5 @@
1
+ FROM ruby:2.5
2
+ RUN mkdir -p /scenario
3
+ WORKDIR /scenario
4
+ ENV LANG=C.UTF-8
5
+ CMD (bundle check || (gem install bundler && bundle install)) && bundle exec rake
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", github: "rails/rails"
4
+ gem "mongoid"
5
+ gem "sqlite3"
6
+
7
+ gemspec :path => "../"
@@ -2,7 +2,8 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- if (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1)
5
+ if (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1) ||
6
+ Rails::VERSION::MAJOR >= 6
6
7
  require 'rails/command'
7
8
  require 'rails/commands/console/console_command'
8
9
  else
@@ -58,7 +58,7 @@ MODELS
58
58
  expected_output += mongoid_models
59
59
  end
60
60
 
61
- if Rails.version.to_s =~ /^5/
61
+ if Rails::VERSION::MAJOR >= 5
62
62
  expected_output = internal_models + expected_output
63
63
  end
64
64
 
@@ -10,20 +10,20 @@ describe "show-routes" do
10
10
  it "should print a list of routes" do
11
11
  output = mock_pry('show-routes', 'exit-all')
12
12
 
13
- output.must_match %r{^edit_pokemon GET /pokemon/edit}
13
+ output.must_match %r{edit_pokemon GET /pokemon/edit}
14
14
  end
15
15
 
16
16
  it "should print a list of routes which include grep option" do
17
17
  output = mock_pry('show-routes -G edit', 'exit-all')
18
18
 
19
- output.must_match %r{^edit_pokemon GET /pokemon/edit}
20
- output.must_match %r{^ edit_beer GET /beer/edit}
19
+ output.must_match %r{edit_pokemon GET /pokemon/edit}
20
+ output.must_match %r{ edit_beer GET /beer/edit}
21
21
  end
22
22
 
23
23
  it "should filter list based on multiple grep options" do
24
24
  output = mock_pry('show-routes -G edit -G pokemon', 'exit-all')
25
25
 
26
- output.must_match %r{^edit_pokemon GET /pokemon/edit}
26
+ output.must_match %r{edit_pokemon GET /pokemon/edit}
27
27
  output.wont_match %r{edit_beer}
28
28
  end
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Wenglewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-02 00:00:00.000000000 Z
11
+ date: 2018-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -103,6 +103,12 @@ files:
103
103
  - scenarios/rails51.docker-compose.yml
104
104
  - scenarios/rails51.dockerfile
105
105
  - scenarios/rails51.gemfile
106
+ - scenarios/rails52.docker-compose.yml
107
+ - scenarios/rails52.dockerfile
108
+ - scenarios/rails52.gemfile
109
+ - scenarios/rails60.docker-compose.yml
110
+ - scenarios/rails60.dockerfile
111
+ - scenarios/rails60.gemfile
106
112
  - spec/config/config.ru
107
113
  - spec/config/database.yml
108
114
  - spec/config/environment.rb
@@ -135,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
141
  version: '0'
136
142
  requirements: []
137
143
  rubyforge_project:
138
- rubygems_version: 2.6.14.3
144
+ rubygems_version: 2.6.8
139
145
  signing_key:
140
146
  specification_version: 4
141
147
  summary: Use Pry as your rails console