spring
spring copied to clipboard
Spring ignores ~/.irbrc and ./.rbenv-vars
Whether I run rails c
(with spring binstubs installed) or bundle exec rails c
, the console successfully connects to spring. However, it fails to load ~/.irbrc
(wherein I enable command history) or ./.rbenv-vars
(wherein I set an alternate Gemfile
using the BUNDLE_GEMFILE
variable).
This causes a few problems. In my alternate Gemfile
, I specify gems that the rest of the team I work with wouldn't want cluttering up their machines, such as rb-readline
, which fixes a number of issues with vim keybindings on the command line. I also use Fuubar
, an alternate rspec formatter, and running rspec
through spring fails to load it. Not to mention the issue with command history, which is to say that I have none.
As a bandaid, I've done this for now: https://gist.github.com/exchgr/ed0d8c575b494ca89821
I have similar issue:
- using alternate Gemfile:
Gemfile.local
- with spring gem
- when running
BUNDLE_GEMFILE=Gemfile.local bundle exec rails console
BUNDLE_GEMFILE is reset to Gemfile, thus I'm NOT able to use gems listed in Gemfile.local - when running
BUNDLE_GEMFILE=Gemfile.local bundle exec rails server
BUNDLE_GEMFILE variable is properly set to Gemfile.local and I can use gems listed in Gemfile.local
- when running
- without spring gem
- running both
BUNDLE_GEMFILE=Gemfile.local bundle exec rails console
andBUNDLE_GEMFILE=Gemfile.local bundle exec rails server
properly set BUNDLE_GEMFILE variable and I can use gems listed in Gemfile.local
- running both
In this case workaround is to put following line in your ~/.spring.rb
:
ENV['BUNDLE_GEMFILE']='Gemfile.local' if File.exist?('Gemfile.local')
just in case Google brought you here, you might have the same problem I did when I found this: as of Rails 6, Rails uses pry, not IRB, under the hood, so your ~/.irbrc
should actually be a ~/.pryrc
instead.