summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2016-12-17 13:22:02 +0000
committerThe Bundler Bot <bot@bundler.io>2016-12-17 13:22:02 +0000
commit9531f7313f2444455ec4bddfc516e2ebffce2650 (patch)
tree8074834e92fd1968cd70375d01f48d3e48c1d576
parent869bf08d37e9d796c895f478073a6127445af98f (diff)
parent242fcbcb2d15d39c63e3441756b77fbfcc1b73b2 (diff)
downloadbundler-9531f7313f2444455ec4bddfc516e2ebffce2650.tar.gz
Auto merge of #5231 - bundler:seg-lock-add-platform-ruby, r=indirect
[Lock] Fix --add-platform ruby Necessary since the ruby platform is a string instead of a platform object Closes #5230
-rw-r--r--lib/bundler/cli/lock.rb2
-rw-r--r--spec/commands/lock_spec.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/bundler/cli/lock.rb b/lib/bundler/cli/lock.rb
index 2ccaba86eb..beeb2e4633 100644
--- a/lib/bundler/cli/lock.rb
+++ b/lib/bundler/cli/lock.rb
@@ -33,7 +33,7 @@ module Bundler
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
diff --git a/spec/commands/lock_spec.rb b/spec/commands/lock_spec.rb
index 1c00aa3c1f..b51003f257 100644
--- a/spec/commands/lock_spec.rb
+++ b/spec/commands/lock_spec.rb
@@ -161,6 +161,12 @@ describe "bundle lock" do
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")