зеркало из https://github.com/github/ruby.git
Родитель
84fdaaab46
Коммит
f3bda8987e
|
@ -656,25 +656,16 @@ module Bundler
|
|||
end
|
||||
|
||||
def converge_dependencies
|
||||
frozen = Bundler.frozen_bundle?
|
||||
(@dependencies + locked_dependencies).each do |dep|
|
||||
locked_source = @locked_deps[dep.name]
|
||||
# This is to make sure that if bundler is installing in deployment mode and
|
||||
# after locked_source and sources don't match, we still use locked_source.
|
||||
if frozen && !locked_source.nil? &&
|
||||
locked_source.respond_to?(:source) && locked_source.source.instance_of?(Source::Path) && locked_source.source.path.exist?
|
||||
dep.source = locked_source.source
|
||||
elsif dep.source
|
||||
if dep.source
|
||||
dep.source = sources.get(dep.source)
|
||||
end
|
||||
end
|
||||
|
||||
changes = false
|
||||
# We want to know if all match, but don't want to check all entries
|
||||
# This means we need to return false if any dependency doesn't match
|
||||
# the lock or doesn't exist in the lock.
|
||||
@dependencies.each do |dependency|
|
||||
unless locked_dep = @locked_deps[dependency.name]
|
||||
|
||||
@dependencies.each do |dep|
|
||||
unless locked_dep = @locked_deps[dep.name]
|
||||
changes = true
|
||||
next
|
||||
end
|
||||
|
@ -685,11 +676,11 @@ module Bundler
|
|||
# directive, the lockfile dependencies and resolved dependencies end up
|
||||
# with a mismatch on #type. Work around that by setting the type on the
|
||||
# dep from the lockfile.
|
||||
locked_dep.instance_variable_set(:@type, dependency.type)
|
||||
locked_dep.instance_variable_set(:@type, dep.type)
|
||||
|
||||
# We already know the name matches from the hash lookup
|
||||
# so we only need to check the requirement now
|
||||
changes ||= dependency.requirement != locked_dep.requirement
|
||||
changes ||= dep.requirement != locked_dep.requirement
|
||||
end
|
||||
|
||||
changes
|
||||
|
@ -706,20 +697,8 @@ module Bundler
|
|||
# the gem in the Gemfile.lock still satisfies it, this is fine
|
||||
# too.
|
||||
@dependencies.each do |dep|
|
||||
locked_dep = @locked_deps[dep.name]
|
||||
|
||||
# If the locked_dep doesn't match the dependency we're looking for then we ignore the locked_dep
|
||||
locked_dep = nil unless locked_dep == dep
|
||||
|
||||
if in_locked_deps?(dep, locked_dep) || satisfies_locked_spec?(dep)
|
||||
if satisfies_locked_spec?(dep)
|
||||
deps << dep
|
||||
elsif dep.source.is_a?(Source::Path) && dep.current_platform? && (!locked_dep || dep.source != locked_dep.source)
|
||||
@locked_specs.each do |s|
|
||||
@unlock[:gems] << s.name if s.source == dep.source
|
||||
end
|
||||
|
||||
dep.source.unlock! if dep.source.respond_to?(:unlock!)
|
||||
dep.source.specs.each {|s| @unlock[:gems] << s.name }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -760,7 +739,11 @@ module Bundler
|
|||
s.dependencies.replace(new_spec.dependencies)
|
||||
end
|
||||
|
||||
converged << s
|
||||
if dep.nil? && @dependencies.find {|d| s.name == d.name }
|
||||
@unlock[:gems] << s.name
|
||||
else
|
||||
converged << s
|
||||
end
|
||||
end
|
||||
|
||||
resolve = SpecSet.new(converged)
|
||||
|
@ -780,13 +763,6 @@ module Bundler
|
|||
resolve
|
||||
end
|
||||
|
||||
def in_locked_deps?(dep, locked_dep)
|
||||
# Because the lockfile can't link a dep to a specific remote, we need to
|
||||
# treat sources as equivalent anytime the locked dep has all the remotes
|
||||
# that the Gemfile dep does.
|
||||
locked_dep && locked_dep.source && dep.source && locked_dep.source.include?(dep.source)
|
||||
end
|
||||
|
||||
def satisfies_locked_spec?(dep)
|
||||
@locked_specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require 'optparse'
|
||||
require_relative 'optparse'
|
||||
require_relative 'requirement'
|
||||
require_relative 'user_interaction'
|
||||
|
||||
|
@ -19,7 +19,7 @@ require_relative 'user_interaction'
|
|||
class Gem::Command
|
||||
include Gem::UserInteraction
|
||||
|
||||
OptionParser.accept Symbol do |value|
|
||||
Gem::OptionParser.accept Symbol do |value|
|
||||
value.to_sym
|
||||
end
|
||||
|
||||
|
@ -344,7 +344,7 @@ class Gem::Command
|
|||
##
|
||||
# Add a command-line option and handler to the command.
|
||||
#
|
||||
# See OptionParser#make_switch for an explanation of +opts+.
|
||||
# See Gem::OptionParser#make_switch for an explanation of +opts+.
|
||||
#
|
||||
# +handler+ will be called with two values, the value of the argument and
|
||||
# the options hash.
|
||||
|
@ -540,7 +540,7 @@ class Gem::Command
|
|||
# command.
|
||||
|
||||
def create_option_parser
|
||||
@parser = OptionParser.new
|
||||
@parser = Gem::OptionParser.new
|
||||
|
||||
add_parser_options
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class Gem::Commands::CertCommand < Gem::Command
|
|||
add_option('-s', '--sign CERT',
|
||||
'Signs CERT with the key from -K',
|
||||
'and the certificate from -C') do |cert_file, options|
|
||||
raise OptionParser::InvalidArgument, "#{cert_file}: does not exist" unless
|
||||
raise Gem::OptionParser::InvalidArgument, "#{cert_file}: does not exist" unless
|
||||
File.file? cert_file
|
||||
|
||||
options[:sign] << cert_file
|
||||
|
@ -85,9 +85,9 @@ class Gem::Commands::CertCommand < Gem::Command
|
|||
check_openssl
|
||||
OpenSSL::X509::Certificate.new File.read certificate_file
|
||||
rescue Errno::ENOENT
|
||||
raise OptionParser::InvalidArgument, "#{certificate_file}: does not exist"
|
||||
raise Gem::OptionParser::InvalidArgument, "#{certificate_file}: does not exist"
|
||||
rescue OpenSSL::X509::CertificateError
|
||||
raise OptionParser::InvalidArgument,
|
||||
raise Gem::OptionParser::InvalidArgument,
|
||||
"#{certificate_file}: invalid X509 certificate"
|
||||
end
|
||||
|
||||
|
@ -95,13 +95,13 @@ class Gem::Commands::CertCommand < Gem::Command
|
|||
check_openssl
|
||||
passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
|
||||
key = OpenSSL::PKey.read File.read(key_file), passphrase
|
||||
raise OptionParser::InvalidArgument,
|
||||
raise Gem::OptionParser::InvalidArgument,
|
||||
"#{key_file}: private key not found" unless key.private?
|
||||
key
|
||||
rescue Errno::ENOENT
|
||||
raise OptionParser::InvalidArgument, "#{key_file}: does not exist"
|
||||
raise Gem::OptionParser::InvalidArgument, "#{key_file}: does not exist"
|
||||
rescue OpenSSL::PKey::PKeyError, ArgumentError
|
||||
raise OptionParser::InvalidArgument, "#{key_file}: invalid RSA, DSA, or EC key"
|
||||
raise Gem::OptionParser::InvalidArgument, "#{key_file}: invalid RSA, DSA, or EC key"
|
||||
end
|
||||
|
||||
def execute
|
||||
|
|
|
@ -623,10 +623,6 @@ abort "#{deprecation_message}"
|
|||
destdir = options[:destdir]
|
||||
return path if destdir.empty?
|
||||
|
||||
prepend_destdir(path)
|
||||
end
|
||||
|
||||
def prepend_destdir(path)
|
||||
File.join(options[:destdir], path.gsub(/^[a-zA-Z]:/, ''))
|
||||
end
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ class Gem::Commands::UninstallCommand < Gem::Command
|
|||
'Uninstall gem from the vendor directory.',
|
||||
'Only for use by gem repackagers.') do |value, options|
|
||||
unless Gem.vendor_dir
|
||||
raise OptionParser::InvalidOption.new 'your platform is not supported'
|
||||
raise Gem::OptionParser::InvalidOption.new 'your platform is not supported'
|
||||
end
|
||||
|
||||
alert_warning 'Use your OS package manager to uninstall vendor gems'
|
||||
|
|
|
@ -29,7 +29,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
|
|||
|
||||
add_install_update_options
|
||||
|
||||
OptionParser.accept Gem::Version do |value|
|
||||
Gem::OptionParser.accept Gem::Version do |value|
|
||||
Gem::Version.new value
|
||||
|
||||
value
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
|
||||
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
|
||||
def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd)
|
||||
unless File.exist?(File.join(cmake_dir, 'Makefile'))
|
||||
require_relative '../command'
|
||||
cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args]
|
||||
|
||||
run cmd, results, class_name, cmake_dir
|
||||
|
|
|
@ -51,7 +51,7 @@ module Gem::InstallUpdateOptions
|
|||
'Install gem into the vendor directory.',
|
||||
'Only for use by gem repackagers.') do |value, options|
|
||||
unless Gem.vendor_dir
|
||||
raise OptionParser::InvalidOption.new 'your platform is not supported'
|
||||
raise Gem::OptionParser::InvalidOption.new 'your platform is not supported'
|
||||
end
|
||||
|
||||
options[:vendor] = true
|
||||
|
@ -143,7 +143,7 @@ module Gem::InstallUpdateOptions
|
|||
unless v
|
||||
message = v ? v : "(tried #{Gem::GEM_DEP_FILES.join ', '})"
|
||||
|
||||
raise OptionParser::InvalidArgument,
|
||||
raise Gem::OptionParser::InvalidArgument,
|
||||
"cannot find gem dependencies file #{message}"
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require_relative 'command'
|
||||
require_relative 'installer_uninstaller_utils'
|
||||
require_relative 'exceptions'
|
||||
require_relative 'deprecate'
|
||||
|
@ -71,6 +70,23 @@ class Gem::Installer
|
|||
@install_lock = Thread::Mutex.new
|
||||
|
||||
class << self
|
||||
#
|
||||
# Changes in rubygems to lazily loading `rubygems/command` (in order to
|
||||
# lazily load `optparse` as a side effect) affect bundler's custom installer
|
||||
# which uses `Gem::Command` without requiring it (up until bundler 2.2.29).
|
||||
# This hook is to compensate for that missing require.
|
||||
#
|
||||
# TODO: Remove when rubygems no longer supports running on bundler older
|
||||
# than 2.2.29.
|
||||
|
||||
def inherited(klass)
|
||||
if klass.name == "Bundler::RubyGemsGemInstaller"
|
||||
require "rubygems/command"
|
||||
end
|
||||
|
||||
super(klass)
|
||||
end
|
||||
|
||||
##
|
||||
# True if we've warned about PATH not including Gem.bindir
|
||||
|
||||
|
@ -676,7 +692,7 @@ class Gem::Installer
|
|||
@development = options[:development]
|
||||
@build_root = options[:build_root]
|
||||
|
||||
@build_args = options[:build_args] || Gem::Command.build_args
|
||||
@build_args = options[:build_args]
|
||||
|
||||
unless @build_root.nil?
|
||||
@bin_dir = File.join(@build_root, @bin_dir.gsub(/^[a-zA-Z]:/, ''))
|
||||
|
@ -832,7 +848,7 @@ TEXT
|
|||
# configure scripts and rakefiles or mkrf_conf files.
|
||||
|
||||
def build_extensions
|
||||
builder = Gem::Ext::Builder.new spec, @build_args
|
||||
builder = Gem::Ext::Builder.new spec, build_args
|
||||
|
||||
builder.build_extensions
|
||||
end
|
||||
|
@ -919,7 +935,7 @@ TEXT
|
|||
# extensions.
|
||||
|
||||
def write_build_info_file
|
||||
return if @build_args.empty?
|
||||
return if build_args.empty?
|
||||
|
||||
build_info_dir = File.join gem_home, 'build_info'
|
||||
|
||||
|
@ -929,7 +945,7 @@ TEXT
|
|||
build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
|
||||
|
||||
File.open build_info_file, 'w' do |io|
|
||||
@build_args.each do |arg|
|
||||
build_args.each do |arg|
|
||||
io.puts arg
|
||||
end
|
||||
end
|
||||
|
@ -954,4 +970,13 @@ TEXT
|
|||
|
||||
raise Gem::FilePermissionError.new(dir) unless File.writable? dir
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def build_args
|
||||
@build_args ||= begin
|
||||
require_relative "command"
|
||||
Gem::Command.build_args
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,14 +14,14 @@ require_relative '../rubygems'
|
|||
module Gem::LocalRemoteOptions
|
||||
|
||||
##
|
||||
# Allows OptionParser to handle HTTP URIs.
|
||||
# Allows Gem::OptionParser to handle HTTP URIs.
|
||||
|
||||
def accept_uri_http
|
||||
OptionParser.accept URI::HTTP do |value|
|
||||
Gem::OptionParser.accept URI::HTTP do |value|
|
||||
begin
|
||||
uri = URI.parse value
|
||||
rescue URI::InvalidURIError
|
||||
raise OptionParser::InvalidArgument, value
|
||||
raise Gem::OptionParser::InvalidArgument, value
|
||||
end
|
||||
|
||||
valid_uri_schemes = ["http", "https", "file", "s3"]
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'optparse/lib/optparse'
|
|
@ -0,0 +1,2 @@
|
|||
# frozen_string_literal: false
|
||||
require_relative 'optparse'
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,54 @@
|
|||
# frozen_string_literal: false
|
||||
require 'rubygems/optparse/lib/optparse'
|
||||
|
||||
class Gem::OptionParser::AC < Gem::OptionParser
|
||||
private
|
||||
|
||||
def _check_ac_args(name, block)
|
||||
unless /\A\w[-\w]*\z/ =~ name
|
||||
raise ArgumentError, name
|
||||
end
|
||||
unless block
|
||||
raise ArgumentError, "no block given", ParseError.filter_backtrace(caller)
|
||||
end
|
||||
end
|
||||
|
||||
ARG_CONV = proc {|val| val.nil? ? true : val}
|
||||
|
||||
def _ac_arg_enable(prefix, name, help_string, block)
|
||||
_check_ac_args(name, block)
|
||||
|
||||
sdesc = []
|
||||
ldesc = ["--#{prefix}-#{name}"]
|
||||
desc = [help_string]
|
||||
q = name.downcase
|
||||
ac_block = proc {|val| block.call(ARG_CONV.call(val))}
|
||||
enable = Switch::PlacedArgument.new(nil, ARG_CONV, sdesc, ldesc, nil, desc, ac_block)
|
||||
disable = Switch::NoArgument.new(nil, proc {false}, sdesc, ldesc, nil, desc, ac_block)
|
||||
top.append(enable, [], ["enable-" + q], disable, ['disable-' + q])
|
||||
enable
|
||||
end
|
||||
|
||||
public
|
||||
|
||||
def ac_arg_enable(name, help_string, &block)
|
||||
_ac_arg_enable("enable", name, help_string, block)
|
||||
end
|
||||
|
||||
def ac_arg_disable(name, help_string, &block)
|
||||
_ac_arg_enable("disable", name, help_string, block)
|
||||
end
|
||||
|
||||
def ac_arg_with(name, help_string, &block)
|
||||
_check_ac_args(name, block)
|
||||
|
||||
sdesc = []
|
||||
ldesc = ["--with-#{name}"]
|
||||
desc = [help_string]
|
||||
q = name.downcase
|
||||
with = Switch::PlacedArgument.new(*search(:atype, String), sdesc, ldesc, nil, desc, block)
|
||||
without = Switch::NoArgument.new(nil, proc {}, sdesc, ldesc, nil, desc, block)
|
||||
top.append(with, [], ["with-" + q], without, ['without-' + q])
|
||||
with
|
||||
end
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: false
|
||||
require 'rubygems/optparse/lib/optparse'
|
||||
require 'date'
|
||||
|
||||
Gem::OptionParser.accept(DateTime) do |s,|
|
||||
begin
|
||||
DateTime.parse(s) if s
|
||||
rescue ArgumentError
|
||||
raise Gem::OptionParser::InvalidArgument, s
|
||||
end
|
||||
end
|
||||
Gem::OptionParser.accept(Date) do |s,|
|
||||
begin
|
||||
Date.parse(s) if s
|
||||
rescue ArgumentError
|
||||
raise Gem::OptionParser::InvalidArgument, s
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
require 'rubygems/optparse/lib/optparse'
|
||||
|
||||
class Gem::OptionParser
|
||||
# :call-seq:
|
||||
# define_by_keywords(options, method, **params)
|
||||
#
|
||||
# :include: ../../doc/optparse/creates_option.rdoc
|
||||
#
|
||||
def define_by_keywords(options, meth, **opts)
|
||||
meth.parameters.each do |type, name|
|
||||
case type
|
||||
when :key, :keyreq
|
||||
op, cl = *(type == :key ? %w"[ ]" : ["", ""])
|
||||
define("--#{name}=#{op}#{name.upcase}#{cl}", *opts[name]) do |o|
|
||||
options[name] = o
|
||||
end
|
||||
end
|
||||
end
|
||||
options
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: false
|
||||
# -*- ruby -*-
|
||||
|
||||
require 'shellwords'
|
||||
require 'rubygems/optparse/lib/optparse'
|
||||
|
||||
Gem::OptionParser.accept(Shellwords) {|s,| Shellwords.shellwords(s)}
|
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: false
|
||||
require 'rubygems/optparse/lib/optparse'
|
||||
require 'time'
|
||||
|
||||
Gem::OptionParser.accept(Time) do |s,|
|
||||
begin
|
||||
(Time.httpdate(s) rescue Time.parse(s)) if s
|
||||
rescue
|
||||
raise Gem::OptionParser::InvalidArgument, s
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: false
|
||||
# -*- ruby -*-
|
||||
|
||||
require 'rubygems/optparse/lib/optparse'
|
||||
require 'uri'
|
||||
|
||||
Gem::OptionParser.accept(URI) {|s,| URI.parse(s) if s}
|
|
@ -0,0 +1,71 @@
|
|||
# frozen_string_literal: false
|
||||
# Gem::OptionParser internal utility
|
||||
|
||||
class << Gem::OptionParser
|
||||
def show_version(*pkgs)
|
||||
progname = ARGV.options.program_name
|
||||
result = false
|
||||
show = proc do |klass, cname, version|
|
||||
str = "#{progname}"
|
||||
unless klass == ::Object and cname == :VERSION
|
||||
version = version.join(".") if Array === version
|
||||
str << ": #{klass}" unless klass == Object
|
||||
str << " version #{version}"
|
||||
end
|
||||
[:Release, :RELEASE].find do |rel|
|
||||
if klass.const_defined?(rel)
|
||||
str << " (#{klass.const_get(rel)})"
|
||||
end
|
||||
end
|
||||
puts str
|
||||
result = true
|
||||
end
|
||||
if pkgs.size == 1 and pkgs[0] == "all"
|
||||
self.search_const(::Object, /\AV(?:ERSION|ersion)\z/) do |klass, cname, version|
|
||||
unless cname[1] == ?e and klass.const_defined?(:Version)
|
||||
show.call(klass, cname.intern, version)
|
||||
end
|
||||
end
|
||||
else
|
||||
pkgs.each do |pkg|
|
||||
begin
|
||||
pkg = pkg.split(/::|\//).inject(::Object) {|m, c| m.const_get(c)}
|
||||
v = case
|
||||
when pkg.const_defined?(:Version)
|
||||
pkg.const_get(n = :Version)
|
||||
when pkg.const_defined?(:VERSION)
|
||||
pkg.const_get(n = :VERSION)
|
||||
else
|
||||
n = nil
|
||||
"unknown"
|
||||
end
|
||||
show.call(pkg, n, v)
|
||||
rescue NameError
|
||||
end
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
def each_const(path, base = ::Object)
|
||||
path.split(/::|\//).inject(base) do |klass, name|
|
||||
raise NameError, path unless Module === klass
|
||||
klass.constants.grep(/#{name}/i) do |c|
|
||||
klass.const_defined?(c) or next
|
||||
klass.const_get(c)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def search_const(klass, name)
|
||||
klasses = [klass]
|
||||
while klass = klasses.shift
|
||||
klass.constants.each do |cname|
|
||||
klass.const_defined?(cname) or next
|
||||
const = klass.const_get(cname)
|
||||
yield klass, cname, const if name === cname
|
||||
klasses << const if Module === const and const != ::Object
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -19,16 +19,16 @@ end
|
|||
|
||||
module Gem::SecurityOption
|
||||
def add_security_option
|
||||
OptionParser.accept Gem::Security::Policy do |value|
|
||||
Gem::OptionParser.accept Gem::Security::Policy do |value|
|
||||
require_relative 'security'
|
||||
|
||||
raise OptionParser::InvalidArgument, 'OpenSSL not installed' unless
|
||||
raise Gem::OptionParser::InvalidArgument, 'OpenSSL not installed' unless
|
||||
defined?(Gem::Security::HighSecurity)
|
||||
|
||||
policy = Gem::Security::Policies[value]
|
||||
unless policy
|
||||
valid = Gem::Security::Policies.keys.sort
|
||||
raise OptionParser::InvalidArgument, "#{value} (#{valid.join ', '} are valid)"
|
||||
raise Gem::OptionParser::InvalidArgument, "#{value} (#{valid.join ', '} are valid)"
|
||||
end
|
||||
policy
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ module Gem::VersionOption
|
|||
# Add the --platform option to the option parser.
|
||||
|
||||
def add_platform_option(task = command, *wrap)
|
||||
OptionParser.accept Gem::Platform do |value|
|
||||
Gem::OptionParser.accept Gem::Platform do |value|
|
||||
if value == Gem::Platform::RUBY
|
||||
value
|
||||
else
|
||||
|
@ -51,7 +51,7 @@ module Gem::VersionOption
|
|||
# Add the --version option to the option parser.
|
||||
|
||||
def add_version_option(task = command, *wrap)
|
||||
OptionParser.accept Gem::Requirement do |value|
|
||||
Gem::OptionParser.accept Gem::Requirement do |value|
|
||||
Gem::Requirement.new(*value.split(/\s*,\s*/))
|
||||
end
|
||||
|
||||
|
|
|
@ -612,6 +612,36 @@ RSpec.describe "bundle exec" do
|
|||
expect(out).to include("Installing foo 1.0")
|
||||
end
|
||||
|
||||
it "loads the correct optparse when `auto_install` is set, and optparse is a dependency" do
|
||||
if Gem.ruby_version >= Gem::Version.new("3.0.0") && Gem.rubygems_version < Gem::Version.new("3.3.0.a")
|
||||
skip "optparse is a default gem, and rubygems loads install during install"
|
||||
end
|
||||
|
||||
build_repo4 do
|
||||
build_gem "fastlane", "2.192.0" do |s|
|
||||
s.executables = "fastlane"
|
||||
s.add_dependency "optparse", "~> 0.1.1"
|
||||
end
|
||||
|
||||
build_gem "optparse", "0.1.0"
|
||||
build_gem "optparse", "0.1.1"
|
||||
end
|
||||
|
||||
system_gems "optparse-0.1.0", :gem_repo => gem_repo4
|
||||
|
||||
bundle "config set auto_install 1"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
|
||||
gemfile <<~G
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
gem "fastlane"
|
||||
G
|
||||
|
||||
bundle "exec fastlane"
|
||||
expect(out).to include("Installing optparse 0.1.1")
|
||||
expect(out).to include("2.192.0")
|
||||
end
|
||||
|
||||
describe "with gems bundled via :path with invalid gemspecs" do
|
||||
it "outputs the gemspec validation errors" do
|
||||
build_lib "foo"
|
||||
|
|
|
@ -229,14 +229,27 @@ RSpec.describe "bundle flex_install" do
|
|||
G
|
||||
end
|
||||
|
||||
it "does something" do
|
||||
expect do
|
||||
bundle "install", :raise_on_error => false
|
||||
end.not_to change { File.read(bundled_app_lock) }
|
||||
it "should work when you install" do
|
||||
bundle "install"
|
||||
|
||||
expect(err).to include("rack = 0.9.1")
|
||||
expect(err).to include("locked at 1.0.0")
|
||||
expect(err).to include("bundle update rack")
|
||||
expect(lockfile).to eq <<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo1)}/
|
||||
specs:
|
||||
rack (0.9.1)
|
||||
rack-obama (1.0)
|
||||
rack
|
||||
|
||||
PLATFORMS
|
||||
#{lockfile_platforms}
|
||||
|
||||
DEPENDENCIES
|
||||
rack (= 0.9.1)
|
||||
rack-obama
|
||||
|
||||
BUNDLED WITH
|
||||
#{Bundler::VERSION}
|
||||
L
|
||||
end
|
||||
|
||||
it "should work when you update" do
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
Proc-Type: 4,ENCRYPTED
|
||||
DEK-Info: DES-CBC,4E38D58B5A059DB6
|
||||
DEK-Info: AES-256-CBC,CB6FD0B173EF450C6EE21A01DD785C1D
|
||||
|
||||
IgWLfnHVnkErKkhysrUMoE0ubkRDtJXZv9KR02jGGFk/kGqWyTqPk08uzhwVNM+l
|
||||
eOk0qfPykkJM3KZgqTsD6xfA1D5WqFp5mLoFXVVTn9I3acSZsqOY0FweCipwdVpI
|
||||
x+9Fl+v62kIW06dOjyWLE1abed9hHiXesGGsD87/RJSywy4OBxOcrhR1fJLK4ElR
|
||||
ya0UzI7rWnmZMChjaZBssfzT1DR79/dARXhon2m5EiIJDjMpc8BKGYlQy5RHCHwA
|
||||
cnrhUTTvsggZbQtmLZ/yVx8FSJ273XpYR0pmwbw4j1R+zeXQRK5MroBnCfOGcYa7
|
||||
rmpERmDW3VAuxXR20SUAGdo1XOMTDe1uLbaotn6e56pXghIaYROTPS+HsuOkAZGY
|
||||
OYWEkUoyog4l4n+h/C1umFfTFGvKNATLgDugONFvTw/PLbjvl+sWMy2QfqH0MlNB
|
||||
DIUPxhEVCFD9oB4nfB86WDAmPp1DH9/IBet/21kbQ2eTIzakTdG3XiC+xzAQRu68
|
||||
EOCTbasFWGxlCix66gt4xWMLksEg8UhWSpjS3/HsifrKyNMB8sfUFYmZmOYMW4mf
|
||||
NuEtpBL3AdHNObN8nQ75HfehukzNpbYVRsLzWrVgtxvXHVpnvoCCpCvQBMHeRZxK
|
||||
6m028mhH1m6yYE/uGFiRKLrN7BK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0PnCa2xRyCGevytPG0rfNDgyaY33dPEo90mBLVcwLbzGiSGBHgFl
|
||||
pr8A/rqbnFpRO39NYbACeRFCqPpzyzfARCCcjcDoFrENdIaJui0fjlBkoV3B/KiK
|
||||
EVjDcgwt1HAtz8bV2YJ+OpQbhD7E90e2vTRMuXAH21Ygo32VOS0LRlCRc9ZyZW4z
|
||||
PTyO/6a+FbXZ1zhVJxu/0bmBERZ14WVmWq56oxQav8knpxYeYPgpEmIZnrHnJ1Ko
|
||||
UoXcc8Hy4NKtaBmDcaF8TCobNsRZTxO/htqpdyNsOrBSsnX2kP5D/O1l1vuVYi1/
|
||||
RYfUqL9dvGzvfsFuuDDjDlQ/fIA6pFzJV3fy4KJHlF1r33qaE/lNMdpKljBwvUII
|
||||
Vog4cGmzxssqK5q9kuogcuyeOuFODjBNW4qt0WylSi9bwwy3ZwaZLRqhngz6+tCV
|
||||
Jp45Gk881XiVe3aVU0l+4DmJJ9/5vwqjH5Vo/GJqFU6gzB+Zv/0plYeNkuE0Xo2z
|
||||
ecdxnGKVPl42q44lvczjDw2KX0ahxQrfrbcl48//zR295u9POzCL97d6zpioI2NR
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
|
|
@ -118,7 +118,7 @@ class TestGemCommand < Gem::TestCase
|
|||
use_ui @ui do
|
||||
@cmd.when_invoked { true }
|
||||
|
||||
ex = assert_raise OptionParser::InvalidOption do
|
||||
ex = assert_raise Gem::OptionParser::InvalidOption do
|
||||
@cmd.invoke('-zzz')
|
||||
end
|
||||
|
||||
|
|
|
@ -745,7 +745,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
|
||||
def test_handle_options_add_bad
|
||||
nonexistent = File.join @tempdir, 'nonexistent'
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
e = assert_raise Gem::OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--add #{nonexistent}]
|
||||
end
|
||||
|
||||
|
@ -755,7 +755,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
bad = File.join @tempdir, 'bad'
|
||||
FileUtils.touch bad
|
||||
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
e = assert_raise Gem::OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--add #{bad}]
|
||||
end
|
||||
|
||||
|
@ -765,7 +765,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
|
||||
def test_handle_options_certificate
|
||||
nonexistent = File.join @tempdir, 'nonexistent'
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
e = assert_raise Gem::OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--certificate #{nonexistent}]
|
||||
end
|
||||
|
||||
|
@ -775,7 +775,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
bad = File.join @tempdir, 'bad'
|
||||
FileUtils.touch bad
|
||||
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
e = assert_raise Gem::OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--certificate #{bad}]
|
||||
end
|
||||
|
||||
|
@ -786,7 +786,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
|
||||
def test_handle_options_key_bad
|
||||
nonexistent = File.join @tempdir, 'nonexistent'
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
e = assert_raise Gem::OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--private-key #{nonexistent}]
|
||||
end
|
||||
|
||||
|
@ -797,14 +797,14 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
bad = File.join @tempdir, 'bad'
|
||||
FileUtils.touch bad
|
||||
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
e = assert_raise Gem::OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--private-key #{bad}]
|
||||
end
|
||||
|
||||
assert_equal "invalid argument: --private-key #{bad}: invalid RSA, DSA, or EC key",
|
||||
e.message
|
||||
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
e = assert_raise Gem::OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--private-key #{PUBLIC_KEY_FILE}]
|
||||
end
|
||||
|
||||
|
@ -851,7 +851,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
|
||||
def test_handle_options_sign_nonexistent
|
||||
nonexistent = File.join @tempdir, 'nonexistent'
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
e = assert_raise Gem::OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[
|
||||
--private-key #{ALTERNATE_KEY_FILE}
|
||||
|
||||
|
|
|
@ -436,7 +436,7 @@ WARNING: Use your OS package manager to uninstall vendor gems
|
|||
|
||||
def test_handle_options_vendor_missing
|
||||
vendordir(nil) do
|
||||
e = assert_raise OptionParser::InvalidOption do
|
||||
e = assert_raise Gem::OptionParser::InvalidOption do
|
||||
@cmd.handle_options %w[--vendor]
|
||||
end
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
|
|||
|
||||
def test_handle_options_missing_argument
|
||||
%w[-v --version -p --platform].each do |option|
|
||||
assert_raise OptionParser::MissingArgument do
|
||||
assert_raise Gem::OptionParser::MissingArgument do
|
||||
@cmd.handle_options %W[a #{option}]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -104,7 +104,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|||
|
||||
@cmd.add_install_update_options
|
||||
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
e = assert_raise Gem::OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %w[-P UnknownSecurity]
|
||||
end
|
||||
assert_includes e.message, "UnknownSecurity"
|
||||
|
@ -169,7 +169,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|||
|
||||
def test_vendor_missing
|
||||
vendordir(nil) do
|
||||
e = assert_raise OptionParser::InvalidOption do
|
||||
e = assert_raise Gem::OptionParser::InvalidOption do
|
||||
@cmd.handle_options %w[--vendor]
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче