Skip to content

Commit 2d3fd1f

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Deprecate bundle cache --frozen and bundle cache --no-prune
Since they are remembered flags, too. I also restored a previous spec about `--frozen`, but didn't bother with `--no-prune`. rubygems/rubygems@7802f016fc
1 parent d20936c commit 2d3fd1f

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

lib/bundler/cli.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@ def cache
415415
print_remembered_flag_deprecation("--all", "cache_all", "true") if ARGV.include?("--all")
416416
print_remembered_flag_deprecation("--no-all", "cache_all", "false") if ARGV.include?("--no-all")
417417

418+
%w[frozen no-prune].each do |option|
419+
remembered_flag_deprecation(option)
420+
end
421+
418422
if flag_passed?("--path")
419423
message =
420424
"The `--path` flag is deprecated because its semantics are unclear. " \

spec/bundler/commands/cache_spec.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,39 @@
290290
end
291291
end
292292

293+
it "enforces frozen mode when --frozen is passed" do
294+
gemfile <<-G
295+
source "https://gem.repo1"
296+
gem "myrack"
297+
gem "myrack-obama"
298+
G
299+
300+
lockfile <<-L
301+
GEM
302+
remote: https://gem.repo1/
303+
specs:
304+
myrack (1.0.0)
305+
306+
PLATFORMS
307+
#{lockfile_platforms}
308+
309+
DEPENDENCIES
310+
myrack
311+
312+
BUNDLED WITH
313+
#{Bundler::VERSION}
314+
L
315+
316+
bundle "cache --frozen", raise_on_error: false
317+
318+
expect(exitstatus).to eq(16)
319+
expect(err).to include("frozen mode")
320+
expect(err).to include("You have added to the Gemfile")
321+
expect(err).to include("* myrack-obama")
322+
bundle "env"
323+
expect(out).to include("frozen")
324+
end
325+
293326
context "with frozen configured" do
294327
let(:app_cache) { bundled_app("vendor/cache") }
295328

spec/bundler/other/major_deprecation_spec.rb

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,50 @@
265265
pending "fails with a helpful error", bundler: "4"
266266
end
267267

268+
context "bundle cache --frozen" do
269+
before do
270+
install_gemfile <<-G
271+
source "https://gem.repo1"
272+
gem "myrack"
273+
G
274+
275+
bundle "cache --frozen", raise_on_error: false
276+
end
277+
278+
it "should print a deprecation warning" do
279+
expect(deprecations).to include(
280+
"The `--frozen` flag is deprecated because it relies on being " \
281+
"remembered across bundler invocations, which bundler will no " \
282+
"longer do in future versions. Instead please use `bundle config set " \
283+
"frozen true`, and stop using this flag"
284+
)
285+
end
286+
287+
pending "fails with a helpful error", bundler: "4"
288+
end
289+
290+
context "bundle cache --no-prune" do
291+
before do
292+
install_gemfile <<-G
293+
source "https://gem.repo1"
294+
gem "myrack"
295+
G
296+
297+
bundle "cache --no-prune", raise_on_error: false
298+
end
299+
300+
it "should print a deprecation warning" do
301+
expect(deprecations).to include(
302+
"The `--no-prune` flag is deprecated because it relies on being " \
303+
"remembered across bundler invocations, which bundler will no " \
304+
"longer do in future versions. Instead please use `bundle config set " \
305+
"no_prune true`, and stop using this flag"
306+
)
307+
end
308+
309+
pending "fails with a helpful error", bundler: "4"
310+
end
311+
268312
describe "bundle config" do
269313
describe "old list interface" do
270314
before do

0 commit comments

Comments
 (0)