summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-06-02 18:16:12 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-06-04 23:26:51 -0500
commita633b683099e0bb59942d55072d4060241c324fd (patch)
tree626498d4669e8feb1be9325df83cf50f19ddfd30 /lib
parent667d4e4487bde5196bb326a7c03531e65de85cf6 (diff)
downloadbundler-a633b683099e0bb59942d55072d4060241c324fd.tar.gz
[Lock] Add --add-platformseg-bundle-lock-add-platform
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli.rb2
-rw-r--r--lib/bundler/cli/lock.rb5
-rw-r--r--lib/bundler/definition.rb8
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index fe510d1734..bb21e6f4e5 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -425,6 +425,8 @@ module Bundler
"the path the lockfile should be written to"
method_option "full-index", :type => :boolean, :default => false, :banner =>
"Fall back to using the single-file index of all gems"
+ method_option "add-platform", :type => :array, :default => [], :banner =>
+ "add a new platform to the lockfile"
def lock
require "bundler/cli/lock"
Lock.new(options).run
diff --git a/lib/bundler/cli/lock.rb b/lib/bundler/cli/lock.rb
index e95e9ff636..ba9a32655d 100644
--- a/lib/bundler/cli/lock.rb
+++ b/lib/bundler/cli/lock.rb
@@ -26,6 +26,11 @@ module Bundler
definition = Bundler.definition(true)
end
+ options["add-platform"].each do |platform|
+ platform = Gem::Platform.new(platform)
+ definition.add_platform(platform)
+ end
+
definition.resolve_remotely! unless options[:local]
if print
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 69ecd4fdcc..413eedc168 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -87,8 +87,7 @@ module Bundler
@unlock[:sources] ||= []
current_platform = Bundler.rubygems.platforms.map {|p| generic(p) }.compact.last
- @new_platform = !@platforms.include?(current_platform)
- @platforms |= [current_platform]
+ add_platform(current_platform)
@path_changes = converge_paths
eager_unlock = expand_dependencies(@unlock[:gems])
@@ -433,6 +432,11 @@ module Bundler
end
end
+ def add_platform(platform)
+ @new_platform ||= !@platforms.include?(platform)
+ @platforms |= [platform]
+ end
+
attr_reader :sources
private :sources