Skip to content
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: 2 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ jobs:
- name: Run ruby-bench
run: ruby run_benchmarks.rb -e "ruby::../build/install/bin/ruby" ${{ matrix.bench_opts }}
working-directory: ruby-bench
env:
BUNDLER_VERSION: 0

- uses: ./.github/actions/slack
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/zjit-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ jobs:
- name: Run ruby-bench
run: ruby run_benchmarks.rb -e "zjit::../build/install/bin/ruby ${{ matrix.ruby_opts }}" ${{ matrix.bench_opts }}
working-directory: ruby-bench
env:
BUNDLER_VERSION: 0

- uses: ./.github/actions/slack
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/zjit-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ jobs:
- name: Run ruby-bench
run: ruby run_benchmarks.rb -e "zjit::../build/install/bin/ruby ${{ matrix.ruby_opts }}" ${{ matrix.bench_opts }}
working-directory: ruby-bench
env:
BUNDLER_VERSION: 0

- uses: ./.github/actions/slack
with:
Expand Down
11 changes: 8 additions & 3 deletions lib/bundler/cli/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,21 @@ def run

if value.nil?
warn_unused_scope "Ignoring --#{scope} since no value to set was given"
current_value = Bundler.settings[name]

if options[:parseable]
if value = Bundler.settings[name]
Bundler.ui.info("#{name}=#{value}")
end
return
else
confirm(name)
end

confirm(name)
return
if current_value.nil?
exit 1
else
return
end
end

Bundler.ui.info(message) if message
Expand Down
11 changes: 5 additions & 6 deletions pathname_builtin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,15 @@ def sub_ext(repl)

if File::ALT_SEPARATOR
# Separator list string.
SEPARATOR_LIST = Regexp.quote "#{File::ALT_SEPARATOR}#{File::SEPARATOR}"
separator_list = Regexp.quote "#{File::ALT_SEPARATOR}#{File::SEPARATOR}"
# Regexp that matches a separator.
SEPARATOR_PAT = /[#{SEPARATOR_LIST}]/
SEPARATOR_PAT = /[#{separator_list}]/
else
SEPARATOR_LIST = Regexp.quote File::SEPARATOR
SEPARATOR_PAT = /#{SEPARATOR_LIST}/
separator_list = Regexp.quote File::SEPARATOR
SEPARATOR_PAT = /#{separator_list}/
end
SEPARATOR_LIST.freeze
SEPARATOR_PAT.freeze
private_constant :SEPARATOR_LIST, :SEPARATOR_LIST
private_constant :SEPARATOR_PAT

if File.dirname('A:') == 'A:.' # DOSish drive letter
# Regexp that matches an absolute path.
Expand Down
4 changes: 3 additions & 1 deletion spec/bundler/bundler/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ def out_with_macos_man_workaround

context "running a parseable command" do
it "prints no warning" do
bundle "config set foo value", env: { "BUNDLER_VERSION" => bundler_version }
bundle "config get --parseable foo", env: { "BUNDLER_VERSION" => bundler_version }
expect(stdboth).to eq ""
expect(out).to eq "foo=value"
expect(err).to eq ""

bundle "platform --ruby", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false
expect(stdboth).to eq "Could not locate Gemfile"
Expand Down
17 changes: 11 additions & 6 deletions spec/bundler/commands/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@

describe "parseable option" do
it "prints an empty string" do
bundle "config get foo --parseable"
bundle "config get foo --parseable", raise_on_error: false

expect(out).to eq ""
expect(last_command).to be_failure
end

it "only prints the value of the config" do
Expand Down Expand Up @@ -501,8 +502,9 @@
it "get" do
ENV["BUNDLE_BAR"] = "bar_val"

bundle "config get foo"
bundle "config get foo", raise_on_error: false
expect(out).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
expect(last_command).to be_failure

ENV["BUNDLE_FOO"] = "foo_val"

Expand Down Expand Up @@ -547,7 +549,8 @@

bundle "config unset foo"
expect(out).to eq ""
expect(bundle("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
expect(bundle("config get foo", raise_on_error: false)).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
expect(last_command).to be_failure

bundle "config set --local foo 1"
bundle "config set --global foo 2"
Expand All @@ -557,7 +560,8 @@
expect(bundle("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nSet for the current user (#{home(".bundle/config")}): \"2\""
bundle "config unset foo --global"
expect(out).to eq ""
expect(bundle("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
expect(bundle("config get foo", raise_on_error: false)).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
expect(last_command).to be_failure

bundle "config set --local foo 1"
bundle "config set --global foo 2"
Expand All @@ -567,7 +571,8 @@
expect(bundle("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nSet for your local app (#{bundled_app(".bundle/config")}): \"1\""
bundle "config unset foo --local"
expect(out).to eq ""
expect(bundle("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
expect(bundle("config get foo", raise_on_error: false)).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
expect(last_command).to be_failure

bundle "config unset foo --local --global", raise_on_error: false
expect(last_command).to be_failure
Expand Down Expand Up @@ -600,7 +605,7 @@
bundle "config set gemfile foo/bar_gemfile"

bundle "config unset gemfile"
bundle "config get gemfile"
bundle "config get gemfile", raise_on_error: false

expect(out).to include("You have not configured a value for `gemfile`")
expect(File.read(bundled_app(".bundle/config"))).not_to include("BUNDLE_GEMFILE")
Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/other/major_deprecation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@

describe "old get interface" do
before do
bundle "config waka"
bundle "config waka", raise_on_error: false
end

it "warns", bundler: "4" do
Expand Down