mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 03:24:00 +02:00
Merge RubyGems-3.3.7 and Bundler-2.3.7 (#5543)
This commit is contained in:
parent
36fa57fca0
commit
c8b5d7031e
31 changed files with 154 additions and 129 deletions
|
@ -654,7 +654,7 @@ EOF
|
||||||
private
|
private
|
||||||
|
|
||||||
def eval_yaml_gemspec(path, contents)
|
def eval_yaml_gemspec(path, contents)
|
||||||
require_relative "bundler/psyched_yaml"
|
Kernel.require "psych"
|
||||||
|
|
||||||
Gem::Specification.from_yaml(contents)
|
Gem::Specification.from_yaml(contents)
|
||||||
rescue ::Psych::SyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
|
rescue ::Psych::SyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
|
||||||
|
|
|
@ -180,7 +180,7 @@ module Bundler
|
||||||
scopes = %w[global local].select {|s| options[s] }
|
scopes = %w[global local].select {|s| options[s] }
|
||||||
case scopes.size
|
case scopes.size
|
||||||
when 0
|
when 0
|
||||||
@scope = "global"
|
@scope = inside_app? ? "local" : "global"
|
||||||
@explicit_scope = false
|
@explicit_scope = false
|
||||||
when 1
|
when 1
|
||||||
@scope = scopes.first
|
@scope = scopes.first
|
||||||
|
@ -189,6 +189,15 @@ module Bundler
|
||||||
"The options #{scopes.join " and "} were specified. Please only use one of the switches at a time."
|
"The options #{scopes.join " and "} were specified. Please only use one of the switches at a time."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def inside_app?
|
||||||
|
Bundler.root
|
||||||
|
true
|
||||||
|
rescue GemfileNotFound
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,7 +73,8 @@ module Bundler
|
||||||
gem_info << "\tBug Tracker: #{metadata["bug_tracker_uri"]}\n" if metadata.key?("bug_tracker_uri")
|
gem_info << "\tBug Tracker: #{metadata["bug_tracker_uri"]}\n" if metadata.key?("bug_tracker_uri")
|
||||||
gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
|
gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
|
||||||
gem_info << "\tPath: #{spec.full_gem_path}\n"
|
gem_info << "\tPath: #{spec.full_gem_path}\n"
|
||||||
gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
|
gem_info << "\tDefault Gem: yes\n" if spec.respond_to?(:default_gem?) && spec.default_gem?
|
||||||
|
gem_info << "\tReverse Dependencies: \n\t\t#{gem_dependencies.join("\n\t\t")}" if gem_dependencies.any?
|
||||||
|
|
||||||
if name != "bundler" && spec.deleted_gem?
|
if name != "bundler" && spec.deleted_gem?
|
||||||
return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
|
return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
|
||||||
|
@ -81,5 +82,13 @@ module Bundler
|
||||||
|
|
||||||
Bundler.ui.info gem_info
|
Bundler.ui.info gem_info
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def gem_dependencies
|
||||||
|
@gem_dependencies ||= Bundler.definition.specs.map do |spec|
|
||||||
|
dependency = spec.dependencies.find {|dep| dep.name == gem_name }
|
||||||
|
next unless dependency
|
||||||
|
"#{spec.name} (#{spec.version}) depends on #{gem_name} (#{dependency.requirements_list.join(", ")})"
|
||||||
|
end.compact.sort
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -135,33 +135,14 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def normalize_groups
|
def normalize_groups
|
||||||
options[:with] &&= options[:with].join(":").tr(" ", ":").split(":")
|
|
||||||
options[:without] &&= options[:without].join(":").tr(" ", ":").split(":")
|
|
||||||
|
|
||||||
check_for_group_conflicts_in_cli_options
|
check_for_group_conflicts_in_cli_options
|
||||||
|
|
||||||
Bundler.settings.set_command_option :with, nil if options[:with] == []
|
|
||||||
Bundler.settings.set_command_option :without, nil if options[:without] == []
|
|
||||||
|
|
||||||
with = options.fetch(:with, [])
|
|
||||||
with |= Bundler.settings[:with].map(&:to_s)
|
|
||||||
with -= options[:without] if options[:without]
|
|
||||||
|
|
||||||
without = options.fetch(:without, [])
|
|
||||||
without |= Bundler.settings[:without].map(&:to_s)
|
|
||||||
without -= options[:with] if options[:with]
|
|
||||||
|
|
||||||
options[:with] = with
|
|
||||||
options[:without] = without
|
|
||||||
|
|
||||||
unless Bundler.settings[:without] == options[:without] && Bundler.settings[:with] == options[:with]
|
|
||||||
# need to nil them out first to get around validation for backwards compatibility
|
# need to nil them out first to get around validation for backwards compatibility
|
||||||
Bundler.settings.set_command_option :without, nil
|
Bundler.settings.set_command_option :without, nil
|
||||||
Bundler.settings.set_command_option :with, nil
|
Bundler.settings.set_command_option :with, nil
|
||||||
Bundler.settings.set_command_option :without, options[:without] - options[:with]
|
Bundler.settings.set_command_option :without, options[:without]
|
||||||
Bundler.settings.set_command_option :with, options[:with]
|
Bundler.settings.set_command_option :with, options[:with]
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def normalize_settings
|
def normalize_settings
|
||||||
Bundler.settings.set_command_option :path, nil if options[:system]
|
Bundler.settings.set_command_option :path, nil if options[:system]
|
||||||
|
@ -184,7 +165,7 @@ module Bundler
|
||||||
|
|
||||||
Bundler.settings.set_command_option_if_given :clean, options["clean"]
|
Bundler.settings.set_command_option_if_given :clean, options["clean"]
|
||||||
|
|
||||||
normalize_groups
|
normalize_groups if options[:without] || options[:with]
|
||||||
|
|
||||||
options[:force] = options[:redownload]
|
options[:force] = options[:redownload]
|
||||||
end
|
end
|
||||||
|
|
|
@ -240,7 +240,7 @@ module Bundler
|
||||||
raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
|
raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
|
||||||
|
|
||||||
con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
|
con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
|
||||||
if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
|
if gem_proxy = Gem.configuration[:http_proxy]
|
||||||
con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
|
con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -251,8 +251,8 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
|
ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
|
||||||
(Bundler.rubygems.configuration.ssl_client_cert if
|
(Gem.configuration.ssl_client_cert if
|
||||||
Bundler.rubygems.configuration.respond_to?(:ssl_client_cert))
|
Gem.configuration.respond_to?(:ssl_client_cert))
|
||||||
if ssl_client_cert
|
if ssl_client_cert
|
||||||
pem = File.read(ssl_client_cert)
|
pem = File.read(ssl_client_cert)
|
||||||
con.cert = OpenSSL::X509::Certificate.new(pem)
|
con.cert = OpenSSL::X509::Certificate.new(pem)
|
||||||
|
@ -283,8 +283,8 @@ module Bundler
|
||||||
def bundler_cert_store
|
def bundler_cert_store
|
||||||
store = OpenSSL::X509::Store.new
|
store = OpenSSL::X509::Store.new
|
||||||
ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
|
ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
|
||||||
(Bundler.rubygems.configuration.ssl_ca_cert if
|
(Gem.configuration.ssl_ca_cert if
|
||||||
Bundler.rubygems.configuration.respond_to?(:ssl_ca_cert))
|
Gem.configuration.respond_to?(:ssl_ca_cert))
|
||||||
if ssl_ca_cert
|
if ssl_ca_cert
|
||||||
if File.directory? ssl_ca_cert
|
if File.directory? ssl_ca_cert
|
||||||
store.add_path ssl_ca_cert
|
store.add_path ssl_ca_cert
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
begin
|
|
||||||
require "psych"
|
|
||||||
rescue LoadError
|
|
||||||
# Apparently Psych wasn't available. Oh well.
|
|
||||||
end
|
|
||||||
|
|
||||||
# At least load the YAML stdlib, whatever that may be
|
|
||||||
require "yaml" unless defined?(YAML.dump)
|
|
|
@ -4,14 +4,12 @@ require "pathname"
|
||||||
|
|
||||||
require "rubygems/specification"
|
require "rubygems/specification"
|
||||||
|
|
||||||
# Possible use in Gem::Specification#source below and require
|
|
||||||
# shouldn't be deferred.
|
|
||||||
require "rubygems/source"
|
|
||||||
|
|
||||||
require_relative "match_platform"
|
require_relative "match_platform"
|
||||||
|
|
||||||
module Gem
|
module Gem
|
||||||
class Specification
|
class Specification
|
||||||
|
include ::Bundler::MatchPlatform
|
||||||
|
|
||||||
attr_accessor :remote, :location, :relative_loaded_from
|
attr_accessor :remote, :location, :relative_loaded_from
|
||||||
|
|
||||||
remove_method :source
|
remove_method :source
|
||||||
|
@ -81,6 +79,17 @@ module Gem
|
||||||
gemfile
|
gemfile
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Backfill missing YAML require when not defined. Fixed since 3.1.0.pre1.
|
||||||
|
module YamlBackfiller
|
||||||
|
def to_yaml(opts = {})
|
||||||
|
Gem.load_yaml unless defined?(::YAML)
|
||||||
|
|
||||||
|
super(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
prepend YamlBackfiller
|
||||||
|
|
||||||
def nondevelopment_dependencies
|
def nondevelopment_dependencies
|
||||||
dependencies - development_dependencies
|
dependencies - development_dependencies
|
||||||
end
|
end
|
||||||
|
@ -228,9 +237,3 @@ module Gem
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module Gem
|
|
||||||
class Specification
|
|
||||||
include ::Bundler::MatchPlatform
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -104,18 +104,6 @@ module Bundler
|
||||||
obj.to_s
|
obj.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def configuration
|
|
||||||
require_relative "psyched_yaml"
|
|
||||||
Gem.configuration
|
|
||||||
rescue Gem::SystemExitException, LoadError => e
|
|
||||||
Bundler.ui.error "#{e.class}: #{e.message}"
|
|
||||||
Bundler.ui.trace e
|
|
||||||
raise
|
|
||||||
rescue ::Psych::SyntaxError => e
|
|
||||||
raise YamlSyntaxError.new(e, "Your RubyGems configuration, which is " \
|
|
||||||
"usually located in ~/.gemrc, contains invalid YAML syntax.")
|
|
||||||
end
|
|
||||||
|
|
||||||
def ruby_engine
|
def ruby_engine
|
||||||
Gem.ruby_engine
|
Gem.ruby_engine
|
||||||
end
|
end
|
||||||
|
@ -217,7 +205,7 @@ module Bundler
|
||||||
|
|
||||||
def spec_from_gem(path, policy = nil)
|
def spec_from_gem(path, policy = nil)
|
||||||
require "rubygems/security"
|
require "rubygems/security"
|
||||||
require_relative "psyched_yaml"
|
require "psych"
|
||||||
gem_from_path(path, security_policies[policy]).spec
|
gem_from_path(path, security_policies[policy]).spec
|
||||||
rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
|
||||||
if e.is_a?(Gem::Security::Exception) ||
|
if e.is_a?(Gem::Security::Exception) ||
|
||||||
|
@ -522,7 +510,7 @@ module Bundler
|
||||||
|
|
||||||
def gem_remote_fetcher
|
def gem_remote_fetcher
|
||||||
require "rubygems/remote_fetcher"
|
require "rubygems/remote_fetcher"
|
||||||
proxy = configuration[:http_proxy]
|
proxy = Gem.configuration[:http_proxy]
|
||||||
Gem::RemoteFetcher.new(proxy)
|
Gem::RemoteFetcher.new(proxy)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,7 @@ module Bundler
|
||||||
|
|
||||||
def to_array(value)
|
def to_array(value)
|
||||||
return [] unless value
|
return [] unless value
|
||||||
value.split(":").map(&:to_sym)
|
value.tr(" ", ":").split(":").map(&:to_sym)
|
||||||
end
|
end
|
||||||
|
|
||||||
def array_to_s(array)
|
def array_to_s(array)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: false
|
# frozen_string_literal: false
|
||||||
|
|
||||||
module Bundler
|
module Bundler
|
||||||
VERSION = "2.3.6".freeze
|
VERSION = "2.3.7".freeze
|
||||||
|
|
||||||
def self.bundler_major_version
|
def self.bundler_major_version
|
||||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
|
|
||||||
module Gem
|
module Gem
|
||||||
VERSION = "3.3.6".freeze
|
VERSION = "3.3.7".freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
# Must be first since it unloads the prelude from 1.9.2
|
# Must be first since it unloads the prelude from 1.9.2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
# -*- coding: utf-8 -*-
|
#
|
||||||
#--
|
#--
|
||||||
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require_relative "deprecate"
|
||||||
|
|
||||||
##
|
##
|
||||||
# The Version class processes string versions into comparable
|
# The Version class processes string versions into comparable
|
||||||
# values. A version string should normally be a series of numbers
|
# values. A version string should normally be a series of numbers
|
||||||
|
@ -149,8 +152,6 @@
|
||||||
# For the last example, single-digit versions are automatically extended with
|
# For the last example, single-digit versions are automatically extended with
|
||||||
# a zero to give a sensible result.
|
# a zero to give a sensible result.
|
||||||
|
|
||||||
require_relative "deprecate"
|
|
||||||
|
|
||||||
class Gem::Version
|
class Gem::Version
|
||||||
autoload :Requirement, File.expand_path('requirement', __dir__)
|
autoload :Requirement, File.expand_path('requirement', __dir__)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ RSpec.describe Bundler::Fetcher do
|
||||||
context "when Gem.configuration specifies http_proxy " do
|
context "when Gem.configuration specifies http_proxy " do
|
||||||
let(:proxy) { "http://proxy-example2.com" }
|
let(:proxy) { "http://proxy-example2.com" }
|
||||||
before do
|
before do
|
||||||
allow(Bundler.rubygems.configuration).to receive(:[]).with(:http_proxy).and_return(proxy)
|
allow(Gem.configuration).to receive(:[]).with(:http_proxy).and_return(proxy)
|
||||||
end
|
end
|
||||||
it "consider Gem.configuration when determine proxy" do
|
it "consider Gem.configuration when determine proxy" do
|
||||||
expect(fetcher.http_proxy).to match("http://proxy-example2.com")
|
expect(fetcher.http_proxy).to match("http://proxy-example2.com")
|
||||||
|
@ -113,7 +113,7 @@ RSpec.describe Bundler::Fetcher do
|
||||||
|
|
||||||
context "when gem ssl configuration is set" do
|
context "when gem ssl configuration is set" do
|
||||||
before do
|
before do
|
||||||
allow(Bundler.rubygems.configuration).to receive_messages(
|
allow(Gem.configuration).to receive_messages(
|
||||||
:http_proxy => nil,
|
:http_proxy => nil,
|
||||||
:ssl_client_cert => "cert",
|
:ssl_client_cert => "cert",
|
||||||
:ssl_ca_cert => "ca"
|
:ssl_ca_cert => "ca"
|
||||||
|
|
|
@ -34,13 +34,6 @@ RSpec.describe Bundler::RubygemsIntegration do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#configuration" do
|
|
||||||
it "handles Gem::SystemExitException errors" do
|
|
||||||
allow(Gem).to receive(:configuration) { raise Gem::SystemExitException.new(1) }
|
|
||||||
expect { Bundler.rubygems.configuration }.to raise_error(Gem::SystemExitException)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#download_gem" do
|
describe "#download_gem" do
|
||||||
let(:bundler_retry) { double(Bundler::Retry) }
|
let(:bundler_retry) { double(Bundler::Retry) }
|
||||||
let(:uri) { Bundler::URI.parse("https://foo.bar") }
|
let(:uri) { Bundler::URI.parse("https://foo.bar") }
|
||||||
|
@ -54,7 +47,7 @@ RSpec.describe Bundler::RubygemsIntegration do
|
||||||
|
|
||||||
it "successfully downloads gem with retries" do
|
it "successfully downloads gem with retries" do
|
||||||
expect(Bundler.rubygems).to receive(:gem_remote_fetcher).and_return(fetcher)
|
expect(Bundler.rubygems).to receive(:gem_remote_fetcher).and_return(fetcher)
|
||||||
expect(fetcher).to receive(:headers=).with("X-Gemfile-Source" => "https://foo.bar")
|
expect(fetcher).to receive(:headers=).with({ "X-Gemfile-Source" => "https://foo.bar" })
|
||||||
expect(Bundler::Retry).to receive(:new).with("download gem from #{uri}/").
|
expect(Bundler::Retry).to receive(:new).with("download gem from #{uri}/").
|
||||||
and_return(bundler_retry)
|
and_return(bundler_retry)
|
||||||
expect(bundler_retry).to receive(:attempts).and_yield
|
expect(bundler_retry).to receive(:attempts).and_yield
|
||||||
|
@ -76,7 +69,7 @@ RSpec.describe Bundler::RubygemsIntegration do
|
||||||
|
|
||||||
it "sets the 'X-Gemfile-Source' header containing the original source" do
|
it "sets the 'X-Gemfile-Source' header containing the original source" do
|
||||||
expect(Bundler.rubygems).to receive(:gem_remote_fetcher).twice.and_return(fetcher)
|
expect(Bundler.rubygems).to receive(:gem_remote_fetcher).twice.and_return(fetcher)
|
||||||
expect(fetcher).to receive(:headers=).with("X-Gemfile-Source" => "http://zombo.com").twice
|
expect(fetcher).to receive(:headers=).with({ "X-Gemfile-Source" => "http://zombo.com" }).twice
|
||||||
expect(fetcher).to receive(:fetch_path).with(uri + "specs.4.8.gz").and_return(specs_response)
|
expect(fetcher).to receive(:fetch_path).with(uri + "specs.4.8.gz").and_return(specs_response)
|
||||||
expect(fetcher).to receive(:fetch_path).with(uri + "prerelease_specs.4.8.gz").and_return(prerelease_specs_response)
|
expect(fetcher).to receive(:fetch_path).with(uri + "prerelease_specs.4.8.gz").and_return(prerelease_specs_response)
|
||||||
result = Bundler.rubygems.fetch_all_remote_specs(remote_with_mirror)
|
result = Bundler.rubygems.fetch_all_remote_specs(remote_with_mirror)
|
||||||
|
|
|
@ -638,7 +638,12 @@ RSpec.describe "bundle clean" do
|
||||||
s.executables = "irb"
|
s.executables = "irb"
|
||||||
end
|
end
|
||||||
|
|
||||||
realworld_system_gems "fiddle --version 1.0.8", "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1"
|
if Gem.win_platform? && RUBY_VERSION < "3.1.0"
|
||||||
|
default_fiddle_version = ruby "require 'fiddle'; puts Gem.loaded_specs['fiddle'].version"
|
||||||
|
realworld_system_gems "fiddle --version #{default_fiddle_version}"
|
||||||
|
end
|
||||||
|
|
||||||
|
realworld_system_gems "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1"
|
||||||
|
|
||||||
install_gemfile <<-G
|
install_gemfile <<-G
|
||||||
source "#{file_uri_for(gem_repo2)}"
|
source "#{file_uri_for(gem_repo2)}"
|
||||||
|
|
|
@ -43,6 +43,12 @@ RSpec.describe ".bundle/config" do
|
||||||
G
|
G
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "is local by default" do
|
||||||
|
bundle "config set foo bar"
|
||||||
|
expect(bundled_app(".bundle/config")).to exist
|
||||||
|
expect(home(".bundle/config")).not_to exist
|
||||||
|
end
|
||||||
|
|
||||||
it "can be moved with an environment variable" do
|
it "can be moved with an environment variable" do
|
||||||
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
|
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
|
||||||
bundle "config set --local path vendor/bundle"
|
bundle "config set --local path vendor/bundle"
|
||||||
|
@ -67,6 +73,12 @@ RSpec.describe ".bundle/config" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "location without a gemfile" do
|
describe "location without a gemfile" do
|
||||||
|
it "is global by default" do
|
||||||
|
bundle "config set foo bar"
|
||||||
|
expect(bundled_app(".bundle/config")).not_to exist
|
||||||
|
expect(home(".bundle/config")).to exist
|
||||||
|
end
|
||||||
|
|
||||||
it "works with an absolute path" do
|
it "works with an absolute path" do
|
||||||
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
|
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
|
||||||
bundle "config set --local path vendor/bundle"
|
bundle "config set --local path vendor/bundle"
|
||||||
|
@ -359,7 +371,7 @@ E
|
||||||
|
|
||||||
it "doesn't return quotes around values" do
|
it "doesn't return quotes around values" do
|
||||||
bundle "config set foo '1'"
|
bundle "config set foo '1'"
|
||||||
run "puts Bundler.settings.send(:global_config_file).read"
|
run "puts Bundler.settings.send(:local_config_file).read"
|
||||||
expect(out).to include('"1"')
|
expect(out).to include('"1"')
|
||||||
run "puts Bundler.settings[:foo]"
|
run "puts Bundler.settings[:foo]"
|
||||||
expect(out).to eq("1")
|
expect(out).to eq("1")
|
||||||
|
|
|
@ -291,7 +291,7 @@ RSpec.describe "bundle exec" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
bundle "config set path.system true"
|
bundle "config set --global path.system true"
|
||||||
|
|
||||||
install_gemfile <<-G
|
install_gemfile <<-G
|
||||||
source "#{file_uri_for(gem_repo1)}"
|
source "#{file_uri_for(gem_repo1)}"
|
||||||
|
@ -775,9 +775,7 @@ RSpec.describe "bundle exec" do
|
||||||
end
|
end
|
||||||
let(:expected_err) { "" }
|
let(:expected_err) { "" }
|
||||||
let(:exit_code) do
|
let(:exit_code) do
|
||||||
# signal mask 128 + plus signal 15 -> TERM
|
exit_status_for_signal(Signal.list["TERM"])
|
||||||
# this is specified by C99
|
|
||||||
128 + 15
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "runs" do
|
it "runs" do
|
||||||
|
|
|
@ -21,6 +21,7 @@ RSpec.describe "bundle info" do
|
||||||
source "#{file_uri_for(gem_repo2)}"
|
source "#{file_uri_for(gem_repo2)}"
|
||||||
gem "rails"
|
gem "rails"
|
||||||
gem "has_metadata"
|
gem "has_metadata"
|
||||||
|
gem "thin"
|
||||||
G
|
G
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -123,6 +124,30 @@ RSpec.describe "bundle info" do
|
||||||
expect(out).to_not include("Homepage:")
|
expect(out).to_not include("Homepage:")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when gem has a reverse dependency on any version" do
|
||||||
|
it "prints the details" do
|
||||||
|
bundle "info rack"
|
||||||
|
|
||||||
|
expect(out).to include("Reverse Dependencies: \n\t\tthin (1.0) depends on rack (>= 0)")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when gem has a reverse dependency on a specific version" do
|
||||||
|
it "prints the details" do
|
||||||
|
bundle "info actionpack"
|
||||||
|
|
||||||
|
expect(out).to include("Reverse Dependencies: \n\t\trails (2.3.2) depends on actionpack (= 2.3.2)")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when gem has no reverse dependencies" do
|
||||||
|
it "excludes the reverse dependencies field from the output" do
|
||||||
|
bundle "info rails"
|
||||||
|
|
||||||
|
expect(out).not_to include("Reverse Dependencies:")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a git repo in the Gemfile" do
|
context "with a git repo in the Gemfile" do
|
||||||
|
|
|
@ -99,7 +99,7 @@ Usage: "bundle inject GEM VERSION"
|
||||||
|
|
||||||
it "restores frozen afterwards" do
|
it "restores frozen afterwards" do
|
||||||
bundle "inject 'rack-obama' '> 0'"
|
bundle "inject 'rack-obama' '> 0'"
|
||||||
config = YAML.load(bundled_app(".bundle/config").read)
|
config = Psych.load(bundled_app(".bundle/config").read)
|
||||||
expect(config["BUNDLE_DEPLOYMENT"] || config["BUNDLE_FROZEN"]).to eq("true")
|
expect(config["BUNDLE_DEPLOYMENT"] || config["BUNDLE_FROZEN"]).to eq("true")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -157,9 +157,9 @@ RSpec.describe "bundle lock" do
|
||||||
gem "rack_middleware", :group => "test"
|
gem "rack_middleware", :group => "test"
|
||||||
G
|
G
|
||||||
bundle "config set without test"
|
bundle "config set without test"
|
||||||
bundle "config set path .bundle"
|
bundle "config set path vendor/bundle"
|
||||||
bundle "lock"
|
bundle "lock"
|
||||||
expect(bundled_app(".bundle")).not_to exist
|
expect(bundled_app("vendor/bundle")).not_to exist
|
||||||
end
|
end
|
||||||
|
|
||||||
# see update_spec for more coverage on same options. logic is shared so it's not necessary
|
# see update_spec for more coverage on same options. logic is shared so it's not necessary
|
||||||
|
@ -510,6 +510,11 @@ RSpec.describe "bundle lock" do
|
||||||
s.platform = "x64-mingw32"
|
s.platform = "x64-mingw32"
|
||||||
s.required_ruby_version = "< #{next_minor}.dev"
|
s.required_ruby_version = "< #{next_minor}.dev"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
build_gem "raygun-apm", "1.0.78" do |s|
|
||||||
|
s.platform = "x64-mingw-ucrt"
|
||||||
|
s.required_ruby_version = "< #{next_minor}.dev"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
gemfile <<-G
|
gemfile <<-G
|
||||||
|
|
|
@ -91,17 +91,8 @@ RSpec.describe "bundle install with groups" do
|
||||||
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
|
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "respects global `without` configuration, and saves it locally", :bundler => "< 3" do
|
it "respects global `without` configuration, but does not save it locally" do
|
||||||
bundle "config set without emo"
|
bundle "config set --global without emo"
|
||||||
bundle :install
|
|
||||||
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
|
|
||||||
bundle "config list"
|
|
||||||
expect(out).to include("Set for your local app (#{bundled_app(".bundle/config")}): [:emo]")
|
|
||||||
expect(out).to include("Set for the current user (#{home(".bundle/config")}): [:emo]")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "respects global `without` configuration, but does not save it locally", :bundler => "3" do
|
|
||||||
bundle "config set without emo"
|
|
||||||
bundle :install
|
bundle :install
|
||||||
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
|
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
|
||||||
bundle "config list"
|
bundle "config list"
|
||||||
|
|
|
@ -113,10 +113,16 @@ RSpec.shared_examples "bundle install --standalone" do
|
||||||
skip "does not work on rubygems versions where `--install_dir` doesn't respect --default" unless Gem::Installer.for_spec(loaded_gemspec, :install_dir => "/foo").default_spec_file == "/foo/specifications/default/bundler-#{Bundler::VERSION}.gemspec" # Since rubygems 3.2.0.rc.2
|
skip "does not work on rubygems versions where `--install_dir` doesn't respect --default" unless Gem::Installer.for_spec(loaded_gemspec, :install_dir => "/foo").default_spec_file == "/foo/specifications/default/bundler-#{Bundler::VERSION}.gemspec" # Since rubygems 3.2.0.rc.2
|
||||||
skip "does not work on old rubies because the realworld gems that need to be installed don't support them" if RUBY_VERSION < "2.7.0"
|
skip "does not work on old rubies because the realworld gems that need to be installed don't support them" if RUBY_VERSION < "2.7.0"
|
||||||
|
|
||||||
realworld_system_gems "fiddle --version 1.0.8", "tsort --version 0.1.0"
|
if Gem.win_platform? && RUBY_VERSION < "3.1.0"
|
||||||
|
default_fiddle_version = ruby "require 'fiddle'; puts Gem.loaded_specs['fiddle'].version"
|
||||||
|
realworld_system_gems "fiddle --version #{default_fiddle_version}"
|
||||||
|
end
|
||||||
|
|
||||||
necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "yaml --version 0.1.1", "logger --version 1.4.3", "etc --version 1.2.0", "stringio --version 3.0.0"]
|
realworld_system_gems "tsort --version 0.1.0"
|
||||||
|
|
||||||
|
necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "logger --version 1.4.3", "etc --version 1.2.0", "stringio --version 3.0.0"]
|
||||||
necessary_system_gems += ["shellwords --version 0.1.0", "base64 --version 0.1.0", "resolv --version 0.2.1"] if Gem.rubygems_version < Gem::Version.new("3.3.a")
|
necessary_system_gems += ["shellwords --version 0.1.0", "base64 --version 0.1.0", "resolv --version 0.2.1"] if Gem.rubygems_version < Gem::Version.new("3.3.a")
|
||||||
|
necessary_system_gems += ["yaml --version 0.1.1"] if Gem.rubygems_version < Gem::Version.new("3.4.a")
|
||||||
realworld_system_gems(*necessary_system_gems, :path => scoped_gem_path(bundled_app("bundle")))
|
realworld_system_gems(*necessary_system_gems, :path => scoped_gem_path(bundled_app("bundle")))
|
||||||
|
|
||||||
build_gem "foo", "1.0.0", :to_system => true, :default => true do |s|
|
build_gem "foo", "1.0.0", :to_system => true, :default => true do |s|
|
||||||
|
|
|
@ -46,7 +46,7 @@ RSpec.describe "parallel", :realworld => true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "works with --standalone" do
|
it "works with --standalone" do
|
||||||
gemfile <<-G, :standalone => true
|
gemfile <<-G
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
gem "diff-lcs"
|
gem "diff-lcs"
|
||||||
G
|
G
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "bundler/psyched_yaml"
|
require "psych"
|
||||||
require "bundler/vendored_fileutils"
|
require "bundler/vendored_fileutils"
|
||||||
require "bundler/vendored_uri"
|
require "bundler/vendored_uri"
|
||||||
require "digest"
|
require "digest"
|
||||||
|
|
|
@ -199,7 +199,7 @@ module Spec
|
||||||
command_execution.exitstatus = if status.exited?
|
command_execution.exitstatus = if status.exited?
|
||||||
status.exitstatus
|
status.exitstatus
|
||||||
elsif status.signaled?
|
elsif status.signaled?
|
||||||
128 + status.termsig
|
exit_status_for_signal(status.termsig)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ module Spec
|
||||||
end
|
end
|
||||||
|
|
||||||
def config(config = nil, path = bundled_app(".bundle/config"))
|
def config(config = nil, path = bundled_app(".bundle/config"))
|
||||||
return YAML.load_file(path) unless config
|
return Psych.load_file(path) unless config
|
||||||
FileUtils.mkdir_p(File.dirname(path))
|
FileUtils.mkdir_p(File.dirname(path))
|
||||||
File.open(path, "w") do |f|
|
File.open(path, "w") do |f|
|
||||||
f.puts config.to_yaml
|
f.puts config.to_yaml
|
||||||
|
@ -237,33 +237,31 @@ module Spec
|
||||||
config(config, home(".bundle/config"))
|
config(config, home(".bundle/config"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_file(*args)
|
def create_file(path, contents = "")
|
||||||
path = bundled_app(args.shift)
|
path = Pathname.new(path).expand_path(bundled_app) unless path.is_a?(Pathname)
|
||||||
path = args.shift if args.first.is_a?(Pathname)
|
|
||||||
str = args.shift || ""
|
|
||||||
path.dirname.mkpath
|
path.dirname.mkpath
|
||||||
File.open(path.to_s, "w") do |f|
|
File.open(path.to_s, "w") do |f|
|
||||||
f.puts strip_whitespace(str)
|
f.puts strip_whitespace(contents)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def gemfile(*args)
|
def gemfile(*args)
|
||||||
contents = args.shift
|
contents = args.pop
|
||||||
|
|
||||||
if contents.nil?
|
if contents.nil?
|
||||||
File.open(bundled_app_gemfile, "r", &:read)
|
File.open(bundled_app_gemfile, "r", &:read)
|
||||||
else
|
else
|
||||||
create_file("Gemfile", contents, *args)
|
create_file(args.pop || "Gemfile", contents)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def lockfile(*args)
|
def lockfile(*args)
|
||||||
contents = args.shift
|
contents = args.pop
|
||||||
|
|
||||||
if contents.nil?
|
if contents.nil?
|
||||||
File.open(bundled_app_lock, "r", &:read)
|
File.open(bundled_app_lock, "r", &:read)
|
||||||
else
|
else
|
||||||
create_file("Gemfile.lock", contents, *args)
|
create_file(args.pop || "Gemfile.lock", contents)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -274,8 +272,8 @@ module Spec
|
||||||
end
|
end
|
||||||
|
|
||||||
def install_gemfile(*args)
|
def install_gemfile(*args)
|
||||||
|
opts = args.last.is_a?(Hash) ? args.pop : {}
|
||||||
gemfile(*args)
|
gemfile(*args)
|
||||||
opts = args.last.is_a?(Hash) ? args.last : {}
|
|
||||||
bundle :install, opts
|
bundle :install, opts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -560,6 +558,11 @@ module Spec
|
||||||
port
|
port
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def exit_status_for_signal(signal_number)
|
||||||
|
# For details see: https://en.wikipedia.org/wiki/Exit_status#Shell_and_scripts
|
||||||
|
128 + signal_number
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def git_root_dir?
|
def git_root_dir?
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Spec
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_gemfile
|
def test_gemfile
|
||||||
@test_gemfile ||= source_root.join("tool/bundler/test_gems.rb")
|
@test_gemfile ||= tool_dir.join("test_gems.rb")
|
||||||
end
|
end
|
||||||
|
|
||||||
def rubocop_gemfile
|
def rubocop_gemfile
|
||||||
|
@ -42,7 +42,7 @@ module Spec
|
||||||
end
|
end
|
||||||
|
|
||||||
def dev_gemfile
|
def dev_gemfile
|
||||||
@dev_gemfile ||= git_root.join("dev_gems.rb")
|
@dev_gemfile ||= tool_dir.join("dev_gems.rb")
|
||||||
end
|
end
|
||||||
|
|
||||||
def bindir
|
def bindir
|
||||||
|
@ -294,7 +294,7 @@ module Spec
|
||||||
else
|
else
|
||||||
"rubocop_gems"
|
"rubocop_gems"
|
||||||
end
|
end
|
||||||
source_root.join("tool/bundler/#{filename}.rb")
|
tool_dir.join("#{filename}.rb")
|
||||||
end
|
end
|
||||||
|
|
||||||
def standard_gemfile_basename
|
def standard_gemfile_basename
|
||||||
|
@ -305,7 +305,11 @@ module Spec
|
||||||
else
|
else
|
||||||
"standard_gems"
|
"standard_gems"
|
||||||
end
|
end
|
||||||
source_root.join("tool/bundler/#{filename}.rb")
|
tool_dir.join("#{filename}.rb")
|
||||||
|
end
|
||||||
|
|
||||||
|
def tool_dir
|
||||||
|
source_root.join("tool/bundler")
|
||||||
end
|
end
|
||||||
|
|
||||||
extend self
|
extend self
|
||||||
|
|
|
@ -14,6 +14,7 @@ GEM
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
power_assert (2.0.1)
|
power_assert (2.0.1)
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
|
rake (13.0.6)
|
||||||
rdiscount (2.2.0.2)
|
rdiscount (2.2.0.2)
|
||||||
rdoc (6.2.0)
|
rdoc (6.2.0)
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
|
@ -26,7 +27,7 @@ GEM
|
||||||
rspec-expectations (3.10.1)
|
rspec-expectations (3.10.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.10.0)
|
rspec-support (~> 3.10.0)
|
||||||
rspec-mocks (3.10.2)
|
rspec-mocks (3.10.3)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.10.0)
|
rspec-support (~> 3.10.0)
|
||||||
rspec-support (3.10.3)
|
rspec-support (3.10.3)
|
||||||
|
@ -58,6 +59,7 @@ PLATFORMS
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
parallel (= 1.19.2)
|
parallel (= 1.19.2)
|
||||||
parallel_tests (~> 2.29)
|
parallel_tests (~> 2.29)
|
||||||
|
rake (~> 13.0)
|
||||||
rdoc (= 6.2.0)
|
rdoc (= 6.2.0)
|
||||||
ronn (~> 0.7.3)
|
ronn (~> 0.7.3)
|
||||||
rspec-core (~> 3.8)
|
rspec-core (~> 3.8)
|
||||||
|
@ -70,4 +72,4 @@ DEPENDENCIES
|
||||||
webrick (~> 1.6)
|
webrick (~> 1.6)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.3.6
|
2.3.7
|
||||||
|
|
|
@ -60,4 +60,4 @@ DEPENDENCIES
|
||||||
test-unit
|
test-unit
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.3.6
|
2.3.7
|
||||||
|
|
|
@ -66,4 +66,4 @@ DEPENDENCIES
|
||||||
test-unit
|
test-unit
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.3.6
|
2.3.7
|
||||||
|
|
|
@ -41,4 +41,4 @@ DEPENDENCIES
|
||||||
webrick (= 1.7.0)
|
webrick (= 1.7.0)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.3.6
|
2.3.7
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue