Now that Pry is our Guard interactor (PR #327), anyone who has followed the Pry wiki for using Pry with Rails without altering their Gemfile (https://github.com/pry/pry/wiki/Setting-up-Rails-or-Heroku-to-use-Pry#wiki-without_gemfile) will see Guard inexplicably die immediately prior to loading Pry.
This has to do with their ~/.pryrc loading the Rails environment. I haven't dug too deeply into the issue, but ultimately, we don't want the Rails environment to be loaded in Guard's Pry session.
I'm not sure what the best course of action is to solve this. I think it's still valuable to be able to load Rails in any pry session without an initializer or a plugin like pry-rails (consider the situation where only one developer on a team wants to use Pry), so I don't think "don't do that" is a sufficient answer. Fortunately, if anyone has copied and pasted the .pryrc snippet on the Pry wiki exactly, then loading Rails can be skipped with the ENV['SKIP_RAILS'] environment variable.
My current solution is to add: ENV['SKIP_RAILS'] = 'true' to my ~/.guard.rb file.
ENV['SKIP_RAILS'] = 'true'
If that's the best solution, then it should probably be mentioned somewhere in Guard's docs. I'd be happy to provide any additional information if it's needed.
Ignore `~/.pryrc`. (Fixed #354)
Loading the Rails env in `~/.pryrc` breaks Guard, thus we're going to
ignore it, making `~/.guardrc` the only place to customize the Guard
Thanks a lot for reporting. I disabled the loading of ~/.pryrc for Guard, so the normals Pry configuration is completely separated from the Guard Pry configuration.
Excellent! I think that makes the most sense.
Also, Guard has completely changed how I work and has become an invaluable addition to my toolchain. I can't thank you enough for it!
@jimryan thanks for your kind words!
Hi! So is it not recommended to load rails in guard's pry console?
Thanks a lot and congratulations for guard!
The title of this issue made me think that loading rails in the guard console would break guard. But it actually seems to work! :)