summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2016-12-28 14:46:35 +0000
committerThe Bundler Bot <bot@bundler.io>2016-12-28 14:46:35 +0000
commita15b7b5b67fdad781c49138725a5fb19e26ebb23 (patch)
treebb55c8a1cf427b45315cea1bdba8fff6169346b3
parentd2f6adf24cb435dca18e543264a6b2b3f4cfac81 (diff)
parenta962d77f1953fee8553275560a89c40c2777489e (diff)
downloadbundler-a15b7b5b67fdad781c49138725a5fb19e26ebb23.tar.gz
Auto merge of #5287 - bundler:seg-rg-1.3.6, r=segiddins
[RubyGemsIntegration] Restore 1.3.6 compatibility when installing Oops.
-rw-r--r--lib/bundler/definition.rb6
-rw-r--r--lib/bundler/match_platform.rb16
-rw-r--r--lib/bundler/rubygems_integration.rb2
3 files changed, 14 insertions, 10 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 6e3b655706..1c0b0de6b0 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -499,14 +499,10 @@ module Bundler
end
end
- # TODO: refactor this so that `match_platform` can be called with two platforms
- DummyPlatform = Struct.new(:platform)
- class DummyPlatform; include MatchPlatform; end
def validate_platforms!
return if @platforms.any? do |bundle_platform|
- bundle_platform = DummyPlatform.new(bundle_platform)
Bundler.rubygems.platforms.any? do |local_platform|
- bundle_platform.match_platform(local_platform)
+ MatchPlatform.platforms_match?(bundle_platform, local_platform)
end
end
diff --git a/lib/bundler/match_platform.rb b/lib/bundler/match_platform.rb
index 0a4e4c7e3a..050cd0efd3 100644
--- a/lib/bundler/match_platform.rb
+++ b/lib/bundler/match_platform.rb
@@ -6,10 +6,18 @@ module Bundler
include GemHelpers
def match_platform(p)
- Gem::Platform::RUBY == platform ||
- platform.nil? || p == platform ||
- generic(Gem::Platform.new(platform)) === p ||
- Gem::Platform.new(platform) === p
+ MatchPlatform.platforms_match?(platform, p)
+ end
+
+ def self.platforms_match?(gemspec_platform, local_platform)
+ return true if gemspec_platform.nil?
+ return true if Gem::Platform::RUBY == gemspec_platform
+ return true if local_platform == gemspec_platform
+ gemspec_platform = Gem::Platform.new(gemspec_platform)
+ return true if GemHelpers.generic(gemspec_platform) === local_platform
+ return true if gemspec_platform === local_platform
+
+ false
end
end
end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 391316c749..dfe41ec783 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -201,7 +201,7 @@ module Bundler
end
def load_plugins
- Gem.load_plugins
+ Gem.load_plugins if Gem.respond_to?(:load_plugins)
end
def ui=(obj)