spring icon indicating copy to clipboard operation
spring copied to clipboard

Spring didn't restart after changes to Gemfile and config/application.rb

Open matt17r opened this issue 5 years ago • 1 comments

I had an issue where the dotenv-rails gem wasn't being loaded in my console. After lots of investigating I eventually ran spring stop and that fixed the issue.

In trying to learn more about Spring I've just read the README which says that:

But if we edit any of the files which were used to start the application (configs, initializers, your gemfile), the application needs to be fully restarted. This happens automatically.

In my case this didn't happen... I added the Gem to my Gemfile and spring mustn't have restarted. I later added Dotenv::Railtie.load to config/application.rb and spring still didn't restart.

How can I investigate why these changes weren't detected automagically in my case?

I'm using macOS Catalina, Terminal, and fish shell. I'm using Rails 6.0.2.1 and asdf to manage versions.

My spring.rb file is unchanged from the default (although now I'm wondering if I should add ".tool-versions" to detect changes in Ruby versions from asdf):

Spring.watch(
  ".ruby-version",
  ".rbenv-vars",
  "tmp/restart.txt",
  "tmp/caching-dev.txt"
)

matt17r avatar Mar 09 '20 03:03 matt17r

Try adding ".env" to that list.

justin808 avatar Jan 23 '22 22:01 justin808