Skip to content

Commit 976b1f6

Browse files
authored
Merge pull request #631 from Sixeight/fix-cannot-watch-gems-rb-locked
Fix does not watch `gems.locked`
2 parents 9c69472 + 394ee9a commit 976b1f6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/spring/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def preload
116116
raise e unless initialized?
117117
ensure
118118
watcher.add loaded_application_features
119-
watcher.add Spring.gemfile, "#{Spring.gemfile}.lock"
119+
watcher.add Spring.gemfile, Spring.gemfile_lock
120120

121121
if defined?(Rails) && Rails.application
122122
watcher.add Rails.application.paths["config/initializers"]

lib/spring/configuration.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,21 @@ def gemfile
88
require "bundler"
99

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

17+
def gemfile_lock
18+
case gemfile.to_s
19+
when /\bgems\.rb\z/
20+
gemfile.sub_ext('.locked')
21+
else
22+
gemfile.sub_ext('.lock')
23+
end
24+
end
25+
1726
def after_fork_callbacks
1827
@after_fork_callbacks ||= []
1928
end

0 commit comments

Comments
 (0)