Description
As Spring loads before Bundler and therefore relies on vanilla RubyGems to load dependencies, Spring can end up loading different versions of standard gems from the main Rails application.
This is noticable with FileUtils: version 1.1.0 shipped with Ruby 2.6.5, but the latest version is 1.3.0:
$ gem list fileutils
fileutils (1.3.0, default: 1.1.0)
$ ruby --version
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
$ spring --version
Spring version 2.1.0
RubyGems defaults to loading the latest installed version of a required gem so when Spring boots and requires FileUtils, version 1.3.0 is loaded. However once inside the full Rails application and in the hands of Bundler, requiring FileUtils returns version 1.1.0. (Unless declared in Gemfile, Bundler will load the version of a stdlib gem that shipped with Ruby.)
This in turn leads to warnings about constants already being defined, e.g.:
/Users/scott/.rbenv/versions/2.6.5/lib/ruby/2.6.0/fileutils/version.rb:4: warning: already initialized constant FileUtils::VERSION
/Users/scott/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fileutils-1.3.0/lib/fileutils/version.rb:4: warning: previous definition of VERSION was here
This particular issue can be overcome by adding FileUtils to Gemfile, but Spring obviously relies on other gemified stdlib gems which may result in other subtle differences when running Rails with and without Spring.