Merge RubyGems-3.3.16 and Bundler-2.3.16

This commit is contained in:
Hiroshi SHIBATA 2022-07-13 14:44:32 +09:00 committed by nagachika
parent b9f6a09bd2
commit a01f5ad1ec
66 changed files with 808 additions and 562 deletions

View file

@ -251,10 +251,8 @@ module Bundler
remembered_negative_flag_deprecation("no-deployment") remembered_negative_flag_deprecation("no-deployment")
require_relative "cli/install" require_relative "cli/install"
Bundler.settings.temporary(:no_install => false) do
Install.new(options.dup).run Install.new(options.dup).run
end end
end
map aliases_for("install") map aliases_for("install")
@ -299,10 +297,8 @@ module Bundler
def update(*gems) def update(*gems)
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require_relative "cli/update" require_relative "cli/update"
Bundler.settings.temporary(:no_install => false) do
Update.new(options, gems).run Update.new(options, gems).run
end end
end
desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem" desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
long_desc <<-D long_desc <<-D

View file

@ -14,7 +14,7 @@ module Bundler
Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"] Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
setup_cache_all setup_cache_all
install install unless Bundler.settings[:no_install]
# TODO: move cache contents here now that all bundles are locked # TODO: move cache contents here now that all bundles are locked
custom_path = Bundler.settings[:path] if options[:path] custom_path = Bundler.settings[:path] if options[:path]

View file

@ -161,8 +161,6 @@ module Bundler
Bundler.settings.set_command_option_if_given :no_prune, options["no-prune"] Bundler.settings.set_command_option_if_given :no_prune, options["no-prune"]
Bundler.settings.set_command_option_if_given :no_install, options["no-install"]
Bundler.settings.set_command_option_if_given :clean, options["clean"] Bundler.settings.set_command_option_if_given :clean, options["clean"]
normalize_groups if options[:without] || options[:with] normalize_groups if options[:without] || options[:with]

View file

@ -255,8 +255,7 @@ module Bundler
# #
# @return [SpecSet] resolved dependencies # @return [SpecSet] resolved dependencies
def resolve def resolve
@resolve ||= begin @resolve ||= if Bundler.frozen_bundle?
if Bundler.frozen_bundle?
Bundler.ui.debug "Frozen, using resolution from the lockfile" Bundler.ui.debug "Frozen, using resolution from the lockfile"
@locked_specs @locked_specs
elsif !unlocking? && nothing_changed? elsif !unlocking? && nothing_changed?
@ -270,7 +269,6 @@ module Bundler
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms) Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
end end
end end
end
def spec_git_paths def spec_git_paths
sources.git_sources.map {|s| File.realpath(s.path) if File.exist?(s.path) }.compact sources.git_sources.map {|s| File.realpath(s.path) if File.exist?(s.path) }.compact
@ -735,13 +733,11 @@ module Bundler
end end
def metadata_dependencies def metadata_dependencies
@metadata_dependencies ||= begin @metadata_dependencies ||= [
[
Dependency.new("Ruby\0", RubyVersion.system.gem_version), Dependency.new("Ruby\0", RubyVersion.system.gem_version),
Dependency.new("RubyGems\0", Gem::VERSION), Dependency.new("RubyGems\0", Gem::VERSION),
] ]
end end
end
def expand_dependencies(dependencies, remote = false) def expand_dependencies(dependencies, remote = false)
deps = [] deps = []

View file

@ -9,6 +9,7 @@ module Bundler
attr_reader :autorequire attr_reader :autorequire
attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref
# rubocop:disable Naming/VariableNumber
PLATFORM_MAP = { PLATFORM_MAP = {
:ruby => Gem::Platform::RUBY, :ruby => Gem::Platform::RUBY,
:ruby_18 => Gem::Platform::RUBY, :ruby_18 => Gem::Platform::RUBY,
@ -91,6 +92,7 @@ module Bundler
:x64_mingw_30 => Gem::Platform::X64_MINGW, :x64_mingw_30 => Gem::Platform::X64_MINGW,
:x64_mingw_31 => Gem::Platform::X64_MINGW, :x64_mingw_31 => Gem::Platform::X64_MINGW,
}.freeze }.freeze
# rubocop:enable Naming/VariableNumber
def initialize(name, version, options = {}, &blk) def initialize(name, version, options = {}, &blk)
type = options["type"] || :runtime type = options["type"] || :runtime

View file

@ -511,9 +511,7 @@ module Bundler
# be raised. # be raised.
# #
def contents def contents
@contents ||= begin @contents ||= dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
end
end end
# The message of the exception reports the content of podspec for the # The message of the exception reports the content of podspec for the

View file

@ -41,12 +41,14 @@ module Bundler
class GemspecError < BundlerError; status_code(14); end class GemspecError < BundlerError; status_code(14); end
class InvalidOption < BundlerError; status_code(15); end class InvalidOption < BundlerError; status_code(15); end
class ProductionError < BundlerError; status_code(16); end class ProductionError < BundlerError; status_code(16); end
class HTTPError < BundlerError class HTTPError < BundlerError
status_code(17) status_code(17)
def filter_uri(uri) def filter_uri(uri)
URICredentialsFilter.credential_filtered_uri(uri) URICredentialsFilter.credential_filtered_uri(uri)
end end
end end
class RubyVersionMismatch < BundlerError; status_code(18); end class RubyVersionMismatch < BundlerError; status_code(18); end
class SecurityError < BundlerError; status_code(19); end class SecurityError < BundlerError; status_code(19); end
class LockfileError < BundlerError; status_code(20); end class LockfileError < BundlerError; status_code(20); end

View file

@ -20,6 +20,7 @@ module Bundler
class TooManyRequestsError < HTTPError; end class TooManyRequestsError < HTTPError; end
# This error is raised if the API returns a 413 (only printed in verbose) # This error is raised if the API returns a 413 (only printed in verbose)
class FallbackError < HTTPError; end class FallbackError < HTTPError; end
# This is the error raised if OpenSSL fails the cert verification # This is the error raised if OpenSSL fails the cert verification
class CertificateFailureError < HTTPError class CertificateFailureError < HTTPError
def initialize(remote_uri) def initialize(remote_uri)
@ -33,6 +34,7 @@ module Bundler
" sources and change 'https' to 'http'." " sources and change 'https' to 'http'."
end end
end end
# This is the error raised when a source is HTTPS and OpenSSL didn't load # This is the error raised when a source is HTTPS and OpenSSL didn't load
class SSLError < HTTPError class SSLError < HTTPError
def initialize(msg = nil) def initialize(msg = nil)
@ -42,6 +44,7 @@ module Bundler
"using RVM are available at rvm.io/packages/openssl." "using RVM are available at rvm.io/packages/openssl."
end end
end end
# This error is raised if HTTP authentication is required, but not provided. # This error is raised if HTTP authentication is required, but not provided.
class AuthenticationRequiredError < HTTPError class AuthenticationRequiredError < HTTPError
def initialize(remote_uri) def initialize(remote_uri)
@ -52,6 +55,7 @@ module Bundler
"or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable" "or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
end end
end end
# This error is raised if HTTP authentication is provided, but incorrect. # This error is raised if HTTP authentication is provided, but incorrect.
class BadAuthenticationError < HTTPError class BadAuthenticationError < HTTPError
def initialize(remote_uri) def initialize(remote_uri)

View file

@ -19,8 +19,7 @@ module Bundler
end end
def fetch_uri def fetch_uri
@fetch_uri ||= begin @fetch_uri ||= if remote_uri.host == "rubygems.org"
if remote_uri.host == "rubygems.org"
uri = remote_uri.dup uri = remote_uri.dup
uri.host = "index.rubygems.org" uri.host = "index.rubygems.org"
uri uri
@ -28,7 +27,6 @@ module Bundler
remote_uri remote_uri
end end
end end
end
def available? def available?
true true

View file

@ -258,7 +258,7 @@ module Bundler
@dependencies |= Array(names) @dependencies |= Array(names)
end end
# Note: Do not override if you don't know what you are doing. # NOTE: Do not override if you don't know what you are doing.
def can_lock?(spec) def can_lock?(spec)
spec.source == self spec.source == self
end end
@ -285,7 +285,7 @@ module Bundler
end end
alias_method :identifier, :to_s alias_method :identifier, :to_s
# Note: Do not override if you don't know what you are doing. # NOTE: Do not override if you don't know what you are doing.
def include?(other) def include?(other)
other == self other == self
end end
@ -294,7 +294,7 @@ module Bundler
SharedHelpers.digest(:SHA1).hexdigest(uri) SharedHelpers.digest(:SHA1).hexdigest(uri)
end end
# Note: Do not override if you don't know what you are doing. # NOTE: Do not override if you don't know what you are doing.
def gem_install_dir def gem_install_dir
Bundler.install_path Bundler.install_path
end end

View file

@ -233,8 +233,7 @@ module Bundler
# before dependencies that are unconstrained # before dependencies that are unconstrained
def amount_constrained(dependency) def amount_constrained(dependency)
@amount_constrained ||= {} @amount_constrained ||= {}
@amount_constrained[dependency.name] ||= begin @amount_constrained[dependency.name] ||= if (base = @base[dependency.name]) && !base.empty?
if (base = @base[dependency.name]) && !base.empty?
dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1 dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
else else
all = index_for(dependency).search(dependency.name).size all = index_for(dependency).search(dependency.name).size
@ -248,7 +247,6 @@ module Bundler
end end
end end
end end
end
def verify_gemfile_dependencies_are_found!(requirements) def verify_gemfile_dependencies_are_found!(requirements)
requirements.map! do |requirement| requirements.map! do |requirement|

View file

@ -90,6 +90,14 @@ module Bundler
end end
end end
def spec
if Bundler.rubygems.provides?("< 3.3.12") # RubyGems implementation rescues and re-raises errors before 3.3.12 and we don't want that
@package.spec
else
super
end
end
private private
def strict_rm_rf(dir) def strict_rm_rf(dir)

View file

@ -203,20 +203,9 @@ module Bundler
EXT_LOCK EXT_LOCK
end end
def spec_from_gem(path, policy = nil) def spec_from_gem(path)
require "rubygems/security" require "rubygems/package"
require "psych" Gem::Package.new(path).spec
gem_from_path(path, security_policies[policy]).spec
rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
if e.is_a?(Gem::Security::Exception) ||
e.message =~ /unknown trust policy|unsigned gem/i ||
e.message =~ /couldn't verify (meta)?data signature/i
raise SecurityError,
"The gem #{File.basename(path, ".gem")} can't be installed because " \
"the security policy didn't allow it, with the message: #{e.message}"
else
raise e
end
end end
def build_gem(gem_dir, spec) def build_gem(gem_dir, spec)
@ -514,13 +503,6 @@ module Bundler
Gem::RemoteFetcher.new(proxy) Gem::RemoteFetcher.new(proxy)
end end
def gem_from_path(path, policy = nil)
require "rubygems/package"
p = Gem::Package.new(path)
p.security_policy = policy if policy
p
end
def build(spec, skip_validation = false) def build(spec, skip_validation = false)
require "rubygems/package" require "rubygems/package"
Gem::Package.build(spec, skip_validation) Gem::Package.build(spec, skip_validation)

View file

@ -219,14 +219,12 @@ module Bundler
# across different projects, this cache will be shared. # across different projects, this cache will be shared.
# When using local git repos, this is set to the local repo. # When using local git repos, this is set to the local repo.
def cache_path def cache_path
@cache_path ||= begin @cache_path ||= if Bundler.requires_sudo? || Bundler.feature_flag.global_gem_cache?
if Bundler.requires_sudo? || Bundler.feature_flag.global_gem_cache?
Bundler.user_cache Bundler.user_cache
else else
Bundler.bundle_path.join("cache", "bundler") Bundler.bundle_path.join("cache", "bundler")
end.join("git", git_scope) end.join("git", git_scope)
end end
end
def app_cache_dirname def app_cache_dirname
"#{base_name}-#{shortref_for_path(cached_revision || revision)}" "#{base_name}-#{shortref_for_path(cached_revision || revision)}"

View file

@ -139,13 +139,9 @@ module Bundler
force = options[:force] force = options[:force]
ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached] ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
if ensure_builtin_gems_cached && spec.default_gem? if ensure_builtin_gems_cached && spec.default_gem? && !cached_path(spec)
if !cached_path(spec)
cached_built_in_gem(spec) unless spec.remote cached_built_in_gem(spec) unless spec.remote
force = true force = true
else
spec.loaded_from = loaded_from(spec)
end
end end
if installed?(spec) && !force if installed?(spec) && !force
@ -153,32 +149,17 @@ module Bundler
return nil # no post-install message return nil # no post-install message
end end
# Download the gem to get the spec, because some specs that are returned
# by rubygems.org are broken and wrong.
if spec.remote if spec.remote
# Check for this spec from other sources # Check for this spec from other sources
uris = [spec.remote.anonymized_uri] uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).uniq
uris += remotes_for_spec(spec).map(&:anonymized_uri)
uris.uniq!
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1 Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
path = fetch_gem(spec, options[:previous_spec]) path = fetch_gem(spec, options[:previous_spec])
begin else
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
spec.__swap__(s)
rescue Gem::Package::FormatError
Bundler.rm_rf(path)
raise
end
end
unless Bundler.settings[:no_install]
message = "Installing #{version_message(spec, options[:previous_spec])}"
message += " with native extensions" if spec.extensions.any?
Bundler.ui.confirm message
path = cached_gem(spec) path = cached_gem(spec)
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
end
if requires_sudo? if requires_sudo?
install_path = Bundler.tmp(spec.full_name) install_path = Bundler.tmp(spec.full_name)
bin_path = install_path.join("bin") bin_path = install_path.join("bin")
@ -191,8 +172,9 @@ module Bundler
require_relative "../rubygems_gem_installer" require_relative "../rubygems_gem_installer"
installed_spec = Bundler::RubyGemsGemInstaller.at( installer = Bundler::RubyGemsGemInstaller.at(
path, path,
:security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
:install_dir => install_path.to_s, :install_dir => install_path.to_s,
:bin_dir => bin_path.to_s, :bin_dir => bin_path.to_s,
:ignore_dependencies => true, :ignore_dependencies => true,
@ -201,8 +183,31 @@ module Bundler
:build_args => options[:build_args], :build_args => options[:build_args],
:bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum, :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
:bundler_extension_cache_path => extension_cache_path(spec) :bundler_extension_cache_path => extension_cache_path(spec)
).install )
if spec.remote
s = begin
installer.spec
rescue Gem::Package::FormatError
Bundler.rm_rf(path)
raise
rescue Gem::Security::Exception => e
raise SecurityError,
"The gem #{File.basename(path, ".gem")} can't be installed because " \
"the security policy didn't allow it, with the message: #{e.message}"
end
spec.__swap__(s)
end
message = "Installing #{version_message(spec, options[:previous_spec])}"
message += " with native extensions" if spec.extensions.any?
Bundler.ui.confirm message
installed_spec = installer.install
spec.full_gem_path = installed_spec.full_gem_path spec.full_gem_path = installed_spec.full_gem_path
spec.loaded_from = installed_spec.loaded_from
# SUDO HAX # SUDO HAX
if requires_sudo? if requires_sudo?
@ -228,9 +233,6 @@ module Bundler
Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/" Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
end end
end end
installed_spec.loaded_from = loaded_from(spec)
end
spec.loaded_from = loaded_from(spec)
spec.post_install_message spec.post_install_message
ensure ensure
@ -348,10 +350,6 @@ module Bundler
end end
end end
def loaded_from(spec)
"#{rubygems_dir}/specifications/#{spec.full_name}.gemspec"
end
def cached_gem(spec) def cached_gem(spec)
if spec.default_gem? if spec.default_gem?
cached_built_in_gem(spec) cached_built_in_gem(spec)
@ -364,10 +362,14 @@ module Bundler
global_cache_path = download_cache_path(spec) global_cache_path = download_cache_path(spec)
@caches << global_cache_path if global_cache_path @caches << global_cache_path if global_cache_path
possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" } possibilities = @caches.map {|p| package_path(p, spec) }
possibilities.find {|p| File.exist?(p) } possibilities.find {|p| File.exist?(p) }
end end
def package_path(cache_path, spec)
"#{cache_path}/#{spec.file_name}"
end
def normalize_uri(uri) def normalize_uri(uri)
uri = uri.to_s uri = uri.to_s
uri = "#{uri}/" unless uri =~ %r{/$} uri = "#{uri}/" unless uri =~ %r{/$}
@ -459,12 +461,11 @@ module Bundler
end end
def fetch_gem(spec, previous_spec = nil) def fetch_gem(spec, previous_spec = nil)
return false unless spec.remote
spec.fetch_platform spec.fetch_platform
cache_path = download_cache_path(spec) || default_cache_path_for(rubygems_dir) cache_path = download_cache_path(spec) || default_cache_path_for(rubygems_dir)
gem_path = "#{cache_path}/#{spec.file_name}" gem_path = package_path(cache_path, spec)
return gem_path if File.exist?(gem_path)
if requires_sudo? if requires_sudo?
download_path = Bundler.tmp(spec.full_name) download_path = Bundler.tmp(spec.full_name)
@ -482,7 +483,7 @@ module Bundler
SharedHelpers.filesystem_access(cache_path) do |p| SharedHelpers.filesystem_access(cache_path) do |p|
Bundler.mkdir_p(p) Bundler.mkdir_p(p)
end end
Bundler.sudo "mv #{download_cache_path}/#{spec.file_name} #{gem_path}" Bundler.sudo "mv #{package_path(download_cache_path, spec)} #{gem_path}"
end end
gem_path gem_path

View file

@ -1,7 +1,7 @@
# frozen_string_literal: false # frozen_string_literal: false
module Bundler module Bundler
VERSION = "2.3.15".freeze VERSION = "2.3.16".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

View file

@ -8,7 +8,7 @@
require 'rbconfig' require 'rbconfig'
module Gem module Gem
VERSION = "3.3.15".freeze VERSION = "3.3.16".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
@ -607,7 +607,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
return if @yaml_loaded return if @yaml_loaded
require 'psych' require 'psych'
require_relative 'rubygems/psych_additions'
require_relative 'rubygems/psych_tree' require_relative 'rubygems/psych_tree'
require_relative 'rubygems/safe_yaml' require_relative 'rubygems/safe_yaml'

View file

@ -261,7 +261,7 @@ You can use `i` command instead of `install`.
return unless Gem::SourceFetchProblem === x return unless Gem::SourceFetchProblem === x
require_relative "../uri" require_relative "../uri"
msg = "Unable to pull data from '#{Gem::Uri.new(x.source.uri).redacted}': #{x.error.message}" msg = "Unable to pull data from '#{Gem::Uri.redact(x.source.uri)}': #{x.error.message}"
alert_warning msg alert_warning msg
end end

View file

@ -62,7 +62,7 @@ class Gem::Commands::SourcesCommand < Gem::Command
say "#{source_uri} is not a URI" say "#{source_uri} is not a URI"
terminate_interaction 1 terminate_interaction 1
rescue Gem::RemoteFetcher::FetchError => e rescue Gem::RemoteFetcher::FetchError => e
say "Error fetching #{source_uri}:\n\t#{e.message}" say "Error fetching #{Gem::Uri.redact(source.uri)}:\n\t#{e.message}"
terminate_interaction 1 terminate_interaction 1
end end
end end

View file

@ -18,7 +18,7 @@ module Kernel
end end
file = Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES ? "<internal:#{__FILE__}>" : __FILE__ file = Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES ? "<internal:#{__FILE__}>" : __FILE__
module_eval <<'RUBY', file, __LINE__ + 1 module_eval <<'RUBY', file, __LINE__ + 1 # rubocop:disable Style/EvalWithLocation
## ##
# When RubyGems is required, Kernel#require is replaced with our own which # When RubyGems is required, Kernel#require is replaced with our own which
# is capable of loading gems on demand. # is capable of loading gems on demand.

View file

@ -168,7 +168,7 @@ module Gem
# An English description of the error. # An English description of the error.
def wordy def wordy
"Unable to download data from #{Gem::Uri.new(@source.uri).redacted} - #{@error.message}" "Unable to download data from #{Gem::Uri.redact(@source.uri)} - #{@error.message}"
end end
## ##

View file

@ -48,7 +48,7 @@ class Gem::Ext::Builder
end end
end end
def self.run(command, results, command_name = nil, dir = Dir.pwd) def self.run(command, results, command_name = nil, dir = Dir.pwd, env = {})
verbose = Gem.configuration.really_verbose verbose = Gem.configuration.really_verbose
begin begin
@ -63,9 +63,9 @@ class Gem::Ext::Builder
require "open3" require "open3"
# Set $SOURCE_DATE_EPOCH for the subprocess. # Set $SOURCE_DATE_EPOCH for the subprocess.
env = {'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string} build_env = { 'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string }.merge(env)
output, status = begin output, status = begin
Open3.capture2e(env, *command, :chdir => dir) Open3.capture2e(build_env, *command, :chdir => dir)
rescue => error rescue => error
raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}" raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
end end

View file

@ -4,48 +4,67 @@
# over the `cargo rustc` command which takes care of building Rust code in a way # over the `cargo rustc` command which takes care of building Rust code in a way
# that Ruby can use. # that Ruby can use.
class Gem::Ext::CargoBuilder < Gem::Ext::Builder class Gem::Ext::CargoBuilder < Gem::Ext::Builder
attr_reader :spec attr_accessor :spec, :runner, :profile
def initialize(spec) def initialize(spec)
require_relative "../command"
require_relative "cargo_builder/link_flag_converter"
@spec = spec @spec = spec
@runner = self.class.method(:run)
@profile = :release
end end
def build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd) def build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd)
require "rubygems/command"
require "fileutils" require "fileutils"
require "shellwords" require "shellwords"
build_crate(dest_path, results, args, cargo_dir) build_crate(dest_path, results, args, cargo_dir)
ext_path = rename_cdylib_for_ruby_compatibility(dest_path) validate_cargo_build!(dest_path)
finalize_directory(ext_path, dest_path, lib_dir, cargo_dir) rename_cdylib_for_ruby_compatibility(dest_path)
finalize_directory(dest_path, lib_dir, cargo_dir)
results results
end end
private
def build_crate(dest_path, results, args, cargo_dir) def build_crate(dest_path, results, args, cargo_dir)
env = build_env
cmd = cargo_command(cargo_dir, dest_path, args)
runner.call cmd, results, 'cargo', cargo_dir, env
results
end
def build_env
build_env = rb_config_env
build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?('RUBY_STATIC')
build_env
end
def cargo_command(cargo_dir, dest_path, args = [])
manifest = File.join(cargo_dir, "Cargo.toml") manifest = File.join(cargo_dir, "Cargo.toml")
given_ruby_static = ENV["RUBY_STATIC"]
ENV["RUBY_STATIC"] = "true" if ruby_static? && !given_ruby_static
cargo = ENV.fetch("CARGO", "cargo") cargo = ENV.fetch("CARGO", "cargo")
cmd = [] cmd = []
cmd += [cargo, "rustc"] cmd += [cargo, "rustc"]
cmd += ["--target", ENV['CARGO_BUILD_TARGET']] if ENV['CARGO_BUILD_TARGET']
cmd += ["--target-dir", dest_path] cmd += ["--target-dir", dest_path]
cmd += ["--manifest-path", manifest] cmd += ["--manifest-path", manifest]
cmd += ["--lib", "--release", "--locked"] cmd += ["--lib"]
cmd += ["--"] cmd += ["--profile", profile.to_s]
cmd += [*cargo_rustc_args(dest_path)] cmd += ["--locked"] if profile == :release
cmd += Gem::Command.build_args cmd += Gem::Command.build_args
cmd += args cmd += args
cmd += ["--"]
cmd += [*cargo_rustc_args(dest_path)]
cmd
end
self.class.run cmd, results, self.class.class_name, cargo_dir private
results
ensure def rb_config_env
ENV["RUBY_STATIC"] = given_ruby_static result = {}
RbConfig::CONFIG.each {|k, v| result["RBCONFIG_#{k}"] = v }
result
end end
def cargo_rustc_args(dest_dir) def cargo_rustc_args(dest_dir)
@ -92,7 +111,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
def libruby_args(dest_dir) def libruby_args(dest_dir)
libs = makefile_config(ruby_static? ? "LIBRUBYARG_STATIC" : "LIBRUBYARG_SHARED") libs = makefile_config(ruby_static? ? "LIBRUBYARG_STATIC" : "LIBRUBYARG_SHARED")
raw_libs = Shellwords.split(libs) raw_libs = Shellwords.split(libs)
raw_libs.flat_map {|l| ldflag_to_link_modifier(l, dest_dir) } raw_libs.flat_map {|l| ldflag_to_link_modifier(l) }
end end
def ruby_static? def ruby_static?
@ -103,22 +122,33 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
# Ruby expects the dylib to follow a file name convention for loading # Ruby expects the dylib to follow a file name convention for loading
def rename_cdylib_for_ruby_compatibility(dest_path) def rename_cdylib_for_ruby_compatibility(dest_path)
dylib_path = validate_cargo_build!(dest_path) new_path = final_extension_path(dest_path)
dlext_name = "#{spec.name}.#{makefile_config("DLEXT")}" FileUtils.cp(cargo_dylib_path(dest_path), new_path)
new_name = dylib_path.gsub(File.basename(dylib_path), dlext_name) new_path
FileUtils.cp(dylib_path, new_name)
new_name
end end
def validate_cargo_build!(dir) def validate_cargo_build!(dir)
prefix = so_ext == "dll" ? "" : "lib" dylib_path = cargo_dylib_path(dir)
dylib_path = File.join(dir, "release", "#{prefix}#{cargo_crate_name}.#{so_ext}")
raise DylibNotFoundError, dir unless File.exist?(dylib_path) raise DylibNotFoundError, dir unless File.exist?(dylib_path)
dylib_path dylib_path
end end
def final_extension_path(dest_path)
dylib_path = cargo_dylib_path(dest_path)
dlext_name = "#{spec.name}.#{makefile_config("DLEXT")}"
dylib_path.gsub(File.basename(dylib_path), dlext_name)
end
def cargo_dylib_path(dest_path)
prefix = so_ext == "dll" ? "" : "lib"
path_parts = [dest_path]
path_parts << ENV['CARGO_BUILD_TARGET'] if ENV['CARGO_BUILD_TARGET']
path_parts += [profile_target_directory, "#{prefix}#{cargo_crate_name}.#{so_ext}"]
File.join(*path_parts)
end
def cargo_crate_name def cargo_crate_name
spec.metadata.fetch('cargo_crate_name', spec.name).tr('-', '_') spec.metadata.fetch('cargo_crate_name', spec.name).tr('-', '_')
end end
@ -127,42 +157,19 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
split_flags("DLDFLAGS") split_flags("DLDFLAGS")
.map {|arg| maybe_resolve_ldflag_variable(arg, dest_dir) } .map {|arg| maybe_resolve_ldflag_variable(arg, dest_dir) }
.compact .compact
.flat_map {|arg| ldflag_to_link_modifier(arg, dest_dir) } .flat_map {|arg| ldflag_to_link_modifier(arg) }
end end
def rustc_lib_flags(dest_dir) def rustc_lib_flags(dest_dir)
split_flags("LIBS").flat_map {|arg| ldflag_to_link_modifier(arg, dest_dir) } split_flags("LIBS").flat_map {|arg| ldflag_to_link_modifier(arg) }
end end
def split_flags(var) def split_flags(var)
Shellwords.split(RbConfig::CONFIG.fetch(var, "")) Shellwords.split(RbConfig::CONFIG.fetch(var, ""))
end end
def ldflag_to_link_modifier(arg, dest_dir) def ldflag_to_link_modifier(arg)
flag = arg[0..1] LinkFlagConverter.convert(arg)
val = arg[2..-1]
case flag
when "-L" then ["-L", "native=#{val}"]
when "-l" then ["-l", val.to_s]
when "-F" then ["-l", "framework=#{val}"]
else ["-C", "link_arg=#{arg}"]
end
end
def link_flag(link_name)
# These are provided by the CRT with MSVC
# @see https://github.com/rust-lang/pkg-config-rs/blob/49a4ac189aafa365167c72e8e503565a7c2697c2/src/lib.rs#L622
return [] if msvc_target? && ["m", "c", "pthread"].include?(link_name)
if link_name.include?("ruby")
# Specify the lib kind and give it the name "ruby" for linking
kind = ruby_static? ? "static" : "dylib"
["-l", "#{kind}=ruby:#{link_name}"]
else
["-l", link_name]
end
end end
def msvc_target? def msvc_target?
@ -182,9 +189,16 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
!!Gem::WIN_PATTERNS.find {|r| target_platform =~ r } !!Gem::WIN_PATTERNS.find {|r| target_platform =~ r }
end end
# Intepolate substition vars in the arg (i.e. $(DEFFILE)) # Interpolate substition vars in the arg (i.e. $(DEFFILE))
def maybe_resolve_ldflag_variable(input_arg, dest_dir) def maybe_resolve_ldflag_variable(input_arg, dest_dir)
str = input_arg.gsub(/\$\((\w+)\)/) do |var_name| var_matches = input_arg.match(/\$\((\w+)\)/)
return input_arg unless var_matches
var_name = var_matches[1]
return input_arg if var_name.nil? || var_name.chomp.empty?
case var_name case var_name
# On windows, it is assumed that mkmf has setup an exports file for the # On windows, it is assumed that mkmf has setup an exports file for the
# extension, so we have to to create one ourselves. # extension, so we have to to create one ourselves.
@ -193,9 +207,6 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
else else
RbConfig::CONFIG[var_name] RbConfig::CONFIG[var_name]
end end
end.strip
str == "" ? nil : str
end end
def write_deffile(dest_dir) def write_deffile(dest_dir)
@ -241,14 +252,18 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
# Good balance between binary size and debugability # Good balance between binary size and debugability
def debug_flags def debug_flags
return [] if profile == :dev
["-C", "debuginfo=1"] ["-C", "debuginfo=1"]
end end
# Copied from ExtConfBuilder # Copied from ExtConfBuilder
def finalize_directory(ext_path, dest_path, lib_dir, extension_dir) def finalize_directory(dest_path, lib_dir, extension_dir)
require "fileutils" require "fileutils"
require "tempfile" require "tempfile"
ext_path = final_extension_path(dest_path)
begin begin
tmp_dest = Dir.mktmpdir(".gem.", extension_dir) tmp_dest = Dir.mktmpdir(".gem.", extension_dir)
@ -287,6 +302,14 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
path path
end end
def profile_target_directory
case profile
when :release then 'release'
when :dev then 'debug'
else raise "unknown target directory for profile: #{profile}"
end
end
# Error raised when no cdylib artifact was created # Error raised when no cdylib artifact was created
class DylibNotFoundError < StandardError class DylibNotFoundError < StandardError
def initialize(dir) def initialize(dir)

View file

@ -0,0 +1,23 @@
# frozen_string_literal: true
class Gem::Ext::CargoBuilder < Gem::Ext::Builder
# Converts Ruby link flags into something cargo understands
class LinkFlagConverter
def self.convert(arg)
case arg.chomp
when /^-L\s*(.+)$/
["-L", "native=#{$1}"]
when /^--library=(\w+\S+)$/, /^-l\s*(\w+\S+)$/
["-l", $1]
when /^-l\s*:lib(\S+).a$/
["-l", "static=#{$1}"]
when /^-l\s*:lib(\S+).(so|dylib|dll)$/
["-l", "dylib=#{$1}"]
when /^-F\s*(.*)$/
["-l", "framework=#{$1}"]
else
["-C", "link_arg=#{arg}"]
end
end
end
end

View file

@ -1,10 +0,0 @@
# frozen_string_literal: true
# This exists just to satisfy bugs in marshal'd gemspecs that
# contain a reference to Psych::PrivateType. We prune these out
# in Specification._load, but if we don't have the constant, Marshal
# blows up.
module Psych # :nodoc:
class PrivateType # :nodoc:
end
end

View file

@ -193,7 +193,7 @@ class Gem::Request
begin begin
@requests[connection.object_id] += 1 @requests[connection.object_id] += 1
verbose "#{request.method} #{Gem::Uri.new(@uri).redacted}" verbose "#{request.method} #{Gem::Uri.redact(@uri)}"
file_name = File.basename(@uri.path) file_name = File.basename(@uri.path)
# perform download progress reporter only for gems # perform download progress reporter only for gems

View file

@ -26,15 +26,8 @@ class Gem::Source
# Creates a new Source which will use the index located at +uri+. # Creates a new Source which will use the index located at +uri+.
def initialize(uri) def initialize(uri)
begin require_relative "uri"
unless uri.kind_of? URI @uri = Gem::Uri.parse!(uri)
uri = URI.parse(uri.to_s)
end
rescue URI::InvalidURIError
raise if Gem::Source == self.class
end
@uri = uri
@update_cache = nil @update_cache = nil
end end

View file

@ -49,8 +49,8 @@ class Gem::Source::Git < Gem::Source
# will be checked out when the gem is installed. # will be checked out when the gem is installed.
def initialize(name, repository, reference, submodules = false) def initialize(name, repository, reference, submodules = false)
super repository require_relative "../uri"
@uri = Gem::Uri.parse(repository)
@name = name @name = name
@repository = repository @repository = repository
@reference = reference @reference = reference

View file

@ -48,15 +48,11 @@ class Gem::SourceList
# String. # String.
def <<(obj) def <<(obj)
require "uri"
src = case obj src = case obj
when URI
Gem::Source.new(obj)
when Gem::Source when Gem::Source
obj obj
else else
Gem::Source.new(URI.parse(obj)) Gem::Source.new(obj)
end end
@sources << src unless @sources.include?(src) @sources << src unless @sources.include?(src)

View file

@ -1082,6 +1082,7 @@ class Gem::Specification < Gem::BasicSpecification
spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION
spec.reset_nil_attributes_to_default spec.reset_nil_attributes_to_default
spec.flatten_require_paths
spec spec
end end
@ -1273,10 +1274,26 @@ class Gem::Specification < Gem::BasicSpecification
array = begin array = begin
Marshal.load str Marshal.load str
rescue ArgumentError => e rescue ArgumentError => e
raise unless e.message.include?("YAML") #
# Some very old marshaled specs included references to `YAML::PrivateType`
# and `YAML::Syck::DefaultKey` constants due to bugs in the old emitter
# that generated them. Workaround the issue by defining the necessary
# constants and retrying.
#
message = e.message
raise unless message.include?("YAML::")
Object.const_set "YAML", Psych Object.const_set "YAML", Psych unless Object.const_defined?(:YAML)
Marshal.load str
if message.include?("YAML::Syck::")
YAML.const_set "Syck", YAML unless YAML.const_defined?(:Syck)
YAML::Syck.const_set "DefaultKey", Class.new if message.include?("YAML::Syck::DefaultKey")
elsif message.include?("YAML::PrivateType")
YAML.const_set "PrivateType", Class.new
end
retry
end end
spec = Gem::Specification.new spec = Gem::Specification.new
@ -2676,6 +2693,13 @@ class Gem::Specification < Gem::BasicSpecification
@installed_by_version ||= nil @installed_by_version ||= nil
end end
def flatten_require_paths # :nodoc:
return unless raw_require_paths.first.is_a?(Array)
warn "#{name} #{version} includes a gemspec with `require_paths` set to an array of arrays. Newer versions of this gem might've already fixed this"
raw_require_paths.flatten!
end
def raw_require_paths # :nodoc: def raw_require_paths # :nodoc:
@require_paths @require_paths
end end

View file

@ -5,6 +5,44 @@
# #
class Gem::Uri class Gem::Uri
##
# Parses and redacts uri
def self.redact(uri)
new(uri).redacted
end
##
# Parses uri, raising if it's invalid
def self.parse!(uri)
require "uri"
raise URI::InvalidURIError unless uri
return uri unless uri.is_a?(String)
# Always escape URI's to deal with potential spaces and such
# It should also be considered that source_uri may already be
# a valid URI with escaped characters. e.g. "{DESede}" is encoded
# as "%7BDESede%7D". If this is escaped again the percentage
# symbols will be escaped.
begin
URI.parse(uri)
rescue URI::InvalidURIError
URI.parse(URI::DEFAULT_PARSER.escape(uri))
end
end
##
# Parses uri, returning the original uri if it's invalid
def self.parse(uri)
parse!(uri)
rescue URI::InvalidURIError
uri
end
def initialize(source_uri) def initialize(source_uri)
@parsed_uri = parse(source_uri) @parsed_uri = parse(source_uri)
end end
@ -26,7 +64,7 @@ class Gem::Uri
end end
def redact_credentials_from(text) def redact_credentials_from(text)
return text unless valid_uri? && password? return text unless valid_uri? && password? && text.include?(to_s)
text.sub(password, 'REDACTED') text.sub(password, 'REDACTED')
end end
@ -50,35 +88,12 @@ class Gem::Uri
private private
##
# Parses the #uri, raising if it's invalid
def parse!(uri) def parse!(uri)
require "uri" self.class.parse!(uri)
raise URI::InvalidURIError unless uri
# Always escape URI's to deal with potential spaces and such
# It should also be considered that source_uri may already be
# a valid URI with escaped characters. e.g. "{DESede}" is encoded
# as "%7BDESede%7D". If this is escaped again the percentage
# symbols will be escaped.
begin
URI.parse(uri)
rescue URI::InvalidURIError
URI.parse(URI::DEFAULT_PARSER.escape(uri))
end end
end
##
# Parses the #uri, returning the original uri if it's invalid
def parse(uri) def parse(uri)
return uri unless uri.is_a?(String) self.class.parse(uri)
parse!(uri)
rescue URI::InvalidURIError
uri
end end
def with_redacted_user def with_redacted_user

View file

@ -137,6 +137,7 @@ RSpec.describe Bundler::Dsl do
end end
describe "#gem" do describe "#gem" do
# rubocop:disable Naming/VariableNumber
[:ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25, :ruby_26, :ruby_27, [:ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25, :ruby_26, :ruby_27,
:ruby_30, :ruby_31, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :mri_25, :mri_26, :ruby_30, :ruby_31, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :mri_25, :mri_26,
:mri_27, :mri_30, :mri_31, :jruby, :rbx, :truffleruby].each do |platform| :mri_27, :mri_30, :mri_31, :jruby, :rbx, :truffleruby].each do |platform|
@ -144,6 +145,7 @@ RSpec.describe Bundler::Dsl do
subject.gem("foo", :platform => platform) subject.gem("foo", :platform => platform)
end end
end end
# rubocop:enable Naming/VariableNumber
it "rejects invalid platforms" do it "rejects invalid platforms" do
expect { subject.gem("foo", :platform => :bogus) }. expect { subject.gem("foo", :platform => :bogus) }.

View file

@ -280,12 +280,12 @@ RSpec.describe Bundler::Plugin do
end end
Bundler::Plugin::Events.send(:reset) Bundler::Plugin::Events.send(:reset)
Bundler::Plugin::Events.send(:define, :EVENT_1, "event-1") Bundler::Plugin::Events.send(:define, :EVENT1, "event-1")
Bundler::Plugin::Events.send(:define, :EVENT_2, "event-2") Bundler::Plugin::Events.send(:define, :EVENT2, "event-2")
allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_1). allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT1).
and_return(["foo-plugin", "", nil]) and_return(["foo-plugin", "", nil])
allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_2). allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT2).
and_return(["foo-plugin"]) and_return(["foo-plugin"])
allow(index).to receive(:plugin_path).with("foo-plugin").and_return(path) allow(index).to receive(:plugin_path).with("foo-plugin").and_return(path)
allow(index).to receive(:load_paths).with("foo-plugin").and_return([]) allow(index).to receive(:load_paths).with("foo-plugin").and_return([])
@ -303,33 +303,33 @@ RSpec.describe Bundler::Plugin do
it "executes the hook" do it "executes the hook" do
expect do expect do
Plugin.hook(Bundler::Plugin::Events::EVENT_1) Plugin.hook(Bundler::Plugin::Events::EVENT1)
end.to output("hook for event 1\n").to_stdout end.to output("hook for event 1\n").to_stdout
end end
context "single plugin declaring more than one hook" do context "single plugin declaring more than one hook" do
let(:code) { <<-RUBY } let(:code) { <<-RUBY }
Bundler::Plugin::API.hook(Bundler::Plugin::Events::EVENT_1) {} Bundler::Plugin::API.hook(Bundler::Plugin::Events::EVENT1) {}
Bundler::Plugin::API.hook(Bundler::Plugin::Events::EVENT_2) {} Bundler::Plugin::API.hook(Bundler::Plugin::Events::EVENT2) {}
puts "loaded" puts "loaded"
RUBY RUBY
it "evals plugins.rb once" do it "evals plugins.rb once" do
expect do expect do
Plugin.hook(Bundler::Plugin::Events::EVENT_1) Plugin.hook(Bundler::Plugin::Events::EVENT1)
Plugin.hook(Bundler::Plugin::Events::EVENT_2) Plugin.hook(Bundler::Plugin::Events::EVENT2)
end.to output("loaded\n").to_stdout end.to output("loaded\n").to_stdout
end end
end end
context "a block is passed" do context "a block is passed" do
let(:code) { <<-RUBY } let(:code) { <<-RUBY }
Bundler::Plugin::API.hook(Bundler::Plugin::Events::EVENT_1) { |&blk| blk.call } Bundler::Plugin::API.hook(Bundler::Plugin::Events::EVENT1) { |&blk| blk.call }
RUBY RUBY
it "is passed to the hook" do it "is passed to the hook" do
expect do expect do
Plugin.hook(Bundler::Plugin::Events::EVENT_1) { puts "win" } Plugin.hook(Bundler::Plugin::Events::EVENT1) { puts "win" }
end.to output("win\n").to_stdout end.to output("win\n").to_stdout
end end
end end

View file

@ -466,11 +466,9 @@ RSpec.describe "bundle install with platform conditionals" do
it "does not attempt to install gems from other rubies when using --local" do it "does not attempt to install gems from other rubies when using --local" do
bundle "config set --local force_ruby_platform true" bundle "config set --local force_ruby_platform true"
other_ruby_version_tag = RUBY_VERSION =~ /^1\.8/ ? :ruby_19 : :ruby_18
gemfile <<-G gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "some_gem", platform: :#{other_ruby_version_tag} gem "some_gem", platform: :ruby_22
G G
bundle "install --local" bundle "install --local"

View file

@ -230,7 +230,6 @@ RSpec.describe "bundle flex_install" do
gem "jekyll-feed", "~> 0.12" gem "jekyll-feed", "~> 0.12"
G G
puts lockfile
lockfile <<-L lockfile <<-L
GEM GEM
remote: #{file_uri_for(gem_repo4)}/ remote: #{file_uri_for(gem_repo4)}/

View file

@ -196,7 +196,7 @@ RSpec.describe "real world edgecases", :realworld => true do
expect(lockfile).to include(rubygems_version("paperclip", "~> 5.1.0")) expect(lockfile).to include(rubygems_version("paperclip", "~> 5.1.0"))
end end
it "outputs a helpful error message when gems have invalid gemspecs" do it "outputs a helpful error message when gems have invalid gemspecs", :rubygems => "< 3.3.16" do
install_gemfile <<-G, :standalone => true, :raise_on_error => false, :env => { "BUNDLE_FORCE_RUBY_PLATFORM" => "1" } install_gemfile <<-G, :standalone => true, :raise_on_error => false, :env => { "BUNDLE_FORCE_RUBY_PLATFORM" => "1" }
source 'https://rubygems.org' source 'https://rubygems.org'
gem "resque-scheduler", "2.2.0" gem "resque-scheduler", "2.2.0"
@ -207,6 +207,16 @@ RSpec.describe "real world edgecases", :realworld => true do
expect(err).to include("resque-scheduler 2.2.0 has an invalid gemspec") expect(err).to include("resque-scheduler 2.2.0 has an invalid gemspec")
end end
it "outputs a helpful warning when gems have a gemspec with invalid `require_paths`", :rubygems => ">= 3.3.16" do
install_gemfile <<-G, :standalone => true, :env => { "BUNDLE_FORCE_RUBY_PLATFORM" => "1" }
source 'https://rubygems.org'
gem "resque-scheduler", "2.2.0"
gem "redis-namespace", "1.6.0" # for a consistent resolution including ruby 2.3.0
gem "ruby2_keywords", "0.0.5"
G
expect(err).to include("resque-scheduler 2.2.0 includes a gemspec with `require_paths` set to an array of arrays. Newer versions of this gem might've already fixed this").once
end
it "doesn't hang on big gemfile" do it "doesn't hang on big gemfile" do
skip "Only for ruby 2.7.3" if RUBY_VERSION != "2.7.3" || RUBY_PLATFORM =~ /darwin/ skip "Only for ruby 2.7.3" if RUBY_VERSION != "2.7.3" || RUBY_PLATFORM =~ /darwin/

View file

@ -17,6 +17,6 @@ RSpec.describe "bundle install with complex dependencies", :realworld => true do
duration = Time.now - start_time duration = Time.now - start_time
expect(duration.to_f).to be < 12 # seconds expect(duration.to_f).to be < 18 # seconds
end end
end end

Binary file not shown.

View file

@ -1191,7 +1191,7 @@ Also, a list:
# Is this test being run on a ruby/ruby repository? # Is this test being run on a ruby/ruby repository?
# #
def testing_ruby_repo? def ruby_repo?
!ENV["GEM_COMMAND"].nil? !ENV["GEM_COMMAND"].nil?
end end

View file

@ -202,6 +202,56 @@ Error fetching http://beta-gems.example.com:
assert_equal '', @ui.error assert_equal '', @ui.error
end end
def test_execute_add_existent_source_invalid_uri
spec_fetcher
uri = "https://u:p@example.com/specs.#{@marshal_version}.gz"
@cmd.handle_options %w[--add https://u:p@example.com]
@fetcher.data[uri] = proc do
raise Gem::RemoteFetcher::FetchError.new('it died', uri)
end
use_ui @ui do
assert_raise Gem::MockGemUi::TermError do
@cmd.execute
end
end
expected = <<-EOF
Error fetching https://u:REDACTED@example.com:
\tit died (https://u:REDACTED@example.com/specs.#{@marshal_version}.gz)
EOF
assert_equal expected, @ui.output
assert_equal '', @ui.error
end
def test_execute_add_existent_source_invalid_uri_with_error_by_chance_including_the_uri_password
spec_fetcher
uri = "https://u:secret@example.com/specs.#{@marshal_version}.gz"
@cmd.handle_options %w[--add https://u:secret@example.com]
@fetcher.data[uri] = proc do
raise Gem::RemoteFetcher::FetchError.new('it secretly died', uri)
end
use_ui @ui do
assert_raise Gem::MockGemUi::TermError do
@cmd.execute
end
end
expected = <<-EOF
Error fetching https://u:REDACTED@example.com:
\tit secretly died (https://u:REDACTED@example.com/specs.#{@marshal_version}.gz)
EOF
assert_equal expected, @ui.output
assert_equal '', @ui.error
end
def test_execute_add_redundant_source def test_execute_add_redundant_source
spec_fetcher spec_fetcher

View file

@ -1,4 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative 'helper' require_relative 'helper'
require 'rubygems/ext' require 'rubygems/ext'
@ -7,12 +8,9 @@ class TestGemExtCargoBuilder < Gem::TestCase
super super
@rust_envs = { @rust_envs = {
'CARGO_HOME' => File.join(@orig_env['HOME'], '.cargo'), 'CARGO_HOME' => ENV.fetch('CARGO_HOME', File.join(@orig_env['HOME'], '.cargo')),
'RUSTUP_HOME' => File.join(@orig_env['HOME'], '.rustup'), 'RUSTUP_HOME' => ENV.fetch('RUSTUP_HOME', File.join(@orig_env['HOME'], '.rustup')),
} }
system(@rust_envs, 'cargo', '-V', out: IO::NULL, err: [:child, :out])
pend 'cargo not present' unless $?.success?
end end
def setup_rust_gem(name) def setup_rust_gem(name)
@ -57,15 +55,35 @@ class TestGemExtCargoBuilder < Gem::TestCase
end end
output = output.join "\n" output = output.join "\n"
bundle = File.join(@dest_path, "release/rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}") bundle = File.join(@dest_path, "release/rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}")
require(bundle)
assert_match RustRubyExample.reverse('hello'), 'olleh'
assert_match "Compiling rust_ruby_example v0.1.0", output
assert_match "Finished release [optimized] target(s)", output assert_match "Finished release [optimized] target(s)", output
assert_ffi_handle bundle, 'Init_rust_ruby_example'
rescue Exception => e
pp output if output
raise(e)
end
def test_build_dev_profile
skip_unsupported_platforms!
setup_rust_gem "rust_ruby_example"
output = []
Dir.chdir @ext do
ENV.update(@rust_envs)
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
builder = Gem::Ext::CargoBuilder.new(spec)
builder.profile = :dev
builder.build nil, @dest_path, output
end
output = output.join "\n"
bundle = File.join(@dest_path, "debug/rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}")
assert_match "Finished dev [unoptimized + debuginfo] target(s)", output
assert_ffi_handle bundle, 'Init_rust_ruby_example'
rescue Exception => e rescue Exception => e
pp output if output pp output if output
@ -98,23 +116,25 @@ class TestGemExtCargoBuilder < Gem::TestCase
skip_unsupported_platforms! skip_unsupported_platforms!
setup_rust_gem "rust_ruby_example" setup_rust_gem "rust_ruby_example"
require 'open3'
Dir.chdir @ext do Dir.chdir @ext do
require 'tmpdir' require 'tmpdir'
gem = [@rust_envs, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)] env_for_subprocess = @rust_envs.merge("GEM_HOME" => Gem.paths.home)
gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)]
Dir.mktmpdir("rust_ruby_example") do |dir| Dir.mktmpdir("rust_ruby_example") do |dir|
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem")) built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
Open3.capture2e(*gem, "build", "rust_ruby_example.gemspec", "--output", built_gem) Open3.capture2e(*gem, "build", "rust_ruby_example.gemspec", "--output", built_gem)
Open3.capture2e(*gem, "install", "--verbose", "--local", built_gem, *ARGV) Open3.capture2e(*gem, "install", "--verbose", "--local", built_gem, *ARGV)
end
stdout_and_stderr_str, status = Open3.capture2e(@rust_envs, *ruby_with_rubygems_in_load_path, "-rrust_ruby_example", "-e", "puts 'Result: ' + RustRubyExample.reverse('hello world')")
stdout_and_stderr_str, status = Open3.capture2e(env_for_subprocess, *ruby_with_rubygems_in_load_path, "-rrust_ruby_example", "-e", "puts 'Result: ' + RustRubyExample.reverse('hello world')")
assert status.success?, stdout_and_stderr_str assert status.success?, stdout_and_stderr_str
assert_match "Result: #{"hello world".reverse}", stdout_and_stderr_str assert_match "Result: #{"hello world".reverse}", stdout_and_stderr_str
end end
end end
end
def test_custom_name def test_custom_name
skip_unsupported_platforms! skip_unsupported_platforms!
@ -123,7 +143,8 @@ class TestGemExtCargoBuilder < Gem::TestCase
Dir.chdir @ext do Dir.chdir @ext do
require 'tmpdir' require 'tmpdir'
gem = [@rust_envs, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)] env_for_subprocess = @rust_envs.merge("GEM_HOME" => Gem.paths.home)
gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)]
Dir.mktmpdir("custom_name") do |dir| Dir.mktmpdir("custom_name") do |dir|
built_gem = File.expand_path(File.join(dir, "custom_name.gem")) built_gem = File.expand_path(File.join(dir, "custom_name.gem"))
@ -131,17 +152,27 @@ class TestGemExtCargoBuilder < Gem::TestCase
Open3.capture2e(*gem, "install", "--verbose", "--local", built_gem, *ARGV) Open3.capture2e(*gem, "install", "--verbose", "--local", built_gem, *ARGV)
end end
stdout_and_stderr_str, status = Open3.capture2e(@rust_envs, *ruby_with_rubygems_in_load_path, "-rcustom_name", "-e", "puts 'Result: ' + CustomName.say_hello") stdout_and_stderr_str, status = Open3.capture2e(env_for_subprocess, *ruby_with_rubygems_in_load_path, "-rcustom_name", "-e", "puts 'Result: ' + CustomName.say_hello")
assert status.success?, stdout_and_stderr_str assert status.success?, stdout_and_stderr_str
assert_match "Result: Hello world!", stdout_and_stderr_str assert_match "Result: Hello world!", stdout_and_stderr_str
end end
end end
private
def skip_unsupported_platforms! def skip_unsupported_platforms!
pend "jruby not supported" if java_platform? pend "jruby not supported" if java_platform?
pend "truffleruby not supported (yet)" if RUBY_ENGINE == 'truffleruby' pend "truffleruby not supported (yet)" if RUBY_ENGINE == 'truffleruby'
pend "mswin not supported (yet)" if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') pend "mswin not supported (yet)" if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS')
pend "ruby.h is not provided by ruby repo" if testing_ruby_repo? system(@rust_envs, 'cargo', '-V', out: IO::NULL, err: [:child, :out])
pend 'cargo not present' unless $?.success?
pend "ruby.h is not provided by ruby repo" if ruby_repo?
end
def assert_ffi_handle(bundle, name)
require 'fiddle'
dylib_handle = Fiddle.dlopen bundle
assert_nothing_raised { dylib_handle[name] }
end end
end end

View file

@ -11,6 +11,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -22,16 +31,11 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "bindgen" name = "bindgen"
version = "0.59.2" version = "0.59.2"
source = "git+https://github.com/rust-lang/rust-bindgen?rev=f34e4103f304500c96d332f5cecc9067c980d0f9#f34e4103f304500c96d332f5cecc9067c980d0f9" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cexpr", "cexpr",
@ -56,6 +60,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]] [[package]]
name = "cexpr" name = "cexpr"
version = "0.6.0" version = "0.6.0"
@ -73,9 +83,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clang-sys" name = "clang-sys"
version = "1.3.1" version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b"
dependencies = [ dependencies = [
"glob", "glob",
"libc", "libc",
@ -84,17 +94,17 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.1.5" version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced1892c55c910c1219e98d6fc8d71f6bddba7905866ce740066d8bfea859312" checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [ dependencies = [
"ansi_term",
"atty", "atty",
"bitflags", "bitflags",
"indexmap",
"os_str_bytes",
"strsim", "strsim",
"termcolor",
"textwrap", "textwrap",
"unicode-width",
"vec_map",
] ]
[[package]] [[package]]
@ -129,12 +139,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.19" version = "0.1.19"
@ -150,16 +154,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "indexmap"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -174,9 +168,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.119" version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -189,19 +183,28 @@ dependencies = [
] ]
[[package]] [[package]]
name = "log" name = "linkify"
version = "0.4.14" version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" checksum = "28d9967eb7d0bc31c39c6f52e8fce42991c0cd1f7a2078326f0b7a399a584c8d"
dependencies = [
"memchr",
]
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.4.1" version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]] [[package]]
name = "minimal-lexical" name = "minimal-lexical"
@ -211,22 +214,12 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "nom" name = "nom"
version = "7.1.0" version = "7.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
dependencies = [ dependencies = [
"memchr", "memchr",
"minimal-lexical", "minimal-lexical",
"version_check",
]
[[package]]
name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
] ]
[[package]] [[package]]
@ -237,43 +230,47 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.24" version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.36" version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
dependencies = [ dependencies = [
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.15" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]] [[package]]
name = "rb-sys" name = "rb-sys"
version = "0.6.0" version = "0.9.4"
source = "git+https://github.com/ianks/rb-sys?tag=v0.6.0#1aa5b589e86a14e01aba806511818c19f85d71f6" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5465c5bd695ef70959b91b4ca9cfd515e9af012f6d9f0ae46f09fa4bcc3b722"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"libc", "cc",
"lazy_static",
"linkify",
"pkg-config", "pkg-config",
"shell-words",
] ]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.5.5" version = "1.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -282,9 +279,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.25" version = "0.6.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
[[package]] [[package]]
name = "rustc-hash" name = "rustc-hash"
@ -292,6 +289,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "shell-words"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "1.1.0" version = "1.1.0"
@ -300,9 +303,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "termcolor" name = "termcolor"
@ -315,27 +318,36 @@ dependencies = [
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.15.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]] [[package]]
name = "unicode-xid" name = "unicode-ident"
version = "0.2.2" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
[[package]] [[package]]
name = "version_check" name = "unicode-width"
version = "0.9.4" version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "which" name = "which"
version = "4.2.4" version = "4.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a5a7e487e921cf220206864a94a89b6c6905bfc19f1057fa26a4cb360e5c1d2" checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae"
dependencies = [ dependencies = [
"either", "either",
"lazy_static", "lazy_static",

View file

@ -6,5 +6,4 @@ version = "0.1.0"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]
# Needed until bindgen has the `allowlist_file` feature rb-sys = "0.9.4"
rb-sys = { git = "https://github.com/ianks/rb-sys", tag = "v0.6.0" }

View file

@ -11,6 +11,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -22,16 +31,11 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "bindgen" name = "bindgen"
version = "0.59.2" version = "0.59.2"
source = "git+https://github.com/rust-lang/rust-bindgen?rev=f34e4103f304500c96d332f5cecc9067c980d0f9#f34e4103f304500c96d332f5cecc9067c980d0f9" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cexpr", "cexpr",
@ -56,6 +60,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]] [[package]]
name = "cexpr" name = "cexpr"
version = "0.6.0" version = "0.6.0"
@ -73,9 +83,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clang-sys" name = "clang-sys"
version = "1.3.1" version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b"
dependencies = [ dependencies = [
"glob", "glob",
"libc", "libc",
@ -84,17 +94,17 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.1.5" version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced1892c55c910c1219e98d6fc8d71f6bddba7905866ce740066d8bfea859312" checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [ dependencies = [
"ansi_term",
"atty", "atty",
"bitflags", "bitflags",
"indexmap",
"os_str_bytes",
"strsim", "strsim",
"termcolor",
"textwrap", "textwrap",
"unicode-width",
"vec_map",
] ]
[[package]] [[package]]
@ -122,12 +132,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.19" version = "0.1.19"
@ -143,16 +147,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "indexmap"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -167,9 +161,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.119" version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -182,19 +176,28 @@ dependencies = [
] ]
[[package]] [[package]]
name = "log" name = "linkify"
version = "0.4.14" version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" checksum = "28d9967eb7d0bc31c39c6f52e8fce42991c0cd1f7a2078326f0b7a399a584c8d"
dependencies = [
"memchr",
]
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.4.1" version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]] [[package]]
name = "minimal-lexical" name = "minimal-lexical"
@ -204,22 +207,12 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "nom" name = "nom"
version = "7.1.0" version = "7.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
dependencies = [ dependencies = [
"memchr", "memchr",
"minimal-lexical", "minimal-lexical",
"version_check",
]
[[package]]
name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
] ]
[[package]] [[package]]
@ -230,43 +223,47 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.24" version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.36" version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
dependencies = [ dependencies = [
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.15" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]] [[package]]
name = "rb-sys" name = "rb-sys"
version = "0.6.0" version = "0.9.4"
source = "git+https://github.com/ianks/rb-sys?tag=v0.6.0#1aa5b589e86a14e01aba806511818c19f85d71f6" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5465c5bd695ef70959b91b4ca9cfd515e9af012f6d9f0ae46f09fa4bcc3b722"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"libc", "cc",
"lazy_static",
"linkify",
"pkg-config", "pkg-config",
"shell-words",
] ]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.5.5" version = "1.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -275,9 +272,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.25" version = "0.6.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
[[package]] [[package]]
name = "rust_ruby_example" name = "rust_ruby_example"
@ -292,6 +289,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "shell-words"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "1.1.0" version = "1.1.0"
@ -300,9 +303,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "termcolor" name = "termcolor"
@ -315,27 +318,36 @@ dependencies = [
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.15.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]] [[package]]
name = "unicode-xid" name = "unicode-ident"
version = "0.2.2" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
[[package]] [[package]]
name = "version_check" name = "unicode-width"
version = "0.9.4" version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "which" name = "which"
version = "4.2.4" version = "4.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a5a7e487e921cf220206864a94a89b6c6905bfc19f1057fa26a4cb360e5c1d2" checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae"
dependencies = [ dependencies = [
"either", "either",
"lazy_static", "lazy_static",

View file

@ -6,5 +6,4 @@ version = "0.1.0"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]
# Needed until bindgen has the `allowlist_file` feature rb-sys = "0.9.4"
rb-sys = { git = "https://github.com/ianks/rb-sys", tag = "v0.6.0" }

View file

@ -15,7 +15,7 @@ gemspec = File.expand_path('rust_ruby_example.gemspec', __dir__)
Dir.mktmpdir("rust_ruby_example") do |dir| Dir.mktmpdir("rust_ruby_example") do |dir|
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem")) built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
system *gem, "build", gemspec, "--output", built_gem system(*gem, "build", gemspec, "--output", built_gem)
system *gem, "install", "--verbose", "--local", built_gem, *ARGV system(*gem, "install", "--verbose", "--local", built_gem, *ARGV)
system %q(ruby -rrust_ruby_example -e "puts 'Result: ' + RustRubyExample.reverse('hello world')") system %q(ruby -rrust_ruby_example -e "puts 'Result: ' + RustRubyExample.reverse('hello world')")
end end

View file

@ -0,0 +1,33 @@
# frozen_string_literal: true
require_relative 'helper'
require 'rubygems/ext'
require 'rubygems/ext/cargo_builder/link_flag_converter'
class TestGemExtCargoBuilderLinkFlagConverter < Gem::TestCase
CASES = {
test_search_path_basic: ["-L/usr/local/lib", ["-L", "native=/usr/local/lib"]],
test_search_path_space: ["-L /usr/local/lib", ["-L", "native=/usr/local/lib"]],
test_search_path_space_in_path: ["-L/usr/local/my\ lib", ["-L", "native=/usr/local/my\ lib"]],
test_simple_lib: ["-lfoo", ["-l", "foo"]],
test_lib_with_nonascii: ["-lws2_32", ["-l", "ws2_32"]],
test_simple_lib_space: ["-l foo", ["-l", "foo"]],
test_verbose_lib_space: ["--library=foo", ["-l", "foo"]],
test_libstatic_with_colon: ["-l:libssp.a", ["-l", "static=ssp"]],
test_libstatic_with_colon_space: ["-l :libssp.a", ["-l", "static=ssp"]],
test_unconventional_lib_with_colon: ["-l:ssp.a", ["-C", "link_arg=-l:ssp.a"]],
test_dylib_with_colon_space: ["-l :libssp.dylib", ["-l", "dylib=ssp"]],
test_so_with_colon_space: ["-l :libssp.so", ["-l", "dylib=ssp"]],
test_dll_with_colon_space: ["-l :libssp.dll", ["-l", "dylib=ssp"]],
test_framework: ["-F/some/path", ["-l", "framework=/some/path"]],
test_framework_space: ["-F /some/path", ["-l", "framework=/some/path"]],
test_non_lib_dash_l: ["test_rubygems_20220413-976-lemgf9/prefix", ["-C", "link_arg=test_rubygems_20220413-976-lemgf9/prefix"]],
}.freeze
CASES.each do |test_name, (arg, expected)|
raise "duplicate test name" if instance_methods.include?(test_name)
define_method(test_name) do
assert_equal(expected, Gem::Ext::CargoBuilder::LinkFlagConverter.convert(arg))
end
end
end

View file

@ -0,0 +1,75 @@
# frozen_string_literal: true
require_relative 'helper'
require 'rubygems/ext'
class TestGemExtCargoBuilderUnit < Gem::TestCase
def test_cargo_command_passes_args
skip_unsupported_platforms!
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
builder = Gem::Ext::CargoBuilder.new(spec)
command = builder.cargo_command(Dir.pwd, @tempdir, ['--all-features'])
assert_includes command, '--all-features'
end
def test_cargo_command_locks_in_release_profile
skip_unsupported_platforms!
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
builder = Gem::Ext::CargoBuilder.new(spec)
builder.profile = :release
command = builder.cargo_command(Dir.pwd, @tempdir)
assert_includes command, '--locked'
end
def test_cargo_command_does_not_lock_in_dev_profile
skip_unsupported_platforms!
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
builder = Gem::Ext::CargoBuilder.new(spec)
builder.profile = :dev
command = builder.cargo_command(Dir.pwd, @tempdir)
assert_not_includes command, '--locked'
end
def test_cargo_command_passes_respects_cargo_env_var
skip_unsupported_platforms!
old_cargo = ENV['CARGO']
ENV['CARGO'] = 'mycargo'
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
builder = Gem::Ext::CargoBuilder.new(spec)
command = builder.cargo_command(Dir.pwd, @tempdir)
assert_includes command, 'mycargo'
ensure
ENV['CARGO'] = old_cargo
end
def test_build_env_includes_rbconfig
skip_unsupported_platforms!
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
builder = Gem::Ext::CargoBuilder.new(spec)
env = builder.build_env
assert_equal env.fetch('RBCONFIG_RUBY_SO_NAME'), RbConfig::CONFIG['RUBY_SO_NAME']
end
def test_cargo_command_passes_respects_cargo_build_target
skip_unsupported_platforms!
old_cargo = ENV['CARGO_BUILD_TARGET']
ENV['CARGO_BUILD_TARGET'] = 'x86_64-unknown-linux-gnu'
spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
builder = Gem::Ext::CargoBuilder.new(spec)
command = builder.cargo_command(Dir.pwd, @tempdir, ['--locked'])
assert_includes command, '--target'
assert_includes command, 'x86_64-unknown-linux-gnu'
ensure
ENV['CARGO_BUILD_TARGET'] = old_cargo
end
def skip_unsupported_platforms!
pend "jruby not supported" if java_platform?
end
end

View file

@ -1068,7 +1068,15 @@ dependencies: []
end end
def test_handles_private_null_type def test_handles_private_null_type
path = File.expand_path 'data/null-type.gemspec.rz', __dir__ path = File.expand_path 'data/pry-0.4.7.gemspec.rz', __dir__
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))
assert_instance_of Gem::Specification, data
end
def test_handles_dependencies_with_syck_requirements_bug
path = File.expand_path 'data/excon-0.7.7.gemspec.rz', __dir__
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path)) data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))

View file

@ -444,7 +444,7 @@ class TestGemRequire < Gem::TestCase
end end
def test_realworld_default_gem def test_realworld_default_gem
omit "this test can't work under ruby-core setup" if testing_ruby_repo? omit "this test can't work under ruby-core setup" if ruby_repo?
cmd = <<-RUBY cmd = <<-RUBY
$stderr = $stdout $stderr = $stdout
@ -457,7 +457,7 @@ class TestGemRequire < Gem::TestCase
end end
def test_realworld_upgraded_default_gem def test_realworld_upgraded_default_gem
omit "this test can't work under ruby-core setup" if testing_ruby_repo? omit "this test can't work under ruby-core setup" if ruby_repo?
newer_json = util_spec("json", "999.99.9", nil, ["lib/json.rb"]) newer_json = util_spec("json", "999.99.9", nil, ["lib/json.rb"])
install_gem newer_json install_gem newer_json

View file

@ -6,11 +6,6 @@ gem "rdoc", "6.2.0" # 6.2.1 is required > Ruby 2.3
gem "test-unit", "~> 3.0" gem "test-unit", "~> 3.0"
gem "rake", "~> 13.0" gem "rake", "~> 13.0"
group :lint do
gem "rubocop", "~> 0.80.1"
gem "rubocop-performance", "~> 1.5.2"
end
gem "webrick", "~> 1.6" gem "webrick", "~> 1.6"
gem "parallel_tests", "~> 2.29" gem "parallel_tests", "~> 2.29"
gem "parallel", "1.19.2" # 1.20+ is required > Ruby 2.3 gem "parallel", "1.19.2" # 1.20+ is required > Ruby 2.3

View file

@ -1,23 +1,16 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
ast (2.4.2)
diff-lcs (1.5.0) diff-lcs (1.5.0)
hpricot (0.8.6) hpricot (0.8.6)
jaro_winkler (1.5.4)
jaro_winkler (1.5.4-java)
mustache (1.1.1) mustache (1.1.1)
parallel (1.19.2) parallel (1.19.2)
parallel_tests (2.32.0) parallel_tests (2.32.0)
parallel parallel
parser (3.1.0.0)
ast (~> 2.4.1)
power_assert (2.0.1) power_assert (2.0.1)
rainbow (3.1.1)
rake (13.0.6) 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)
ronn (0.7.3) ronn (0.7.3)
hpricot (>= 0.8.2) hpricot (>= 0.8.2)
mustache (>= 0.7.0) mustache (>= 0.7.0)
@ -31,20 +24,8 @@ GEM
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0) rspec-support (~> 3.11.0)
rspec-support (3.11.0) rspec-support (3.11.0)
rubocop (0.80.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
rexml
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-performance (1.5.2)
rubocop (>= 0.71.0)
ruby-progressbar (1.11.0)
test-unit (3.5.3) test-unit (3.5.3)
power_assert power_assert
unicode-display_width (1.6.1)
uri (0.10.1) uri (0.10.1)
webrick (1.7.0) webrick (1.7.0)
@ -65,11 +46,9 @@ DEPENDENCIES
rspec-core (~> 3.8) rspec-core (~> 3.8)
rspec-expectations (~> 3.8) rspec-expectations (~> 3.8)
rspec-mocks (~> 3.11.1) rspec-mocks (~> 3.11.1)
rubocop (~> 0.80.1)
rubocop-performance (~> 1.5.2)
test-unit (~> 3.0) test-unit (~> 3.0)
uri (~> 0.10.1) uri (~> 0.10.1)
webrick (~> 1.6) webrick (~> 1.6)
BUNDLED WITH BUNDLED WITH
2.3.15 2.3.16

View file

@ -60,4 +60,4 @@ DEPENDENCIES
test-unit test-unit
BUNDLED WITH BUNDLED WITH
2.3.15 2.3.16

View file

@ -66,4 +66,4 @@ DEPENDENCIES
test-unit test-unit
BUNDLED WITH BUNDLED WITH
2.3.15 2.3.16

View file

@ -41,4 +41,4 @@ DEPENDENCIES
webrick (= 1.7.0) webrick (= 1.7.0)
BUNDLED WITH BUNDLED WITH
2.3.15 2.3.16