pry-rails 0.3.3 → 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 +4 -4
- data/.gitignore +1 -1
- data/Gemfile +1 -1
- data/Rakefile +8 -1
- data/Readme.md +42 -8
- data/lib/pry-rails/commands/find_route.rb +15 -10
- data/lib/pry-rails/commands/show_models.rb +4 -0
- data/lib/pry-rails/commands/show_routes.rb +35 -6
- data/lib/pry-rails/model_formatter.rb +22 -12
- data/lib/pry-rails/prompt.rb +51 -0
- data/lib/pry-rails/railtie.rb +2 -2
- data/lib/pry-rails/version.rb +1 -1
- data/lib/pry-rails.rb +1 -0
- data/pry-rails.gemspec +2 -1
- data/scenarios/rails30.docker-compose.yml +15 -0
- data/scenarios/rails30.dockerfile +5 -0
- data/scenarios/rails30.gemfile +7 -0
- data/scenarios/rails31.docker-compose.yml +15 -0
- data/scenarios/rails31.dockerfile +5 -0
- data/scenarios/rails31.gemfile +8 -0
- data/scenarios/rails32.docker-compose.yml +15 -0
- data/scenarios/rails32.dockerfile +5 -0
- data/scenarios/rails32.gemfile +8 -0
- data/scenarios/rails40.docker-compose.yml +15 -0
- data/scenarios/rails40.dockerfile +5 -0
- data/scenarios/rails40.gemfile +6 -0
- data/scenarios/rails41.docker-compose.yml +15 -0
- data/scenarios/rails41.dockerfile +5 -0
- data/scenarios/rails41.gemfile +7 -0
- data/scenarios/rails42.docker-compose.yml +15 -0
- data/scenarios/rails42.dockerfile +5 -0
- data/scenarios/rails42.gemfile +7 -0
- data/scenarios/rails50.docker-compose.yml +15 -0
- data/scenarios/rails50.dockerfile +5 -0
- data/scenarios/rails50.gemfile +7 -0
- data/scenarios/rails51.docker-compose.yml +15 -0
- data/scenarios/rails51.dockerfile +5 -0
- data/scenarios/rails51.gemfile +7 -0
- data/scenarios/rails52.docker-compose.yml +15 -0
- data/scenarios/rails52.dockerfile +5 -0
- data/scenarios/rails52.gemfile +7 -0
- data/scenarios/rails60.docker-compose.yml +15 -0
- data/scenarios/rails60.dockerfile +5 -0
- data/scenarios/rails60.gemfile +7 -0
- data/scenarios.yml +30 -0
- data/spec/config/environment.rb +6 -4
- data/spec/find_route_spec.rb +12 -12
- data/spec/railtie_spec.rb +8 -1
- data/spec/recognize_path_spec.rb +7 -7
- data/spec/show_model_spec.rb +4 -4
- data/spec/show_models_spec.rb +19 -5
- data/spec/show_routes_spec.rb +15 -1
- metadata +38 -14
- data/Appraisals +0 -40
- data/gemfiles/rails30.gemfile +0 -8
- data/gemfiles/rails31.gemfile +0 -9
- data/gemfiles/rails32.gemfile +0 -9
- data/gemfiles/rails40.gemfile +0 -9
- data/gemfiles/rails41.gemfile +0 -9
- data/gemfiles/rails42.gemfile +0 -9
- data/gemfiles/rails50.gemfile +0 -9
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 41aa1ef9e06430dee0459e3bd3d33e532917e53b
         | 
| 4 | 
            +
              data.tar.gz: ba1c80d4a6d03aacd095cb8d809ac26666dd4c10
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4a454d20554dde8a311f9d30d839ea768b5906e4cad43c758d6783d972744aca56cd0c75ed7df56449fc18aca8b882c32df7b59266980d3ec0c79258a96c7cd0
         | 
| 7 | 
            +
              data.tar.gz: cc3610d5d6e7691dc34f4f2f0f668fc4e0af999956fab25cfc6fb200347df8e9346d222aa94fd92066d4e9aa29382c8e566d232427c4ea77e99f35965ea0912e
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | @@ -23,7 +23,14 @@ end | |
| 23 23 |  | 
| 24 24 | 
             
            desc 'Start the Rails console'
         | 
| 25 25 | 
             
            task :console => :development_env do
         | 
| 26 | 
            -
               | 
| 26 | 
            +
              if (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1) ||
         | 
| 27 | 
            +
                  Rails::VERSION::MAJOR >= 6
         | 
| 28 | 
            +
                require 'rails/command'
         | 
| 29 | 
            +
                require 'rails/commands/console/console_command'
         | 
| 30 | 
            +
              else
         | 
| 31 | 
            +
                require 'rails/commands/console'
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
             | 
| 27 34 | 
             
              Rails::Console.start(Rails.application)
         | 
| 28 35 | 
             
            end
         | 
| 29 36 |  | 
    
        data/Readme.md
    CHANGED
    
    | @@ -6,6 +6,7 @@ This is a small gem which causes `rails console` to open [pry](http://pry.github | |
| 6 6 | 
             
            # Prerequisites
         | 
| 7 7 |  | 
| 8 8 | 
             
            - A Rails >= 3.0 Application
         | 
| 9 | 
            +
            - Ruby >= 1.9
         | 
| 9 10 |  | 
| 10 11 | 
             
            # Installation
         | 
| 11 12 |  | 
| @@ -75,19 +76,52 @@ $ DISABLE_PRY_RAILS=1 rails console | |
| 75 76 | 
             
            irb(main):001:0>
         | 
| 76 77 | 
             
            ```
         | 
| 77 78 |  | 
| 79 | 
            +
            ## Custom Rails prompt
         | 
| 80 | 
            +
             | 
| 81 | 
            +
            If you want to permanently include the current Rails environment and project name
         | 
| 82 | 
            +
            in the Pry prompt, put the following lines in your project's `.pryrc`:
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            ```ruby
         | 
| 85 | 
            +
            Pry.config.prompt = Pry::Prompt[:rails][:value]
         | 
| 86 | 
            +
            ```
         | 
| 87 | 
            +
             | 
| 88 | 
            +
            If `.pryrc` could be loaded without pry-rails being available or installed,
         | 
| 89 | 
            +
            guard against setting `Pry.config.prompt` to `nil`:
         | 
| 90 | 
            +
             | 
| 91 | 
            +
            ```ruby
         | 
| 92 | 
            +
            if Pry::Prompt[:rails]
         | 
| 93 | 
            +
              Pry.config.prompt = Pry::Prompt[:rails][:value]
         | 
| 94 | 
            +
            end
         | 
| 95 | 
            +
            ```
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            Check out `change-prompt --help` for information about temporarily
         | 
| 98 | 
            +
            changing the prompt for the current Pry session.
         | 
| 99 | 
            +
             | 
| 78 100 | 
             
            # Developing and Testing
         | 
| 79 101 |  | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 102 | 
            +
            This repo uses [Roadshow] to generate a [Docker Compose] file for each
         | 
| 103 | 
            +
            supported version of Rails (with a compatible version of Ruby for each one).
         | 
| 104 | 
            +
             | 
| 105 | 
            +
            To run specs across all versions, you can either [get the Roadshow tool] and
         | 
| 106 | 
            +
            run `roadshow run`, or use Docker Compose directly:
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            ```
         | 
| 109 | 
            +
            $ for fn in scenarios/*.docker-compose-yml; do docker-compose -f $fn run --rm scenario; done
         | 
| 110 | 
            +
            ```
         | 
| 111 | 
            +
             | 
| 112 | 
            +
            You can also manually run the Rails console and server on each version with
         | 
| 113 | 
            +
            `roadshow run rake console` and `roadshow run rake server`, or run them on a
         | 
| 114 | 
            +
            specific version with, e.g., `roadshow run -s rails40 rake console`.
         | 
| 82 115 |  | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 116 | 
            +
            To update the set of scenarios, edit `scenarios.yml` and run `roadshow
         | 
| 117 | 
            +
            generate`, although the Gemfiles in the `scenarios` directory need to be
         | 
| 118 | 
            +
            maintained manually.
         | 
| 86 119 |  | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 120 | 
            +
            [Roadshow]: https://github.com/rf-/roadshow
         | 
| 121 | 
            +
            [Docker Compose]: https://docs.docker.com/compose/
         | 
| 122 | 
            +
            [get the Roadshow tool]: https://github.com/rf-/roadshow/releases
         | 
| 89 123 |  | 
| 90 124 | 
             
            # Alternative
         | 
| 91 125 |  | 
| 92 126 | 
             
            If you want to enable pry everywhere, make sure to check out
         | 
| 93 | 
            -
            [pry everywhere](http://lucapette. | 
| 127 | 
            +
            [pry everywhere](http://lucapette.me/pry-everywhere).
         | 
| @@ -2,7 +2,6 @@ class PryRails::FindRoute < Pry::ClassCommand | |
| 2 2 | 
             
              match 'find-route'
         | 
| 3 3 | 
             
              group 'Rails'
         | 
| 4 4 | 
             
              description 'See which URLs match a given Controller.'
         | 
| 5 | 
            -
              command_options argument_required: true
         | 
| 6 5 | 
             
              banner <<-BANNER
         | 
| 7 6 | 
             
                Usage: find-route <controller>
         | 
| 8 7 |  | 
| @@ -11,13 +10,15 @@ class PryRails::FindRoute < Pry::ClassCommand | |
| 11 10 | 
             
                find-route MyController#show  #=> The URL that matches the MyController show action
         | 
| 12 11 | 
             
                find-route MyController       #=> All the URLs that hit MyController
         | 
| 13 12 | 
             
                find-route Admin              #=> All the URLs that hit the Admin namespace
         | 
| 13 | 
            +
                find-route Com                #=> All the URLS whose controller regex matches /Comm/, e.g CommentsController
         | 
| 14 14 | 
             
              BANNER
         | 
| 15 15 |  | 
| 16 16 | 
             
              def process(controller)
         | 
| 17 | 
            -
                 | 
| 18 | 
            -
             | 
| 17 | 
            +
                controller_string = controller.to_s
         | 
| 18 | 
            +
                if single_action?(controller_string)
         | 
| 19 | 
            +
                  single_action(controller_string)
         | 
| 19 20 | 
             
                else
         | 
| 20 | 
            -
                  all_actions( | 
| 21 | 
            +
                  all_actions(controller_string)
         | 
| 21 22 | 
             
                end
         | 
| 22 23 | 
             
              end
         | 
| 23 24 |  | 
| @@ -29,7 +30,7 @@ class PryRails::FindRoute < Pry::ClassCommand | |
| 29 30 |  | 
| 30 31 | 
             
              def all_actions(controller)
         | 
| 31 32 | 
             
                show_routes do |route|
         | 
| 32 | 
            -
                  route.defaults[:controller].to_s | 
| 33 | 
            +
                  route.defaults[:controller].to_s =~ /#{normalize_controller_name(controller)}/
         | 
| 33 34 | 
             
                end
         | 
| 34 35 | 
             
              end
         | 
| 35 36 |  | 
| @@ -50,14 +51,14 @@ class PryRails::FindRoute < Pry::ClassCommand | |
| 50 51 | 
             
                all_routes = routes.select(&block)
         | 
| 51 52 | 
             
                if all_routes.any?
         | 
| 52 53 | 
             
                  grouped_routes = all_routes.group_by { |route| route.defaults[:controller] }
         | 
| 53 | 
            -
                  result = grouped_routes.each_with_object("") do |(controller, routes),  | 
| 54 | 
            -
                     | 
| 55 | 
            -
                     | 
| 54 | 
            +
                  result = grouped_routes.each_with_object("") do |(controller, routes), res|
         | 
| 55 | 
            +
                    res << "Routes for " + text.bold(controller.to_s.camelize + "Controller") + "\n"
         | 
| 56 | 
            +
                    res << "--\n"
         | 
| 56 57 | 
             
                    routes.each do |route|
         | 
| 57 58 | 
             
                      spec = route.path.is_a?(String) ? route.path : route.path.spec
         | 
| 58 | 
            -
                       | 
| 59 | 
            +
                      res << "#{route.defaults[:action]} #{text.bold(verb_for(route))} #{spec}  #{route_helper(route.name)}" + "\n"
         | 
| 59 60 | 
             
                    end
         | 
| 60 | 
            -
                     | 
| 61 | 
            +
                    res << "\n"
         | 
| 61 62 | 
             
                  end
         | 
| 62 63 | 
             
                  stagger_output result
         | 
| 63 64 | 
             
                else
         | 
| @@ -65,6 +66,10 @@ class PryRails::FindRoute < Pry::ClassCommand | |
| 65 66 | 
             
                end
         | 
| 66 67 | 
             
              end
         | 
| 67 68 |  | 
| 69 | 
            +
              def route_helper(name)
         | 
| 70 | 
            +
                name && "[#{name}]"
         | 
| 71 | 
            +
              end
         | 
| 72 | 
            +
             | 
| 68 73 | 
             
              def verb_for(route)
         | 
| 69 74 | 
             
                %w(GET PUT POST PATCH DELETE).find { |v| route.verb === v }
         | 
| 70 75 | 
             
              end
         | 
| @@ -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
         | 
| @@ -8,23 +8,38 @@ class PryRails::ShowRoutes < Pry::ClassCommand | |
| 8 8 | 
             
              BANNER
         | 
| 9 9 |  | 
| 10 10 | 
             
              def options(opt)
         | 
| 11 | 
            -
                opt.on :G, "grep", "Filter output by regular expression", | 
| 11 | 
            +
                opt.on :G, "grep", "Filter output by regular expression",
         | 
| 12 | 
            +
                       :argument => true,
         | 
| 13 | 
            +
                       :as => Array
         | 
| 12 14 | 
             
              end
         | 
| 13 15 |  | 
| 14 16 | 
             
              def process
         | 
| 15 17 | 
             
                Rails.application.reload_routes!
         | 
| 16 18 | 
             
                all_routes = Rails.application.routes.routes
         | 
| 17 19 |  | 
| 18 | 
            -
                formatted = | 
| 19 | 
            -
                   | 
| 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
         | 
| 20 24 | 
             
                    process_rails_4_and_5(all_routes)
         | 
| 21 | 
            -
                   | 
| 25 | 
            +
                  elsif Rails::VERSION::MAJOR >= 3 && Rails::VERSION::MINOR >= 2
         | 
| 22 26 | 
             
                    process_rails_3_2(all_routes)
         | 
| 23 27 | 
             
                  else
         | 
| 24 28 | 
             
                    process_rails_3_0_and_3_1(all_routes)
         | 
| 25 29 | 
             
                  end
         | 
| 26 30 |  | 
| 27 | 
            -
                output.puts formatted | 
| 31 | 
            +
                output.puts grep_routes(formatted).join("\n")
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              # Takes an array of lines. Returns a list filtered by the conditions in
         | 
| 35 | 
            +
              # `opts[:G]`.
         | 
| 36 | 
            +
              def grep_routes(formatted)
         | 
| 37 | 
            +
                return formatted unless opts[:G]
         | 
| 38 | 
            +
                grep_opts = opts[:G]
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                grep_opts.reduce(formatted) do |lines, pattern|
         | 
| 41 | 
            +
                  lines.grep(Regexp.new(pattern))
         | 
| 42 | 
            +
                end
         | 
| 28 43 | 
             
              end
         | 
| 29 44 |  | 
| 30 45 | 
             
              # Cribbed from https://github.com/rails/rails/blob/3-1-stable/railties/lib/rails/tasks/routes.rake
         | 
| @@ -51,12 +66,26 @@ class PryRails::ShowRoutes < Pry::ClassCommand | |
| 51 66 |  | 
| 52 67 | 
             
              def process_rails_3_2(all_routes)
         | 
| 53 68 | 
             
                require 'rails/application/route_inspector'
         | 
| 69 | 
            +
             | 
| 54 70 | 
             
                Rails::Application::RouteInspector.new.format(all_routes)
         | 
| 55 71 | 
             
              end
         | 
| 56 72 |  | 
| 57 73 | 
             
              def process_rails_4_and_5(all_routes)
         | 
| 58 74 | 
             
                require 'action_dispatch/routing/inspector'
         | 
| 59 | 
            -
             | 
| 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/)
         | 
| 60 89 | 
             
              end
         | 
| 61 90 |  | 
| 62 91 | 
             
              PryRails::Commands.add_command(self)
         | 
| @@ -49,12 +49,12 @@ module PryRails | |
| 49 49 |  | 
| 50 50 | 
             
                  model.relations.each do |other_model, ref|
         | 
| 51 51 | 
             
                    options = []
         | 
| 52 | 
            -
                    options << 'autosave'  if ref.options[:autosave]
         | 
| 53 | 
            -
                    options << 'autobuild' if ref.options[:autobuild]
         | 
| 54 | 
            -
                    options << 'validate'  if ref.options[:validate]
         | 
| 52 | 
            +
                    options << 'autosave'  if ref.options[:autosave] || ref.autosave?
         | 
| 53 | 
            +
                    options << 'autobuild' if ref.options[:autobuild] || ref.autobuilding?
         | 
| 54 | 
            +
                    options << 'validate'  if ref.options[:validate] || ref.validate?
         | 
| 55 55 |  | 
| 56 | 
            -
                    if ref.options[:dependent]
         | 
| 57 | 
            -
                      options << "dependent-#{ref.options[:dependent]}"
         | 
| 56 | 
            +
                    if ref.options[:dependent] || ref.dependent
         | 
| 57 | 
            +
                      options << "dependent-#{ref.options[:dependent] || ref.dependent}"
         | 
| 58 58 | 
             
                    end
         | 
| 59 59 |  | 
| 60 60 | 
             
                    out.push format_association \
         | 
| @@ -82,13 +82,23 @@ module PryRails | |
| 82 82 | 
             
                end
         | 
| 83 83 |  | 
| 84 84 | 
             
                def kind_of_relation(relation)
         | 
| 85 | 
            -
                  case relation.to_s.sub(/^Mongoid::Relations | 
| 86 | 
            -
             | 
| 87 | 
            -
                     | 
| 88 | 
            -
             | 
| 89 | 
            -
                     | 
| 90 | 
            -
             | 
| 91 | 
            -
                     | 
| 85 | 
            +
                  case relation.to_s.sub(/^Mongoid::(Relations::|Association::)/, '')
         | 
| 86 | 
            +
                  when 'Referenced::Many', 'Referenced::HasMany::Proxy'
         | 
| 87 | 
            +
                    'has_many'
         | 
| 88 | 
            +
                  when 'Referenced::One', 'Referenced::HasOne::Proxy'
         | 
| 89 | 
            +
                    'has_one'
         | 
| 90 | 
            +
                  when 'Referenced::In', 'Referenced::BelongsTo::Proxy'
         | 
| 91 | 
            +
                    'belongs_to'
         | 
| 92 | 
            +
                  when 'Referenced::HasAndBelongsToMany::Proxy'
         | 
| 93 | 
            +
                    'has_and_belongs_to_many'
         | 
| 94 | 
            +
                  when 'Embedded::Many', 'Embedded::EmbedsMany::Proxy'
         | 
| 95 | 
            +
                    'embeds_many'
         | 
| 96 | 
            +
                  when 'Embedded::One', 'Embedded::EmbedsOne::Proxy'
         | 
| 97 | 
            +
                    'embeds_one'
         | 
| 98 | 
            +
                  when 'Embedded::In', 'Embedded::EmbeddedIn::Proxy'
         | 
| 99 | 
            +
                    'embedded_in'
         | 
| 100 | 
            +
                  else
         | 
| 101 | 
            +
                    '(unknown relation)'
         | 
| 92 102 | 
             
                  end
         | 
| 93 103 | 
             
                end
         | 
| 94 104 |  | 
| @@ -0,0 +1,51 @@ | |
| 1 | 
            +
            module PryRails
         | 
| 2 | 
            +
              class Prompt
         | 
| 3 | 
            +
                class << self
         | 
| 4 | 
            +
                  def formatted_env
         | 
| 5 | 
            +
                    if Rails.env.production?
         | 
| 6 | 
            +
                      bold_env = Pry::Helpers::Text.bold(Rails.env)
         | 
| 7 | 
            +
                      Pry::Helpers::Text.red(bold_env)
         | 
| 8 | 
            +
                    elsif Rails.env.development?
         | 
| 9 | 
            +
                      Pry::Helpers::Text.green(Rails.env)
         | 
| 10 | 
            +
                    else
         | 
| 11 | 
            +
                      Rails.env
         | 
| 12 | 
            +
                    end
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  def project_name
         | 
| 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
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              desc = "Includes the current Rails environment and project folder name.\n" \
         | 
| 26 | 
            +
                      "[1] [project_name][Rails.env] pry(main)>"
         | 
| 27 | 
            +
              if Pry::Prompt.respond_to?(:add)
         | 
| 28 | 
            +
                Pry::Prompt.add 'rails', desc, %w(> *) do |target_self, nest_level, pry, sep|
         | 
| 29 | 
            +
                  "[#{pry.input_ring.size}] " \
         | 
| 30 | 
            +
                  "[#{Prompt.project_name}][#{Prompt.formatted_env}] " \
         | 
| 31 | 
            +
                  "#{pry.config.prompt_name}(#{Pry.view_clip(target_self)})" \
         | 
| 32 | 
            +
                  "#{":#{nest_level}" unless nest_level.zero?}#{sep} "
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
              else
         | 
| 35 | 
            +
                draw_prompt = lambda do |target_self, nest_level, pry, sep|
         | 
| 36 | 
            +
                  "[#{pry.input_array.size}] " \
         | 
| 37 | 
            +
                  "[#{Prompt.project_name}][#{Prompt.formatted_env}] " \
         | 
| 38 | 
            +
                  "#{pry.config.prompt_name}(#{Pry.view_clip(target_self)})" \
         | 
| 39 | 
            +
                  "#{":#{nest_level}" unless nest_level.zero?}#{sep} "
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
                prompts = [
         | 
| 42 | 
            +
                  proc do |target_self, nest_level, pry|
         | 
| 43 | 
            +
                    draw_prompt.call(target_self, nest_level, pry, '>')
         | 
| 44 | 
            +
                  end,
         | 
| 45 | 
            +
                  proc do |target_self, nest_level, pry|
         | 
| 46 | 
            +
                    draw_prompt.call(target_self, nest_level, pry, '*')
         | 
| 47 | 
            +
                  end
         | 
| 48 | 
            +
                ]
         | 
| 49 | 
            +
                Pry::Prompt::MAP["rails"] = {value: prompts, description: desc}
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
            end
         | 
    
        data/lib/pry-rails/railtie.rb
    CHANGED
    
    | @@ -14,12 +14,12 @@ module PryRails | |
| 14 14 | 
             
                    end
         | 
| 15 15 | 
             
                  end
         | 
| 16 16 |  | 
| 17 | 
            -
                  if Rails::VERSION::MAJOR  | 
| 17 | 
            +
                  if Rails::VERSION::MAJOR >= 4
         | 
| 18 18 | 
             
                    Rails.application.config.console = Pry
         | 
| 19 19 | 
             
                  end
         | 
| 20 20 |  | 
| 21 21 | 
             
                  if (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 2) ||
         | 
| 22 | 
            -
                      Rails::VERSION::MAJOR  | 
| 22 | 
            +
                      Rails::VERSION::MAJOR >= 4
         | 
| 23 23 | 
             
                    require "rails/console/app"
         | 
| 24 24 | 
             
                    require "rails/console/helpers"
         | 
| 25 25 | 
             
                    TOPLEVEL_BINDING.eval('self').extend ::Rails::ConsoleMethods
         | 
    
        data/lib/pry-rails/version.rb
    CHANGED
    
    
    
        data/lib/pry-rails.rb
    CHANGED
    
    
    
        data/pry-rails.gemspec
    CHANGED
    
    | @@ -10,6 +10,7 @@ Gem::Specification.new do |s| | |
| 10 10 | 
             
              s.homepage    = "https://github.com/rweng/pry-rails"
         | 
| 11 11 | 
             
              s.summary     = %q{Use Pry as your rails console}
         | 
| 12 12 | 
             
              s.license     = "MIT"
         | 
| 13 | 
            +
              s.required_ruby_version = ">= 1.9.1"
         | 
| 13 14 | 
             
              # s.description = %q{TODO: Write a gem description}
         | 
| 14 15 |  | 
| 15 16 | 
             
              # s.rubyforge_project = "pry-rails"
         | 
| @@ -19,7 +20,7 @@ Gem::Specification.new do |s| | |
| 19 20 | 
             
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         | 
| 20 21 | 
             
              s.require_paths = ["lib"]
         | 
| 21 22 |  | 
| 22 | 
            -
              s.add_dependency "pry", ">= 0. | 
| 23 | 
            +
              s.add_dependency "pry", ">= 0.10.4"
         | 
| 23 24 | 
             
              s.add_development_dependency "appraisal"
         | 
| 24 25 | 
             
              s.add_development_dependency "minitest"
         | 
| 25 26 | 
             
            end
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            version: "2"
         | 
| 3 | 
            +
            services:
         | 
| 4 | 
            +
              scenario:
         | 
| 5 | 
            +
                build:
         | 
| 6 | 
            +
                  context: ..
         | 
| 7 | 
            +
                  dockerfile: scenarios/rails30.dockerfile
         | 
| 8 | 
            +
                image: pryrails_scenario_rails30
         | 
| 9 | 
            +
                volumes:
         | 
| 10 | 
            +
                - "..:/scenario"
         | 
| 11 | 
            +
                - "bundle_rails30:/usr/local/bundle"
         | 
| 12 | 
            +
                environment:
         | 
| 13 | 
            +
                  BUNDLE_GEMFILE: scenarios/rails30.gemfile
         | 
| 14 | 
            +
            volumes:
         | 
| 15 | 
            +
              bundle_rails30: {}
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            version: "2"
         | 
| 3 | 
            +
            services:
         | 
| 4 | 
            +
              scenario:
         | 
| 5 | 
            +
                build:
         | 
| 6 | 
            +
                  context: ..
         | 
| 7 | 
            +
                  dockerfile: scenarios/rails31.dockerfile
         | 
| 8 | 
            +
                image: pryrails_scenario_rails31
         | 
| 9 | 
            +
                volumes:
         | 
| 10 | 
            +
                - "..:/scenario"
         | 
| 11 | 
            +
                - "bundle_rails31:/usr/local/bundle"
         | 
| 12 | 
            +
                environment:
         | 
| 13 | 
            +
                  BUNDLE_GEMFILE: scenarios/rails31.gemfile
         | 
| 14 | 
            +
            volumes:
         | 
| 15 | 
            +
              bundle_rails31: {}
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            version: "2"
         | 
| 3 | 
            +
            services:
         | 
| 4 | 
            +
              scenario:
         | 
| 5 | 
            +
                build:
         | 
| 6 | 
            +
                  context: ..
         | 
| 7 | 
            +
                  dockerfile: scenarios/rails32.dockerfile
         | 
| 8 | 
            +
                image: pryrails_scenario_rails32
         | 
| 9 | 
            +
                volumes:
         | 
| 10 | 
            +
                - "..:/scenario"
         | 
| 11 | 
            +
                - "bundle_rails32:/usr/local/bundle"
         | 
| 12 | 
            +
                environment:
         | 
| 13 | 
            +
                  BUNDLE_GEMFILE: scenarios/rails32.gemfile
         | 
| 14 | 
            +
            volumes:
         | 
| 15 | 
            +
              bundle_rails32: {}
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            version: "2"
         | 
| 3 | 
            +
            services:
         | 
| 4 | 
            +
              scenario:
         | 
| 5 | 
            +
                build:
         | 
| 6 | 
            +
                  context: ..
         | 
| 7 | 
            +
                  dockerfile: scenarios/rails40.dockerfile
         | 
| 8 | 
            +
                image: pryrails_scenario_rails40
         | 
| 9 | 
            +
                volumes:
         | 
| 10 | 
            +
                - "..:/scenario"
         | 
| 11 | 
            +
                - "bundle_rails40:/usr/local/bundle"
         | 
| 12 | 
            +
                environment:
         | 
| 13 | 
            +
                  BUNDLE_GEMFILE: scenarios/rails40.gemfile
         | 
| 14 | 
            +
            volumes:
         | 
| 15 | 
            +
              bundle_rails40: {}
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            version: "2"
         | 
| 3 | 
            +
            services:
         | 
| 4 | 
            +
              scenario:
         | 
| 5 | 
            +
                build:
         | 
| 6 | 
            +
                  context: ..
         | 
| 7 | 
            +
                  dockerfile: scenarios/rails41.dockerfile
         | 
| 8 | 
            +
                image: pryrails_scenario_rails41
         | 
| 9 | 
            +
                volumes:
         | 
| 10 | 
            +
                - "..:/scenario"
         | 
| 11 | 
            +
                - "bundle_rails41:/usr/local/bundle"
         | 
| 12 | 
            +
                environment:
         | 
| 13 | 
            +
                  BUNDLE_GEMFILE: scenarios/rails41.gemfile
         | 
| 14 | 
            +
            volumes:
         | 
| 15 | 
            +
              bundle_rails41: {}
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            version: "2"
         | 
| 3 | 
            +
            services:
         | 
| 4 | 
            +
              scenario:
         | 
| 5 | 
            +
                build:
         | 
| 6 | 
            +
                  context: ..
         | 
| 7 | 
            +
                  dockerfile: scenarios/rails42.dockerfile
         | 
| 8 | 
            +
                image: pryrails_scenario_rails42
         | 
| 9 | 
            +
                volumes:
         | 
| 10 | 
            +
                - "..:/scenario"
         | 
| 11 | 
            +
                - "bundle_rails42:/usr/local/bundle"
         | 
| 12 | 
            +
                environment:
         | 
| 13 | 
            +
                  BUNDLE_GEMFILE: scenarios/rails42.gemfile
         | 
| 14 | 
            +
            volumes:
         | 
| 15 | 
            +
              bundle_rails42: {}
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            version: "2"
         | 
| 3 | 
            +
            services:
         | 
| 4 | 
            +
              scenario:
         | 
| 5 | 
            +
                build:
         | 
| 6 | 
            +
                  context: ..
         | 
| 7 | 
            +
                  dockerfile: scenarios/rails50.dockerfile
         | 
| 8 | 
            +
                image: pryrails_scenario_rails50
         | 
| 9 | 
            +
                volumes:
         | 
| 10 | 
            +
                - "..:/scenario"
         | 
| 11 | 
            +
                - "bundle_rails50:/usr/local/bundle"
         | 
| 12 | 
            +
                environment:
         | 
| 13 | 
            +
                  BUNDLE_GEMFILE: scenarios/rails50.gemfile
         | 
| 14 | 
            +
            volumes:
         | 
| 15 | 
            +
              bundle_rails50: {}
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            version: "2"
         | 
| 3 | 
            +
            services:
         | 
| 4 | 
            +
              scenario:
         | 
| 5 | 
            +
                build:
         | 
| 6 | 
            +
                  context: ..
         | 
| 7 | 
            +
                  dockerfile: scenarios/rails51.dockerfile
         | 
| 8 | 
            +
                image: pryrails_scenario_rails51
         | 
| 9 | 
            +
                volumes:
         | 
| 10 | 
            +
                - "..:/scenario"
         | 
| 11 | 
            +
                - "bundle_rails51:/usr/local/bundle"
         | 
| 12 | 
            +
                environment:
         | 
| 13 | 
            +
                  BUNDLE_GEMFILE: scenarios/rails51.gemfile
         | 
| 14 | 
            +
            volumes:
         | 
| 15 | 
            +
              bundle_rails51: {}
         | 
| @@ -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,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: {}
         | 
    
        data/scenarios.yml
    ADDED
    
    | @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            project: pryrails
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            shared:
         | 
| 4 | 
            +
              from: ruby:2.4
         | 
| 5 | 
            +
              cmd: "(bundle check || (gem install bundler && bundle install)) && bundle exec rake"
         | 
| 6 | 
            +
              service:
         | 
| 7 | 
            +
                volumes:
         | 
| 8 | 
            +
                  - bundle_{{scenario_name}}:/usr/local/bundle
         | 
| 9 | 
            +
                environment:
         | 
| 10 | 
            +
                  BUNDLE_GEMFILE: scenarios/{{scenario_name}}.gemfile
         | 
| 11 | 
            +
              volumes:
         | 
| 12 | 
            +
                bundle_{{scenario_name}}:
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            scenarios:
         | 
| 15 | 
            +
              rails30:
         | 
| 16 | 
            +
                from: ruby:2.0
         | 
| 17 | 
            +
              rails31:
         | 
| 18 | 
            +
                from: ruby:2.0
         | 
| 19 | 
            +
              rails32:
         | 
| 20 | 
            +
                from: ruby:2.0
         | 
| 21 | 
            +
              rails40:
         | 
| 22 | 
            +
                from: ruby:2.3
         | 
| 23 | 
            +
              rails41:
         | 
| 24 | 
            +
                from: ruby:2.3
         | 
| 25 | 
            +
              rails42: {}
         | 
| 26 | 
            +
              rails50: {}
         | 
| 27 | 
            +
              rails51: {}
         | 
| 28 | 
            +
              rails52: {}
         | 
| 29 | 
            +
              rails60:
         | 
| 30 | 
            +
                from: ruby:2.5
         | 
    
        data/spec/config/environment.rb
    CHANGED
    
    | @@ -4,6 +4,11 @@ require 'active_support/core_ext' | |
| 4 4 |  | 
| 5 5 | 
             
            require 'pry-rails'
         | 
| 6 6 |  | 
| 7 | 
            +
            begin
         | 
| 8 | 
            +
              require 'mongoid'
         | 
| 9 | 
            +
            rescue LoadError # Mongoid doesn't support Rails 3.0
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 7 12 | 
             
            # Initialize our test app
         | 
| 8 13 |  | 
| 9 14 | 
             
            class TestApp < Rails::Application
         | 
| @@ -58,9 +63,7 @@ class Pokemon < ActiveRecord::Base | |
| 58 63 | 
             
              has_many :beers, :through => :hacker
         | 
| 59 64 | 
             
            end
         | 
| 60 65 |  | 
| 61 | 
            -
             | 
| 62 | 
            -
              require 'mongoid'
         | 
| 63 | 
            -
             | 
| 66 | 
            +
            if defined?(Mongoid)
         | 
| 64 67 | 
             
              class Artist
         | 
| 65 68 | 
             
                include Mongoid::Document
         | 
| 66 69 |  | 
| @@ -75,5 +78,4 @@ begin | |
| 75 78 | 
             
                field :name, :type => String
         | 
| 76 79 | 
             
                embedded_in :artist
         | 
| 77 80 | 
             
              end
         | 
| 78 | 
            -
            rescue LoadError # Mongoid doesn't support Rails 3.0
         | 
| 79 81 | 
             
            end
         | 
    
        data/spec/find_route_spec.rb
    CHANGED
    
    | @@ -16,29 +16,29 @@ describe "find-route" do | |
| 16 16 |  | 
| 17 17 | 
             
              it 'returns the route for a single action' do
         | 
| 18 18 | 
             
                output = mock_pry('find-route Admin::UsersController#show', 'exit-all')
         | 
| 19 | 
            -
                output.must_match | 
| 20 | 
            -
                output.wont_match | 
| 19 | 
            +
                output.must_match(/show GET/)
         | 
| 20 | 
            +
                output.wont_match(/index GET/)
         | 
| 21 21 | 
             
              end
         | 
| 22 22 |  | 
| 23 23 | 
             
              it 'returns all the routes for a controller' do
         | 
| 24 24 | 
             
                output = mock_pry('find-route Admin::UsersController', 'exit-all')
         | 
| 25 | 
            -
                output.must_match | 
| 26 | 
            -
                output.must_match | 
| 27 | 
            -
                output.must_match | 
| 28 | 
            -
                output.must_match | 
| 29 | 
            -
                output.must_match | 
| 30 | 
            -
                output.must_match | 
| 31 | 
            -
                output.must_match | 
| 25 | 
            +
                output.must_match(/index GET/)
         | 
| 26 | 
            +
                output.must_match(/show GET/)
         | 
| 27 | 
            +
                output.must_match(/new GET/)
         | 
| 28 | 
            +
                output.must_match(/edit GET/)
         | 
| 29 | 
            +
                output.must_match(/update (PATCH|PUT)/)
         | 
| 30 | 
            +
                output.must_match(/update PUT/)
         | 
| 31 | 
            +
                output.must_match(/destroy DELETE/)
         | 
| 32 32 | 
             
              end
         | 
| 33 33 |  | 
| 34 34 | 
             
              it 'returns all routes for controllers under a namespace' do
         | 
| 35 35 | 
             
                output = mock_pry('find-route Admin', 'exit-all')
         | 
| 36 | 
            -
                output.must_match | 
| 37 | 
            -
                output.must_match | 
| 36 | 
            +
                output.must_match(/Routes for Admin::UsersController/)
         | 
| 37 | 
            +
                output.must_match(/Routes for Admin::ImagesController/)
         | 
| 38 38 | 
             
              end
         | 
| 39 39 |  | 
| 40 40 | 
             
              it 'returns no routes found when controller is not recognized' do
         | 
| 41 41 | 
             
                output = mock_pry('find-route Foo', 'exit-all')
         | 
| 42 | 
            -
                output.must_match | 
| 42 | 
            +
                output.must_match(/No routes found/)
         | 
| 43 43 | 
             
              end
         | 
| 44 44 | 
             
            end
         | 
    
        data/spec/railtie_spec.rb
    CHANGED
    
    | @@ -1,7 +1,14 @@ | |
| 1 1 | 
             
            # encoding: UTF-8
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'spec_helper'
         | 
| 4 | 
            -
             | 
| 4 | 
            +
             | 
| 5 | 
            +
            if (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1) ||
         | 
| 6 | 
            +
                Rails::VERSION::MAJOR >= 6
         | 
| 7 | 
            +
              require 'rails/command'
         | 
| 8 | 
            +
              require 'rails/commands/console/console_command'
         | 
| 9 | 
            +
            else
         | 
| 10 | 
            +
              require 'rails/commands/console'
         | 
| 11 | 
            +
            end
         | 
| 5 12 |  | 
| 6 13 | 
             
            describe PryRails::Railtie do
         | 
| 7 14 | 
             
              it 'should start Pry instead of IRB and make the helpers available' do
         | 
    
        data/spec/recognize_path_spec.rb
    CHANGED
    
    | @@ -28,21 +28,21 @@ describe "recognize-path" do | |
| 28 28 |  | 
| 29 29 | 
             
              it "prints info about controller/action that is bound to the given path" do
         | 
| 30 30 | 
             
                output = mock_pry('recognize-path example.com', 'exit-all')
         | 
| 31 | 
            -
                output.must_match | 
| 32 | 
            -
                output.must_match | 
| 31 | 
            +
                output.must_match(/controller.+foo/)
         | 
| 32 | 
            +
                output.must_match(/action.+index/)
         | 
| 33 33 | 
             
              end
         | 
| 34 34 |  | 
| 35 35 | 
             
              it "accepts short path" do
         | 
| 36 36 | 
             
                output = mock_pry('recognize-path /booms/1/edit', 'exit-all')
         | 
| 37 | 
            -
                output.must_match | 
| 38 | 
            -
                output.must_match | 
| 39 | 
            -
                output.must_match | 
| 37 | 
            +
                output.must_match(/action.+edit/)
         | 
| 38 | 
            +
                output.must_match(/controller.+booms/)
         | 
| 39 | 
            +
                output.must_match(/id.+1/)
         | 
| 40 40 | 
             
              end
         | 
| 41 41 |  | 
| 42 42 | 
             
              it "accepts -m switch" do
         | 
| 43 43 | 
             
                output = mock_pry('recognize-path example.com/booms -m post', 'exit-all')
         | 
| 44 | 
            -
                output.must_match | 
| 45 | 
            -
                output.must_match | 
| 44 | 
            +
                output.must_match(/controller.+booms/)
         | 
| 45 | 
            +
                output.must_match(/action.+create/)
         | 
| 46 46 | 
             
              end
         | 
| 47 47 |  | 
| 48 48 | 
             
              it "doesn't accept unknown methods" do
         | 
    
        data/spec/show_model_spec.rb
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require 'spec_helper'
         | 
| 4 4 |  | 
| 5 | 
            -
            describe "show- | 
| 5 | 
            +
            describe "show-model" do
         | 
| 6 6 | 
             
              it "should print one ActiveRecord model" do
         | 
| 7 7 | 
             
                output = mock_pry('show-model Beer', 'exit-all')
         | 
| 8 8 |  | 
| @@ -32,8 +32,8 @@ Artist | |
| 32 32 | 
             
              embeds_many :instruments (validate)
         | 
| 33 33 | 
             
            MODEL
         | 
| 34 34 |  | 
| 35 | 
            -
                  output.gsub! | 
| 36 | 
            -
                  output.gsub! | 
| 35 | 
            +
                  output.gsub!(/^ *_type: String\n/, '') # mongoid 3.0 and 3.1 differ on this
         | 
| 36 | 
            +
                  output.gsub!(/Moped::BSON/, 'BSON')    # mongoid 3 and 4 differ on this
         | 
| 37 37 | 
             
                  output.must_equal expected
         | 
| 38 38 | 
             
                end
         | 
| 39 39 | 
             
              end
         | 
| @@ -50,6 +50,6 @@ MODEL | |
| 50 50 |  | 
| 51 51 | 
             
              it "should print help if no model name is given" do
         | 
| 52 52 | 
             
                output = mock_pry('show-model', 'exit-all')
         | 
| 53 | 
            -
                output.must_match | 
| 53 | 
            +
                output.must_match(/Usage: show-model/)
         | 
| 54 54 | 
             
              end
         | 
| 55 55 | 
             
            end
         | 
    
        data/spec/show_models_spec.rb
    CHANGED
    
    | @@ -42,13 +42,27 @@ Instrument | |
| 42 42 | 
             
              embedded_in :artist
         | 
| 43 43 | 
             
            MODELS
         | 
| 44 44 |  | 
| 45 | 
            +
                internal_models = <<MODELS
         | 
| 46 | 
            +
            ActiveRecord::InternalMetadata
         | 
| 47 | 
            +
              key: string
         | 
| 48 | 
            +
              value: string
         | 
| 49 | 
            +
              created_at: datetime
         | 
| 50 | 
            +
              updated_at: datetime
         | 
| 51 | 
            +
            MODELS
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                expected_output = ar_models
         | 
| 54 | 
            +
             | 
| 45 55 | 
             
                if defined?(Mongoid)
         | 
| 46 | 
            -
                  output.gsub! | 
| 47 | 
            -
                  output.gsub! | 
| 48 | 
            -
                   | 
| 49 | 
            -
                else
         | 
| 50 | 
            -
                  output.must_equal ar_models
         | 
| 56 | 
            +
                  output.gsub!(/^ *_type: String\n/, '') # mongoid 3.0 and 3.1 differ on this
         | 
| 57 | 
            +
                  output.gsub!(/Moped::BSON/, 'BSON')    # mongoid 3 and 4 differ on this
         | 
| 58 | 
            +
                  expected_output += mongoid_models
         | 
| 51 59 | 
             
                end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                if Rails::VERSION::MAJOR >= 5
         | 
| 62 | 
            +
                  expected_output = internal_models + expected_output
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                output.must_equal expected_output
         | 
| 52 66 | 
             
              end
         | 
| 53 67 |  | 
| 54 68 | 
             
              it "should highlight the given phrase with --grep" do
         | 
    
        data/spec/show_routes_spec.rb
    CHANGED
    
    | @@ -10,6 +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{ | 
| 13 | 
            +
                output.must_match %r{edit_pokemon GET    /pokemon/edit}
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              it "should print a list of routes which include grep option" do
         | 
| 17 | 
            +
                output = mock_pry('show-routes -G edit', 'exit-all')
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                output.must_match %r{edit_pokemon GET    /pokemon/edit}
         | 
| 20 | 
            +
                output.must_match %r{   edit_beer GET    /beer/edit}
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              it "should filter list based on multiple grep options" do
         | 
| 24 | 
            +
                output = mock_pry('show-routes -G edit -G pokemon', 'exit-all')
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                output.must_match %r{edit_pokemon GET    /pokemon/edit}
         | 
| 27 | 
            +
                output.wont_match %r{edit_beer}
         | 
| 14 28 | 
             
              end
         | 
| 15 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. | 
| 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:  | 
| 11 | 
            +
            date: 2018-12-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: pry
         | 
| @@ -16,14 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 0. | 
| 19 | 
            +
                    version: 0.10.4
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - ">="
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 0. | 
| 26 | 
            +
                    version: 0.10.4
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: appraisal
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -60,18 +60,10 @@ extensions: [] | |
| 60 60 | 
             
            extra_rdoc_files: []
         | 
| 61 61 | 
             
            files:
         | 
| 62 62 | 
             
            - ".gitignore"
         | 
| 63 | 
            -
            - Appraisals
         | 
| 64 63 | 
             
            - Gemfile
         | 
| 65 64 | 
             
            - LICENCE
         | 
| 66 65 | 
             
            - Rakefile
         | 
| 67 66 | 
             
            - Readme.md
         | 
| 68 | 
            -
            - gemfiles/rails30.gemfile
         | 
| 69 | 
            -
            - gemfiles/rails31.gemfile
         | 
| 70 | 
            -
            - gemfiles/rails32.gemfile
         | 
| 71 | 
            -
            - gemfiles/rails40.gemfile
         | 
| 72 | 
            -
            - gemfiles/rails41.gemfile
         | 
| 73 | 
            -
            - gemfiles/rails42.gemfile
         | 
| 74 | 
            -
            - gemfiles/rails50.gemfile
         | 
| 75 67 | 
             
            - lib/pry-rails.rb
         | 
| 76 68 | 
             
            - lib/pry-rails/commands.rb
         | 
| 77 69 | 
             
            - lib/pry-rails/commands/find_route.rb
         | 
| @@ -82,9 +74,41 @@ files: | |
| 82 74 | 
             
            - lib/pry-rails/commands/show_routes.rb
         | 
| 83 75 | 
             
            - lib/pry-rails/console.rb
         | 
| 84 76 | 
             
            - lib/pry-rails/model_formatter.rb
         | 
| 77 | 
            +
            - lib/pry-rails/prompt.rb
         | 
| 85 78 | 
             
            - lib/pry-rails/railtie.rb
         | 
| 86 79 | 
             
            - lib/pry-rails/version.rb
         | 
| 87 80 | 
             
            - pry-rails.gemspec
         | 
| 81 | 
            +
            - scenarios.yml
         | 
| 82 | 
            +
            - scenarios/rails30.docker-compose.yml
         | 
| 83 | 
            +
            - scenarios/rails30.dockerfile
         | 
| 84 | 
            +
            - scenarios/rails30.gemfile
         | 
| 85 | 
            +
            - scenarios/rails31.docker-compose.yml
         | 
| 86 | 
            +
            - scenarios/rails31.dockerfile
         | 
| 87 | 
            +
            - scenarios/rails31.gemfile
         | 
| 88 | 
            +
            - scenarios/rails32.docker-compose.yml
         | 
| 89 | 
            +
            - scenarios/rails32.dockerfile
         | 
| 90 | 
            +
            - scenarios/rails32.gemfile
         | 
| 91 | 
            +
            - scenarios/rails40.docker-compose.yml
         | 
| 92 | 
            +
            - scenarios/rails40.dockerfile
         | 
| 93 | 
            +
            - scenarios/rails40.gemfile
         | 
| 94 | 
            +
            - scenarios/rails41.docker-compose.yml
         | 
| 95 | 
            +
            - scenarios/rails41.dockerfile
         | 
| 96 | 
            +
            - scenarios/rails41.gemfile
         | 
| 97 | 
            +
            - scenarios/rails42.docker-compose.yml
         | 
| 98 | 
            +
            - scenarios/rails42.dockerfile
         | 
| 99 | 
            +
            - scenarios/rails42.gemfile
         | 
| 100 | 
            +
            - scenarios/rails50.docker-compose.yml
         | 
| 101 | 
            +
            - scenarios/rails50.dockerfile
         | 
| 102 | 
            +
            - scenarios/rails50.gemfile
         | 
| 103 | 
            +
            - scenarios/rails51.docker-compose.yml
         | 
| 104 | 
            +
            - scenarios/rails51.dockerfile
         | 
| 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
         | 
| 88 112 | 
             
            - spec/config/config.ru
         | 
| 89 113 | 
             
            - spec/config/database.yml
         | 
| 90 114 | 
             
            - spec/config/environment.rb
         | 
| @@ -109,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 109 133 | 
             
              requirements:
         | 
| 110 134 | 
             
              - - ">="
         | 
| 111 135 | 
             
                - !ruby/object:Gem::Version
         | 
| 112 | 
            -
                  version:  | 
| 136 | 
            +
                  version: 1.9.1
         | 
| 113 137 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 114 138 | 
             
              requirements:
         | 
| 115 139 | 
             
              - - ">="
         | 
| @@ -117,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 117 141 | 
             
                  version: '0'
         | 
| 118 142 | 
             
            requirements: []
         | 
| 119 143 | 
             
            rubyforge_project: 
         | 
| 120 | 
            -
            rubygems_version: 2. | 
| 144 | 
            +
            rubygems_version: 2.6.8
         | 
| 121 145 | 
             
            signing_key: 
         | 
| 122 146 | 
             
            specification_version: 4
         | 
| 123 147 | 
             
            summary: Use Pry as your rails console
         | 
    
        data/Appraisals
    DELETED
    
    | @@ -1,40 +0,0 @@ | |
| 1 | 
            -
            appraise "rails30" do
         | 
| 2 | 
            -
              gem "rails", "3.0.20"
         | 
| 3 | 
            -
              gem "sqlite3"
         | 
| 4 | 
            -
            end
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            appraise "rails31" do
         | 
| 7 | 
            -
              gem "rails", "3.1.12"
         | 
| 8 | 
            -
              gem "mongoid"
         | 
| 9 | 
            -
              gem "sqlite3"
         | 
| 10 | 
            -
            end
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            appraise "rails32" do
         | 
| 13 | 
            -
              gem "rails", "3.2.21"
         | 
| 14 | 
            -
              gem "mongoid"
         | 
| 15 | 
            -
              gem "sqlite3"
         | 
| 16 | 
            -
            end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            appraise "rails40" do
         | 
| 19 | 
            -
              gem "rails", "4.0.13"
         | 
| 20 | 
            -
              gem "mongoid"
         | 
| 21 | 
            -
              gem "sqlite3"
         | 
| 22 | 
            -
            end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            appraise "rails41" do
         | 
| 25 | 
            -
              gem "rails", "4.1.9"
         | 
| 26 | 
            -
              gem "mongoid"
         | 
| 27 | 
            -
              gem "sqlite3"
         | 
| 28 | 
            -
            end
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            appraise "rails42" do
         | 
| 31 | 
            -
              gem "rails", "4.2.0"
         | 
| 32 | 
            -
              gem "mongoid"
         | 
| 33 | 
            -
              gem "sqlite3"
         | 
| 34 | 
            -
            end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
            appraise "rails50" do
         | 
| 37 | 
            -
              gem "rails", github: "rails/rails"
         | 
| 38 | 
            -
              gem 'arel', github: "rails/arel"
         | 
| 39 | 
            -
              gem "sqlite3"
         | 
| 40 | 
            -
            end
         | 
    
        data/gemfiles/rails30.gemfile
    DELETED
    
    
    
        data/gemfiles/rails31.gemfile
    DELETED
    
    
    
        data/gemfiles/rails32.gemfile
    DELETED
    
    
    
        data/gemfiles/rails40.gemfile
    DELETED
    
    
    
        data/gemfiles/rails41.gemfile
    DELETED
    
    
    
        data/gemfiles/rails42.gemfile
    DELETED