Skip to content

Commit

Permalink
Merge pull request #631 from Sixeight/fix-cannot-watch-gems-rb-locked
Browse files Browse the repository at this point in the history
Fix does not watch `gems.locked`
  • Loading branch information
rafaelfranca authored Nov 23, 2021
2 parents 9c69472 + 394ee9a commit 976b1f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/spring/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def preload
raise e unless initialized?
ensure
watcher.add loaded_application_features
watcher.add Spring.gemfile, "#{Spring.gemfile}.lock"
watcher.add Spring.gemfile, Spring.gemfile_lock

if defined?(Rails) && Rails.application
watcher.add Rails.application.paths["config/initializers"]
Expand Down
11 changes: 10 additions & 1 deletion lib/spring/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ def gemfile
require "bundler"

if /\s1.9.[0-9]/ === Bundler.ruby_scope.gsub(/[\/\s]+/,'')
ENV["BUNDLE_GEMFILE"] || "Gemfile"
Pathname.new(ENV["BUNDLE_GEMFILE"] || "Gemfile").expand_path
else
Bundler.default_gemfile
end
end

def gemfile_lock
case gemfile.to_s
when /\bgems\.rb\z/
gemfile.sub_ext('.locked')
else
gemfile.sub_ext('.lock')
end
end

def after_fork_callbacks
@after_fork_callbacks ||= []
end
Expand Down

0 comments on commit 976b1f6

Please sign in to comment.