Sha256: 4b8d8a952b5ddb6717c5938da0df6f9b13b654423bdf5323e294cdcce7030002

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

postit_lib = File.expand_path("../vendor/postit/lib", __FILE__)
$:.unshift(postit_lib)
require "postit"
require "rubygems"

environment = BundlerVendoredPostIt::Environment.new([])
version = Gem::Requirement.new(environment.bundler_version)

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::Installer.new(version)
    installer.install!
  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

  Gem.loaded_specs.delete("bundler") unless defined?(Bundler)
  gem "bundler", version
  $:.delete(File.expand_path("../..", __FILE__))
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

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

$:.delete_at($:.find_index(postit_lib))

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bundler-1.13.0.pre.1 lib/bundler/postit_trampoline.rb