diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-08-18 17:26:52 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-08-18 17:26:52 -0500 |
commit | 82d5938ad3c441eaa9cdc70b2b7148a4b2f59056 (patch) | |
tree | c2080fb7f6dee7f6863857d02597ef22f7d1e37c /lib | |
parent | 54ff7a4fb827ec36d5cac2fac843993f28b19077 (diff) | |
download | bundler-seg-enable-trampoline-2.0.tar.gz |
[PostitTrampoline] Automatically enable when target version is >= 2seg-enable-trampoline-2.0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/postit_trampoline.rb | 19 | ||||
-rw-r--r-- | lib/bundler/setup.rb | 2 |
2 files changed, 13 insertions, 8 deletions
diff --git a/lib/bundler/postit_trampoline.rb b/lib/bundler/postit_trampoline.rb index dbb23aa4d9..2a22489954 100644 --- a/lib/bundler/postit_trampoline.rb +++ b/lib/bundler/postit_trampoline.rb @@ -1,13 +1,18 @@ # frozen_string_literal: true -if ENV["BUNDLE_ENABLE_TRAMPOLINE"] - module BundlerVendoredPostIt; end - require "bundler/vendor/postit/lib/postit" - require "rubygems" +module BundlerVendoredPostIt; end +require "bundler/vendor/postit/lib/postit" +require "rubygems" - environment = BundlerVendoredPostIt::PostIt::Environment.new([]) - version = Gem::Requirement.new(environment.bundler_version) +environment = BundlerVendoredPostIt::PostIt::Environment.new([]) +version = Gem::Requirement.new(environment.bundler_version) +if version.requirements.size == 1 && version.requirements.first.first == "=" # version.exact? + if version.requirements.first.last.segments.first >= 2 + ENV["BUNDLE_ENABLE_TRAMPOLINE"] = "true" + end +end +if ENV["BUNDLE_ENABLE_TRAMPOLINE"] && !ENV["BUNDLE_DISABLE_POSTIT"] installed_version = if defined?(Bundler::VERSION) Bundler::VERSION @@ -65,4 +70,4 @@ You're running Bundler #{installed_version} but this project uses #{running_vers abort "The running bundler (#{running_version}) does not match the required `#{version}`" end -end # unless ENV["BUNDLE_ENABLE_TRAMPOLINE"] +end # if ENV["BUNDLE_ENABLE_TRAMPOLINE"] && !ENV["BUNDLE_DISABLE_POSTIT"] diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb index 8b4b479778..4e213beed3 100644 --- a/lib/bundler/setup.rb +++ b/lib/bundler/setup.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require "bundler/postit_trampoline" unless ENV["BUNDLE_DISABLE_POSTIT"] +require "bundler/postit_trampoline" require "bundler/shared_helpers" if Bundler::SharedHelpers.in_bundle? |