Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix does not watch gems.locked #631

Merged
merged 3 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/spring/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,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 @@ -6,12 +6,21 @@ class << self

def gemfile
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