Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #5231 - bundler:seg-lock-add-platform-ruby, r=indirect
Browse files Browse the repository at this point in the history
[Lock] Fix --add-platform ruby

Necessary since the ruby platform is a string instead of a platform object

Closes #5230
  • Loading branch information
bundlerbot committed Dec 17, 2016
2 parents 869bf08 + 242fcbc commit 9531f73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundler/cli/lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def run

options["add-platform"].each do |platform_string|
platform = Gem::Platform.new(platform_string)
if platform.to_a.compact == %w(unknown)
if platform.to_s == "unknown"
Bundler.ui.warn "The platform `#{platform_string}` is unknown to RubyGems " \
"and adding it will likely lead to resolution errors"
end
Expand Down
6 changes: 6 additions & 0 deletions spec/commands/lock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ def read_lockfile(file = "Gemfile.lock")
expect(lockfile.platforms).to eq([java, local, mingw])
end

it "supports adding the `ruby` platform" do
bundle! "lock --add-platform ruby"
lockfile = Bundler::LockfileParser.new(read_lockfile)
expect(lockfile.platforms).to eq([local, "ruby"].uniq)
end

it "warns when adding an unknown platform" do
bundle "lock --add-platform foobarbaz"
expect(out).to include("The platform `foobarbaz` is unknown to RubyGems and adding it will likely lead to resolution errors")
Expand Down

0 comments on commit 9531f73

Please sign in to comment.