Why won't Pry run on Heroku console?

My goal is to use Pry as a console for my Rails application, both locally and on my staging server. But I can't get it to work for Heroku.

I follow these instructions to get Heroku to use Pry as a console for my Rails application. When I start heroku run console pry , my console prints Running console pry attached to terminal... up, run.1 , and then shuts down. When I run heroku console pry , it just says main and then exits.

Any ideas on what I'm doing wrong?

Here is what I have done so far:

  • In my Gemfile, I added the lines:
    gem 'pry'
    gem 'pry-rails'

  • I created a file called pry that contains:
    #!/usr/bin/env ruby
    require 'pry'
    pry

  • I added the following to all files in config / environment :
    silence_warnings do
    begin
    require 'pry'
    IRB = Pry
    rescue LoadError
    end
    end

  • run bundle install

  • run git push staging master
+7
source share
3 answers

I am the one who developed the method for Heroku and Pry, but you raised an interesting case that I did not think about, since I mainly deploy with Sinatra and EM and build my own helpers and the like. Anyway:

To use Pry with Heroku when using a Rails application, you just need to add pry-rails and pry to your gemfile (like a regular Gem), then bundle install , then git [commit|push] and run heroku run console on the Cedar stack Step 3 of what you did when you adjusted the configuration / environment does not and should not be done, please revert this change if you can. After you do this and remove the pry script from the root of your application (well, you don’t have to do the latter) Pry will load correctly with your Rails.

+12
source

I just used the instructions https://github.com/pry/pry/wiki/Setting-up-Rails-or-Heroku-to-use-Pry to install it, the pry file is at the root of your project. Lock and click on Heroku - I use a cedar stack.

Impact of the console session on heroku run console pry - I found that I then need to execute pry so that it can be dropped at the pry prompt, but it worked as I expected.

UPDATE: just to be clear, I added pry to the Gemfile and created the pry file as instructed. Your problem is that you are blocking pry in your gemfile for dev / test - are you running Heroku applications in these environments? Therefore, why do you get undefined methods?

+3
source

You probably need to list it in your provider gemfile.

0
source

All Articles