Skip to content

Commit 76d9df2

Browse files
committed
Fix cache logic
The prior directory check only looked at `vendor/bundle/#{engine}/#{major}.#{minor}.0` (which does not include the bundler version). This prevented installing/updating bundler versions. The logic now checks the specific bundler version before skipping installation.
1 parent 180bf42 commit 76d9df2

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/language_pack/helpers/bundler_wrapper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def initialize(
141141
)
142142
@dir_name = "bundler-#{@version}"
143143

144-
@bundler_path = bundler_path
144+
@bundler_path = Pathname(bundler_path)
145145
@orig_bundle_gemfile = ENV['BUNDLE_GEMFILE']
146146
end
147147

@@ -193,7 +193,7 @@ def bundler_version_escape_valve!
193193

194194
private
195195
def fetch_bundler
196-
return true if Dir.exist?(bundler_path)
196+
return true if Dir.exist?(bundler_path.join("gems", dir_name))
197197

198198
topic("Installing bundler #{@version}")
199199
bundler_version_escape_valve!

spec/hatchet/getting_started_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88

99
secret_key_base = app.run("echo $SECRET_KEY_BASE")
1010

11+
set_bundler_version(version: "2.6.9")
12+
1113
# Re-deploy with cache
12-
run!("git commit --allow-empty -m empty")
14+
run!("git add .; git commit -m 'Change bundler version'")
1315
app.push!
1416

1517
# Assert used cached gems

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def set_bundler_version(version: )
7676
else
7777
version = "BUNDLED WITH\n #{version}"
7878
end
79-
gemfile_lock.gsub!(/^BUNDLED WITH$(\r?\n) (?<major>\d+)\.(?<minor>\d+)\.\d+/m, version)
79+
gemfile_lock.gsub!(/^BUNDLED WITH$(\r?\n) {2,3}(?<major>\d+)\.(?<minor>\d+)\.\d+/m, version)
8080
gemfile_lock << "\n#{version}" unless gemfile_lock.match?(/^BUNDLED WITH/)
8181

8282
Pathname("Gemfile.lock").write(gemfile_lock)

0 commit comments

Comments
 (0)