summaryrefslogtreecommitdiff
path: root/lib/bundler
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-06-21 17:36:21 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-06-21 17:36:21 -0500
commita485d86072dd1301fb1876e097aaca4f9f933a37 (patch)
tree56cf33b0bcdee6f6f4bcf855516dfd9cc590af35 /lib/bundler
parent3032f4aa447ffa58bfc2fa706472591deb696a66 (diff)
downloadbundler-a485d86072dd1301fb1876e097aaca4f9f933a37.tar.gz
Completely remove the postit trampoline
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/cli.rb2
-rw-r--r--lib/bundler/cli/install.rb16
-rw-r--r--lib/bundler/postit_trampoline.rb73
-rw-r--r--lib/bundler/setup.rb10
-rw-r--r--lib/bundler/vendor/postit/lib/postit.rb15
-rw-r--r--lib/bundler/vendor/postit/lib/postit/environment.rb44
-rw-r--r--lib/bundler/vendor/postit/lib/postit/installer.rb28
-rw-r--r--lib/bundler/vendor/postit/lib/postit/parser.rb21
-rw-r--r--lib/bundler/vendor/postit/lib/postit/setup.rb12
-rw-r--r--lib/bundler/vendor/postit/lib/postit/version.rb3
10 files changed, 4 insertions, 220 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 58a7ce491a..c09b14433a 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -619,7 +619,7 @@ module Bundler
end
def print_command
- return unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] || Bundler.ui.debug?
+ return unless Bundler.ui.debug?
_, _, config = @_initializer
current_command = config[:current_command]
command_name = current_command.name
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index c110f516fc..0592385e23 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -13,8 +13,6 @@ module Bundler
warn_if_root
- warn_if_outdated
-
[:with, :without].each do |option|
if options[option]
options[option] = options[option].join(":").tr(" ", ":").split(":")
@@ -116,20 +114,6 @@ module Bundler
"application for all non-root users on this machine.", :wrap => true
end
- def warn_if_outdated
- return if ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"].nil?
- installed_version = Gem::Version.new(ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"].dup)
- running_version = Gem::Version.new(Bundler::VERSION)
- return if Gem::Requirement.new(installed_version).satisfied_by?(running_version)
- if Bundler.settings[:warned_version].nil? || running_version > Gem::Version.new(Bundler.settings[:warned_version])
- Bundler.settings[:warned_version] = running_version
- Bundler.ui.warn "You're running Bundler #{installed_version} but this " \
- "project uses #{running_version}. To update, run `bundle update " \
- "--bundler`. You won't see this message again unless you upgrade " \
- "to a newer version of Bundler.", :wrap => true
- end
- end
-
def dependencies_count_for(definition)
count = definition.dependencies.count
"#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}"
diff --git a/lib/bundler/postit_trampoline.rb b/lib/bundler/postit_trampoline.rb
deleted file mode 100644
index 576ce2a274..0000000000
--- a/lib/bundler/postit_trampoline.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# frozen_string_literal: true
-
-module BundlerVendoredPostIt; end
-require "bundler/vendor/postit/lib/postit"
-require "rubygems"
-
-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_TRAMPOLINE_FORCE"] = "true"
- end
-end
-
-if ENV["BUNDLE_TRAMPOLINE_FORCE"] && !ENV["BUNDLE_TRAMPOLINE_DISABLE"]
- installed_version =
- if defined?(Bundler::VERSION)
- Bundler::VERSION
- else
- File.read(File.expand_path("../version.rb", __FILE__)) =~ /VERSION = "(.+)"/
- $1
- end
- installed_version &&= Gem::Version.new(installed_version)
-
- if !version.satisfied_by?(installed_version)
- begin
- installer = BundlerVendoredPostIt::PostIt::Installer.new(version)
- unless installer.installed?
- warn "Installing locked Bundler version #{version.to_s.gsub("= ", "")}..."
- installer.install!
- end
- rescue => e
- abort <<-EOS.strip
-Installing the inferred bundler version (#{version}) failed.
-If you'd like to update to the current bundler version (#{installed_version}) in this project, run `bundle update --bundler`.
-The error was: #{e}
- EOS
- end
-
- if deleted_spec = Gem.loaded_specs.delete("bundler")
- deleted_spec.full_require_paths.each {|path| $:.delete(path) }
- else
- $:.delete(File.expand_path("../..", __FILE__))
- end
- gem "bundler", version
- else
- begin
- gem "bundler", version
- rescue LoadError
- $:.unshift(File.expand_path("../..", __FILE__))
- end
- end
-
- running_version = begin
- require "bundler/version"
- Bundler::VERSION
- rescue LoadError, NameError
- nil
- end
-
- ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] = installed_version.to_s
-
- if !Gem::Requirement.new(">= 1.13.pre".dup).satisfied_by?(Gem::Version.new(running_version)) && (ARGV.empty? || ARGV.any? {|a| %w[install i].include? a })
- puts <<-WARN.strip
-You're running Bundler #{installed_version} but this project uses #{running_version}. To update, run `bundle update --bundler`.
- WARN
- end
-
- if !Gem::Version.correct?(running_version.to_s) || !version.satisfied_by?(Gem::Version.create(running_version))
- abort "The running bundler (#{running_version}) does not match the required `#{version}`"
- end
-
-end # if ENV["BUNDLE_TRAMPOLINE_FORCE"] && !ENV["BUNDLE_TRAMPOLINE_DISABLE"]
diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb
index eb816b9988..9aae6478cd 100644
--- a/lib/bundler/setup.rb
+++ b/lib/bundler/setup.rb
@@ -1,5 +1,4 @@
# frozen_string_literal: true
-require "bundler/postit_trampoline"
require "bundler/shared_helpers"
if Bundler::SharedHelpers.in_bundle?
@@ -20,12 +19,9 @@ if Bundler::SharedHelpers.in_bundle?
Bundler.setup
end
- unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"]
- # Add bundler to the load path after disabling system gems
- # This is guaranteed to be done already if we've trampolined
- bundler_lib = File.expand_path("../..", __FILE__)
- $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
- end
+ # Add bundler to the load path after disabling system gems
+ bundler_lib = File.expand_path("../..", __FILE__)
+ $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
Bundler.ui = nil
end
diff --git a/lib/bundler/vendor/postit/lib/postit.rb b/lib/bundler/vendor/postit/lib/postit.rb
deleted file mode 100644
index e07dfccac4..0000000000
--- a/lib/bundler/vendor/postit/lib/postit.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'bundler/vendor/postit/lib/postit/environment'
-require 'bundler/vendor/postit/lib/postit/installer'
-require 'bundler/vendor/postit/lib/postit/parser'
-require 'bundler/vendor/postit/lib/postit/version'
-require 'rubygems'
-
-module BundlerVendoredPostIt::PostIt
- def self.setup
- load File.expand_path('../postit/setup.rb', __FILE__)
- end
-
- def self.bundler_version
- defined?(Bundler::VERSION) && Bundler::VERSION
- end
-end
diff --git a/lib/bundler/vendor/postit/lib/postit/environment.rb b/lib/bundler/vendor/postit/lib/postit/environment.rb
deleted file mode 100644
index 0c27f2cd69..0000000000
--- a/lib/bundler/vendor/postit/lib/postit/environment.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-require 'bundler/vendor/postit/lib/postit/parser'
-
-module BundlerVendoredPostIt::PostIt
- class Environment
- def initialize(argv)
- @argv = argv
- end
-
- def env_var_version
- ENV['BUNDLER_VERSION']
- end
-
- def cli_arg_version
- return unless str = @argv.first
- str = str.dup.force_encoding('BINARY') if str.respond_to?(:force_encoding)
- if Gem::Version.correct?(str)
- @argv.shift
- str
- end
- end
-
- def gemfile
- ENV['BUNDLE_GEMFILE'] || 'Gemfile'
- end
-
- def lockfile
- File.expand_path case File.basename(gemfile)
- when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile)
- else "#{gemfile}.lock"
- end
- end
-
- def lockfile_version
- BundlerVendoredPostIt::PostIt::Parser.new(lockfile).parse
- end
-
- def bundler_version
- @bundler_version ||= begin
- env_var_version || cli_arg_version ||
- lockfile_version || "#{Gem::Requirement.default}.a"
- end
- end
- end
-end
diff --git a/lib/bundler/vendor/postit/lib/postit/installer.rb b/lib/bundler/vendor/postit/lib/postit/installer.rb
deleted file mode 100644
index 5fa34b6938..0000000000
--- a/lib/bundler/vendor/postit/lib/postit/installer.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-module BundlerVendoredPostIt::PostIt
- class Installer
- def initialize(bundler_version)
- @bundler_version = bundler_version
- end
-
- def installed?
- if Gem::Specification.respond_to?(:find_by_name)
- !Gem::Specification.find_by_name('bundler', @bundler_version).nil?
- else
- requirement = Gem::Requirement.new(@bundler_version)
- Gem.source_index.gems.values.any? do |s|
- s.name == 'bundler' && requirement.satisfied_by?(s.version)
- end
- end
- rescue LoadError
- false
- end
-
- def install!
- return if installed?
- require 'rubygems/dependency_installer'
- installer = Gem::DependencyInstaller.new
- installer.install('bundler', @bundler_version)
- installer.installed_gems
- end
- end
-end
diff --git a/lib/bundler/vendor/postit/lib/postit/parser.rb b/lib/bundler/vendor/postit/lib/postit/parser.rb
deleted file mode 100644
index 7b2eb72ff1..0000000000
--- a/lib/bundler/vendor/postit/lib/postit/parser.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require 'rubygems'
-
-module BundlerVendoredPostIt::PostIt
- class Parser
- def initialize(file)
- @file = file
- end
-
- BUNDLED_WITH =
- /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
-
- def parse
- return unless lockfile = File.file?(@file) && File.read(@file)
- if lockfile =~ BUNDLED_WITH
- Regexp.last_match(1)
- else
- '< 1.10'
- end
- end
- end
-end
diff --git a/lib/bundler/vendor/postit/lib/postit/setup.rb b/lib/bundler/vendor/postit/lib/postit/setup.rb
deleted file mode 100644
index 2580e7b7b8..0000000000
--- a/lib/bundler/vendor/postit/lib/postit/setup.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'bundler/vendor/postit/lib/postit/environment'
-require 'bundler/vendor/postit/lib/postit/installer'
-
-environment = BundlerVendoredPostIt::PostIt::Environment.new(ARGV)
-version = environment.bundler_version
-
-installer = BundlerVendoredPostIt::PostIt::Installer.new(version)
-installer.install!
-
-gem 'bundler', version
-
-require 'bundler/version'
diff --git a/lib/bundler/vendor/postit/lib/postit/version.rb b/lib/bundler/vendor/postit/lib/postit/version.rb
deleted file mode 100644
index b54175254d..0000000000
--- a/lib/bundler/vendor/postit/lib/postit/version.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-module BundlerVendoredPostIt::PostIt
- VERSION = '0.2.0'.freeze
-end