From a1a20cfaa2cf73ae8daaf2123d7c5b513427162e Mon Sep 17 00:00:00 2001 From: hsbt Date: Tue, 12 Dec 2017 06:15:44 +0000 Subject: Merge 1-16-stable branch of bundler. It's rc version for bundler-1.16.1. I'm going to update it version after official release from bundler team. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/bundler.gemspec | 9 ++++++++- lib/bundler/cli/init.rb | 6 +----- lib/bundler/cli/update.rb | 4 +++- lib/bundler/definition.rb | 2 +- lib/bundler/resolver.rb | 3 ++- lib/bundler/source/rubygems.rb | 6 ++---- lib/bundler/templates/Executable | 14 +++++++++++--- lib/bundler/version.rb | 2 +- 8 files changed, 29 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/bundler.gemspec b/lib/bundler.gemspec index b3dff1ef14..fdc1a5cea9 100644 --- a/lib/bundler.gemspec +++ b/lib/bundler.gemspec @@ -1,7 +1,12 @@ # coding: utf-8 # frozen_string_literal: true -require File.expand_path("../bundler/version", __FILE__) +version = File.expand_path("../lib/bundler/version", __FILE__) +if File.file?(version) + require version +else # for Ruby core repository + require File.expand_path("../bundler/version", __FILE__) +end require "shellwords" Gem::Specification.new do |s| @@ -163,6 +168,7 @@ Gem::Specification.new do |s| lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem lib/bundler/stub_specification.rb + lib/bundler/templates/.document lib/bundler/templates/Executable lib/bundler/templates/Executable.bundler lib/bundler/templates/Executable.standalone @@ -333,6 +339,7 @@ Gem::Specification.new do |s| CHANGELOG.md LICENSE.md README.md + bundler.gemspec ] s.bindir = "exe" diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb index 50e01f54fb..fa53e7c74b 100644 --- a/lib/bundler/cli/init.rb +++ b/lib/bundler/cli/init.rb @@ -36,11 +36,7 @@ module Bundler private def gemfile - @gemfile ||= begin - Bundler.default_gemfile - rescue GemfileNotFound - Bundler.feature_flag.init_gems_rb? ? "gems.rb" : "Gemfile" - end + @gemfile ||= Bundler.feature_flag.init_gems_rb? ? "gems.rb" : "Gemfile" end end end diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index 5de11e84e4..3890ea307a 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -68,7 +68,9 @@ module Bundler if locked_gems = Bundler.definition.locked_gems gems.each do |name| - locked_version = locked_gems.specs.find {|s| s.name == name }.version + locked_version = locked_gems.specs.find {|s| s.name == name } + locked_version &&= locked_version.version + next unless locked_version new_version = Bundler.definition.specs[name].first new_version &&= new_version.version if !new_version diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index f93ed76226..ad16389dae 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -295,7 +295,7 @@ module Bundler end sources.all_sources.each do |source| - source.double_check_for(unmet_dependency_names, :override_dupes) + source.double_check_for(unmet_dependency_names) end break if idxcount == idx.size diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index ddc1d702e0..bfc6b91576 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -245,7 +245,8 @@ module Bundler if all <= 1 all - 1_000_000 else - search = search_for(dependency).size + search = search_for(dependency) + search = @prerelease_specified[dependency.name] ? search.count : search.count {|s| !s.version.prerelease? } search - all end end diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 6f4157364f..3cf22a50f1 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -252,10 +252,8 @@ module Bundler end end - def double_check_for(unmet_dependency_names, override_dupes = false, index = specs) + def double_check_for(unmet_dependency_names) return unless @allow_remote - raise ArgumentError, "missing index" unless index - return unless api_fetchers.any? unmet_dependency_names = unmet_dependency_names.call @@ -270,7 +268,7 @@ module Bundler Bundler.ui.debug "Double checking for #{unmet_dependency_names || "all specs (due to the size of the request)"} in #{self}" - fetch_names(api_fetchers, unmet_dependency_names, index, override_dupes) + fetch_names(api_fetchers, unmet_dependency_names, specs, false) end def dependency_names_to_double_check diff --git a/lib/bundler/templates/Executable b/lib/bundler/templates/Executable index 9289debc26..414a75898d 100755 --- a/lib/bundler/templates/Executable +++ b/lib/bundler/templates/Executable @@ -8,13 +8,21 @@ # this file is here to facilitate running it. # -bundle_binstub = File.expand_path("../bundle", __FILE__) -load(bundle_binstub) if File.file?(bundle_binstub) - require "pathname" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../<%= relative_gemfile_path %>", Pathname.new(__FILE__).realpath) +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + require "rubygems" require "bundler/setup" diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index c2355ff2c8..87cc8e3776 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ module Bundler # We're doing this because we might write tests that deal # with other versions of bundler and we are unsure how to # handle this better. - VERSION = "1.16.0" unless defined?(::Bundler::VERSION) + VERSION = "1.16.1.pre1" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin -- cgit v1.2.3