1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Merge RubyGems-3.3.18 and Bundler-2.3.18

This commit is contained in:
Hiroshi SHIBATA 2022-08-22 11:49:20 +09:00 committed by nagachika
parent 7ef68dd74a
commit 0918783347
69 changed files with 586 additions and 167 deletions

View file

@ -31,9 +31,8 @@ module Bundler
# first try to fetch any new bytes on the existing file # first try to fetch any new bytes on the existing file
if retrying.nil? && local_path.file? if retrying.nil? && local_path.file?
SharedHelpers.filesystem_access(local_temp_path) do copy_file local_path, local_temp_path
FileUtils.cp local_path, local_temp_path
end
headers["If-None-Match"] = etag_for(local_temp_path) headers["If-None-Match"] = etag_for(local_temp_path)
headers["Range"] = headers["Range"] =
if local_temp_path.size.nonzero? if local_temp_path.size.nonzero?
@ -98,6 +97,20 @@ module Bundler
SharedHelpers.digest(:MD5).hexdigest(File.read(path)) SharedHelpers.digest(:MD5).hexdigest(File.read(path))
end end
end end
private
def copy_file(source, dest)
SharedHelpers.filesystem_access(source, :read) do
File.open(source, "r") do |s|
SharedHelpers.filesystem_access(dest, :write) do
File.open(dest, "wb", s.stat.mode) do |f|
IO.copy_stream(s, f)
end
end
end
end
end
end end
end end
end end

View file

@ -235,6 +235,14 @@ module Bundler
@locked_deps.values @locked_deps.values
end end
def new_deps
@new_deps ||= @dependencies - locked_dependencies
end
def deleted_deps
@deleted_deps ||= locked_dependencies - @dependencies
end
def specs_for(groups) def specs_for(groups)
return specs if groups.empty? return specs if groups.empty?
deps = dependencies_for(groups) deps = dependencies_for(groups)
@ -259,8 +267,17 @@ module Bundler
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?
Bundler.ui.debug("Found no changes, using resolution from the lockfile") if deleted_deps.any?
SpecSet.new(filter_specs(@locked_specs, @dependencies.select {|dep| @locked_specs[dep].any? })) Bundler.ui.debug("Some dependencies were deleted, using a subset of the resolution from the lockfile")
SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
else
Bundler.ui.debug("Found no changes, using resolution from the lockfile")
if @locked_gems.may_include_redundant_platform_specific_gems?
SpecSet.new(filter_specs(@locked_specs, @dependencies))
else
@locked_specs
end
end
else else
last_resolve = converge_locked_specs last_resolve = converge_locked_specs
# Run a resolve against the locally available gems # Run a resolve against the locally available gems
@ -359,9 +376,6 @@ module Bundler
added.concat new_platforms.map {|p| "* platform: #{p}" } added.concat new_platforms.map {|p| "* platform: #{p}" }
deleted.concat deleted_platforms.map {|p| "* platform: #{p}" } deleted.concat deleted_platforms.map {|p| "* platform: #{p}" }
new_deps = @dependencies - locked_dependencies
deleted_deps = locked_dependencies - @dependencies
added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any? added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any? deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
@ -806,7 +820,7 @@ module Bundler
return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources) return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
converge_specs(@originally_locked_specs).map do |locked_spec| converge_specs(@originally_locked_specs).map do |locked_spec|
name = locked_spec.name name = locked_spec.name
dep = Gem::Dependency.new(name, ">= #{locked_spec.version}") dep = Dependency.new(name, ">= #{locked_spec.version}")
DepProxy.get_proxy(dep, locked_spec.platform) DepProxy.get_proxy(dep, locked_spec.platform)
end end
end end

View file

@ -7,7 +7,7 @@ require_relative "rubygems_ext"
module Bundler module Bundler
class Dependency < Gem::Dependency class Dependency < Gem::Dependency
attr_reader :autorequire attr_reader :autorequire
attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref, :force_ruby_platform
# rubocop:disable Naming/VariableNumber # rubocop:disable Naming/VariableNumber
PLATFORM_MAP = { PLATFORM_MAP = {
@ -109,6 +109,7 @@ module Bundler
@env = options["env"] @env = options["env"]
@should_include = options.fetch("should_include", true) @should_include = options.fetch("should_include", true)
@gemfile = options["gemfile"] @gemfile = options["gemfile"]
@force_ruby_platform = options["force_ruby_platform"]
@autorequire = Array(options["require"] || []) if options.key?("require") @autorequire = Array(options["require"] || []) if options.key?("require")
end end

View file

@ -16,7 +16,7 @@ module Bundler
VALID_PLATFORMS = Bundler::Dependency::PLATFORM_MAP.keys.freeze VALID_PLATFORMS = Bundler::Dependency::PLATFORM_MAP.keys.freeze
VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
platform platforms type source install_if gemfile].freeze platform platforms type source install_if gemfile force_ruby_platform].freeze
GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}.freeze GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}.freeze

View file

@ -5,6 +5,7 @@ module Bundler
GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable Style/MutableConstant GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable Style/MutableConstant
GENERICS = [ GENERICS = [
[Gem::Platform.new("java"), Gem::Platform.new("java")], [Gem::Platform.new("java"), Gem::Platform.new("java")],
[Gem::Platform.new("universal-java"), Gem::Platform.new("java")],
[Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")], [Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
[Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")], [Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")],
[Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")], [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],

View file

@ -7,7 +7,7 @@ module Bundler
include MatchPlatform include MatchPlatform
attr_reader :name, :version, :dependencies, :platform attr_reader :name, :version, :dependencies, :platform
attr_accessor :source, :remote attr_accessor :source, :remote, :force_ruby_platform
def initialize(name, version, platform, source = nil) def initialize(name, version, platform, source = nil)
@name = name @name = name
@ -152,7 +152,7 @@ module Bundler
# explicitly add a more specific platform. # explicitly add a more specific platform.
# #
def ruby_platform_materializes_to_ruby_platform? def ruby_platform_materializes_to_ruby_platform?
!Bundler.most_specific_locked_platform?(generic_local_platform) || Bundler.settings[:force_ruby_platform] !Bundler.most_specific_locked_platform?(generic_local_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
end end
end end
end end

View file

@ -93,6 +93,10 @@ module Bundler
"and then `bundle install` to generate a new lockfile." "and then `bundle install` to generate a new lockfile."
end end
def may_include_redundant_platform_specific_gems?
bundler_version.nil? || bundler_version < Gem::Version.new("1.16.2")
end
private private
TYPES = { TYPES = {

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-ADD" "1" "May 2022" "" "" .TH "BUNDLE\-ADD" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-BINSTUBS" "1" "May 2022" "" "" .TH "BUNDLE\-BINSTUBS" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-CACHE" "1" "May 2022" "" "" .TH "BUNDLE\-CACHE" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-CHECK" "1" "May 2022" "" "" .TH "BUNDLE\-CHECK" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-CLEAN" "1" "May 2022" "" "" .TH "BUNDLE\-CLEAN" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-CONFIG" "1" "May 2022" "" "" .TH "BUNDLE\-CONFIG" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options \fBbundle\-config\fR \- Set bundler configuration options

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-DOCTOR" "1" "May 2022" "" "" .TH "BUNDLE\-DOCTOR" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-doctor\fR \- Checks the bundle for common problems \fBbundle\-doctor\fR \- Checks the bundle for common problems

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-EXEC" "1" "May 2022" "" "" .TH "BUNDLE\-EXEC" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-exec\fR \- Execute a command in the context of the bundle \fBbundle\-exec\fR \- Execute a command in the context of the bundle

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-GEM" "1" "May 2022" "" "" .TH "BUNDLE\-GEM" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-INFO" "1" "May 2022" "" "" .TH "BUNDLE\-INFO" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-info\fR \- Show information for the given gem in your bundle \fBbundle\-info\fR \- Show information for the given gem in your bundle

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-INIT" "1" "May 2022" "" "" .TH "BUNDLE\-INIT" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory \fBbundle\-init\fR \- Generates a Gemfile into the current working directory

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-INJECT" "1" "May 2022" "" "" .TH "BUNDLE\-INJECT" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile \fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-INSTALL" "1" "May 2022" "" "" .TH "BUNDLE\-INSTALL" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-LIST" "1" "May 2022" "" "" .TH "BUNDLE\-LIST" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-list\fR \- List all the gems in the bundle \fBbundle\-list\fR \- List all the gems in the bundle

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-LOCK" "1" "May 2022" "" "" .TH "BUNDLE\-LOCK" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-OPEN" "1" "May 2022" "" "" .TH "BUNDLE\-OPEN" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-OUTDATED" "1" "May 2022" "" "" .TH "BUNDLE\-OUTDATED" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-outdated\fR \- List installed gems with newer versions available \fBbundle\-outdated\fR \- List installed gems with newer versions available

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-PLATFORM" "1" "May 2022" "" "" .TH "BUNDLE\-PLATFORM" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-platform\fR \- Displays platform compatibility information \fBbundle\-platform\fR \- Displays platform compatibility information

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-PRISTINE" "1" "May 2022" "" "" .TH "BUNDLE\-PRISTINE" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-REMOVE" "1" "May 2022" "" "" .TH "BUNDLE\-REMOVE" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-remove\fR \- Removes gems from the Gemfile \fBbundle\-remove\fR \- Removes gems from the Gemfile

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-SHOW" "1" "May 2022" "" "" .TH "BUNDLE\-SHOW" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-UPDATE" "1" "May 2022" "" "" .TH "BUNDLE\-UPDATE" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-update\fR \- Update your gems to the latest available versions \fBbundle\-update\fR \- Update your gems to the latest available versions

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-VIZ" "1" "May 2022" "" "" .TH "BUNDLE\-VIZ" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE" "1" "May 2022" "" "" .TH "BUNDLE" "1" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\fR \- Ruby Dependency Management \fBbundle\fR \- Ruby Dependency Management

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "GEMFILE" "5" "May 2022" "" "" .TH "GEMFILE" "5" "June 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
@ -100,7 +100,7 @@ Each application \fImay\fR specify a Ruby engine version\. If an engine version
. .
.nf .nf
ruby "1\.8\.7", :engine => "jruby", :engine_version => "1\.6\.7" ruby "1\.8\.7", engine: "jruby", engine_version: "1\.6\.7"
. .
.fi .fi
. .
@ -113,7 +113,7 @@ Each application \fImay\fR specify a Ruby patchlevel\.
. .
.nf .nf
ruby "2\.0\.0", :patchlevel => "247" ruby "2\.0\.0", patchlevel: "247"
. .
.fi .fi
. .
@ -156,9 +156,9 @@ Each \fIgem\fR \fBMAY\fR specify files that should be used when autorequiring vi
. .
.nf .nf
gem "redis", :require => ["redis/connection/hiredis", "redis"] gem "redis", require: ["redis/connection/hiredis", "redis"]
gem "webmock", :require => false gem "webmock", require: false
gem "byebug", :require => true gem "byebug", require: true
. .
.fi .fi
. .
@ -172,8 +172,8 @@ The argument defaults to the name of the gem\. For example, these are identical:
.nf .nf
gem "nokogiri" gem "nokogiri"
gem "nokogiri", :require => "nokogiri" gem "nokogiri", require: "nokogiri"
gem "nokogiri", :require => true gem "nokogiri", require: true
. .
.fi .fi
. .
@ -186,8 +186,8 @@ Each \fIgem\fR \fBMAY\fR specify membership in one or more groups\. Any \fIgem\f
. .
.nf .nf
gem "rspec", :group => :test gem "rspec", group: :test
gem "wirble", :groups => [:development, :test] gem "wirble", groups: [:development, :test]
. .
.fi .fi
. .
@ -320,9 +320,9 @@ As with groups, you can specify one or more platforms:
. .
.nf .nf
gem "weakling", :platforms => :jruby gem "weakling", platforms: :jruby
gem "ruby\-debug", :platforms => :mri_18 gem "ruby\-debug", platforms: :mri_18
gem "nokogiri", :platforms => [:mri_18, :jruby] gem "nokogiri", platforms: [:mri_18, :jruby]
. .
.fi .fi
. .
@ -331,6 +331,30 @@ gem "nokogiri", :platforms => [:mri_18, :jruby]
.P .P
All operations involving groups (\fBbundle install\fR \fIbundle\-install\.1\.html\fR, \fBBundler\.setup\fR, \fBBundler\.require\fR) behave exactly the same as if any groups not matching the current platform were explicitly excluded\. All operations involving groups (\fBbundle install\fR \fIbundle\-install\.1\.html\fR, \fBBundler\.setup\fR, \fBBundler\.require\fR) behave exactly the same as if any groups not matching the current platform were explicitly excluded\.
. .
.SS "FORCE_RUBY_PLATFORM"
If you always want the pure ruby variant of a gem to be chosen over platform specific variants, you can use the \fBforce_ruby_platform\fR option:
.
.IP "" 4
.
.nf
gem "ffi", force_ruby_platform: true
.
.fi
.
.IP "" 0
.
.P
This can be handy (assuming the pure ruby variant works fine) when:
.
.IP "\(bu" 4
You\'re having issues with the platform specific variant\.
.
.IP "\(bu" 4
The platform specific variant does not yet support a newer ruby (and thus has a \fBrequired_ruby_version\fR upper bound), but you still want your Gemfile{\.lock} files to resolve under that ruby\.
.
.IP "" 0
.
.SS "SOURCE" .SS "SOURCE"
You can select an alternate Rubygems repository for a gem using the \':source\' option\. You can select an alternate Rubygems repository for a gem using the \':source\' option\.
. .
@ -338,7 +362,7 @@ You can select an alternate Rubygems repository for a gem using the \':source\'
. .
.nf .nf
gem "some_internal_gem", :source => "https://gems\.example\.com" gem "some_internal_gem", source: "https://gems\.example\.com"
. .
.fi .fi
. .
@ -361,15 +385,15 @@ If necessary, you can specify that a gem is located at a particular git reposito
. .
.TP .TP
\fBHTTP(S)\fR \fBHTTP(S)\fR
gem "rails", :git => "https://github\.com/rails/rails\.git" gem "rails", git: "https://github\.com/rails/rails\.git"
. .
.TP .TP
\fBSSH\fR \fBSSH\fR
gem "rails", :git => "git@github\.com:rails/rails\.git" gem "rails", git: "git@github\.com:rails/rails\.git"
. .
.TP .TP
\fBgit\fR \fBgit\fR
gem "rails", :git => "git://github\.com/rails/rails\.git" gem "rails", git: "git://github\.com/rails/rails\.git"
. .
.P .P
If using SSH, the user that you use to run \fBbundle install\fR \fBMUST\fR have the appropriate keys available in their \fB$HOME/\.ssh\fR\. If using SSH, the user that you use to run \fBbundle install\fR \fBMUST\fR have the appropriate keys available in their \fB$HOME/\.ssh\fR\.
@ -393,7 +417,7 @@ If a git repository does have a \fB\.gemspec\fR for the gem you attached it to,
. .
.nf .nf
gem "rails", "2\.3\.8", :git => "https://github\.com/rails/rails\.git" gem "rails", "2\.3\.8", git: "https://github\.com/rails/rails\.git"
# bundle install will fail, because the \.gemspec in the rails # bundle install will fail, because the \.gemspec in the rails
# repository\'s master branch specifies version 3\.0\.0 # repository\'s master branch specifies version 3\.0\.0
. .
@ -409,20 +433,20 @@ Git repositories support a number of additional options\.
. .
.TP .TP
\fBbranch\fR, \fBtag\fR, and \fBref\fR \fBbranch\fR, \fBtag\fR, and \fBref\fR
You \fBMUST\fR only specify at most one of these options\. The default is \fB:branch => "master"\fR\. For example: You \fBMUST\fR only specify at most one of these options\. The default is \fBbranch: "master"\fR\. For example:
. .
.IP .IP
gem "rails", :git => "https://github\.com/rails/rails\.git", :branch => "5\-0\-stable" gem "rails", git: "https://github\.com/rails/rails\.git", branch: "5\-0\-stable"
. .
.IP .IP
gem "rails", :git => "https://github\.com/rails/rails\.git", :tag => "v5\.0\.0" gem "rails", git: "https://github\.com/rails/rails\.git", tag: "v5\.0\.0"
. .
.IP .IP
gem "rails", :git => "https://github\.com/rails/rails\.git", :ref => "4aded" gem "rails", git: "https://github\.com/rails/rails\.git", ref: "4aded"
. .
.TP .TP
\fBsubmodules\fR \fBsubmodules\fR
For reference, a git submodule \fIhttps://git\-scm\.com/book/en/v2/Git\-Tools\-Submodules\fR lets you have another git repository within a subfolder of your repository\. Specify \fB:submodules => true\fR to cause bundler to expand any submodules included in the git repository For reference, a git submodule \fIhttps://git\-scm\.com/book/en/v2/Git\-Tools\-Submodules\fR lets you have another git repository within a subfolder of your repository\. Specify \fBsubmodules: true\fR to cause bundler to expand any submodules included in the git repository
. .
.P .P
If a git repository contains multiple \fB\.gemspecs\fR, each \fB\.gemspec\fR represents a gem located at the same place in the file system as the \fB\.gemspec\fR\. If a git repository contains multiple \fB\.gemspecs\fR, each \fB\.gemspec\fR represents a gem located at the same place in the file system as the \fB\.gemspec\fR\.
@ -454,7 +478,7 @@ A custom git source can be defined via the \fBgit_source\fR method\. Provide the
.nf .nf
git_source(:stash){ |repo_name| "https://stash\.corp\.acme\.pl/#{repo_name}\.git" } git_source(:stash){ |repo_name| "https://stash\.corp\.acme\.pl/#{repo_name}\.git" }
gem \'rails\', :stash => \'forks/rails\' gem \'rails\', stash: \'forks/rails\'
. .
.fi .fi
. .
@ -467,7 +491,7 @@ In addition, if you wish to choose a specific branch:
. .
.nf .nf
gem "rails", :stash => "forks/rails", :branch => "branch_name" gem "rails", stash: "forks/rails", branch: "branch_name"
. .
.fi .fi
. .
@ -483,8 +507,8 @@ If the git repository you want to use is hosted on GitHub and is public, you can
. .
.nf .nf
gem "rails", :github => "rails/rails" gem "rails", github: "rails/rails"
gem "rails", :github => "rails" gem "rails", github: "rails"
. .
.fi .fi
. .
@ -497,7 +521,7 @@ Are both equivalent to
. .
.nf .nf
gem "rails", :git => "git://github\.com/rails/rails\.git" gem "rails", git: "git://github\.com/rails/rails\.git"
. .
.fi .fi
. .
@ -513,7 +537,7 @@ You can also directly pass a pull request URL:
. .
.nf .nf
gem "rails", :github => "https://github\.com/rails/rails/pull/43753" gem "rails", github: "https://github\.com/rails/rails/pull/43753"
. .
.fi .fi
. .
@ -526,7 +550,7 @@ Which is equivalent to:
. .
.nf .nf
gem "rails", :github => "rails/rails", branch: "refs/pull/43753/head" gem "rails", github: "rails/rails", branch: "refs/pull/43753/head"
. .
.fi .fi
. .
@ -539,7 +563,7 @@ If the git repository you want to use is hosted as a GitHub Gist and is public,
. .
.nf .nf
gem "the_hatch", :gist => "4815162342" gem "the_hatch", gist: "4815162342"
. .
.fi .fi
. .
@ -552,7 +576,7 @@ Is equivalent to:
. .
.nf .nf
gem "the_hatch", :git => "https://gist\.github\.com/4815162342\.git" gem "the_hatch", git: "https://gist\.github\.com/4815162342\.git"
. .
.fi .fi
. .
@ -568,8 +592,8 @@ If the git repository you want to use is hosted on Bitbucket and is public, you
. .
.nf .nf
gem "rails", :bitbucket => "rails/rails" gem "rails", bitbucket: "rails/rails"
gem "rails", :bitbucket => "rails" gem "rails", bitbucket: "rails"
. .
.fi .fi
. .
@ -582,7 +606,7 @@ Are both equivalent to
. .
.nf .nf
gem "rails", :git => "https://rails@bitbucket\.org/rails/rails\.git" gem "rails", git: "https://rails@bitbucket\.org/rails/rails\.git"
. .
.fi .fi
. .
@ -604,7 +628,7 @@ Unlike \fB:git\fR, bundler does not compile C extensions for gems specified as p
. .
.nf .nf
gem "rails", :path => "vendor/rails" gem "rails", path: "vendor/rails"
. .
.fi .fi
. .
@ -648,7 +672,7 @@ platforms :ruby do
gem "sqlite3" gem "sqlite3"
end end
group :development, :optional => true do group :development, optional: true do
gem "wirble" gem "wirble"
gem "faker" gem "faker"
end end
@ -688,7 +712,7 @@ The \fB\.gemspec\fR \fIhttp://guides\.rubygems\.org/specification\-reference/\fR
If you wish to use Bundler to help install dependencies for a gem while it is being developed, use the \fBgemspec\fR method to pull in the dependencies listed in the \fB\.gemspec\fR file\. If you wish to use Bundler to help install dependencies for a gem while it is being developed, use the \fBgemspec\fR method to pull in the dependencies listed in the \fB\.gemspec\fR file\.
. .
.P .P
The \fBgemspec\fR method adds any runtime dependencies as gem requirements in the default group\. It also adds development dependencies as gem requirements in the \fBdevelopment\fR group\. Finally, it adds a gem requirement on your project (\fB:path => \'\.\'\fR)\. In conjunction with \fBBundler\.setup\fR, this allows you to require project files in your test code as you would if the project were installed as a gem; you need not manipulate the load path manually or require project files via relative paths\. The \fBgemspec\fR method adds any runtime dependencies as gem requirements in the default group\. It also adds development dependencies as gem requirements in the \fBdevelopment\fR group\. Finally, it adds a gem requirement on your project (\fBpath: \'\.\'\fR)\. In conjunction with \fBBundler\.setup\fR, this allows you to require project files in your test code as you would if the project were installed as a gem; you need not manipulate the load path manually or require project files via relative paths\.
. .
.P .P
The \fBgemspec\fR method supports optional \fB:path\fR, \fB:glob\fR, \fB:name\fR, and \fB:development_group\fR options, which control where bundler looks for the \fB\.gemspec\fR, the glob it uses to look for the gemspec (defaults to: "{,\fI,\fR/*}\.gemspec"), what named \fB\.gemspec\fR it uses (if more than one is present), and which group development dependencies are included in\. The \fBgemspec\fR method supports optional \fB:path\fR, \fB:glob\fR, \fB:name\fR, and \fB:development_group\fR options, which control where bundler looks for the \fB\.gemspec\fR, the glob it uses to look for the gemspec (defaults to: "{,\fI,\fR/*}\.gemspec"), what named \fB\.gemspec\fR it uses (if more than one is present), and which group development dependencies are included in\.

View file

@ -91,13 +91,13 @@ Each application _may_ specify a Ruby engine version. If an engine version is
specified, an engine _must_ also be specified. If the engine is "ruby" the specified, an engine _must_ also be specified. If the engine is "ruby" the
engine version specified _must_ match the Ruby version. engine version specified _must_ match the Ruby version.
ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7" ruby "1.8.7", engine: "jruby", engine_version: "1.6.7"
### PATCHLEVEL ### PATCHLEVEL
Each application _may_ specify a Ruby patchlevel. Each application _may_ specify a Ruby patchlevel.
ruby "2.0.0", :patchlevel => "247" ruby "2.0.0", patchlevel: "247"
## GEMS ## GEMS
@ -124,23 +124,23 @@ Each _gem_ `MAY` specify files that should be used when autorequiring via
you want `required` has the same name as _gem_ or `false` to you want `required` has the same name as _gem_ or `false` to
prevent any file from being autorequired. prevent any file from being autorequired.
gem "redis", :require => ["redis/connection/hiredis", "redis"] gem "redis", require: ["redis/connection/hiredis", "redis"]
gem "webmock", :require => false gem "webmock", require: false
gem "byebug", :require => true gem "byebug", require: true
The argument defaults to the name of the gem. For example, these are identical: The argument defaults to the name of the gem. For example, these are identical:
gem "nokogiri" gem "nokogiri"
gem "nokogiri", :require => "nokogiri" gem "nokogiri", require: "nokogiri"
gem "nokogiri", :require => true gem "nokogiri", require: true
### GROUPS ### GROUPS
Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does
not specify membership in any group is placed in the `default` group. not specify membership in any group is placed in the `default` group.
gem "rspec", :group => :test gem "rspec", group: :test
gem "wirble", :groups => [:development, :test] gem "wirble", groups: [:development, :test]
The Bundler runtime allows its two main methods, `Bundler.setup` and The Bundler runtime allows its two main methods, `Bundler.setup` and
`Bundler.require`, to limit their impact to particular groups. `Bundler.require`, to limit their impact to particular groups.
@ -223,20 +223,34 @@ The full list of platforms and supported versions includes:
As with groups, you can specify one or more platforms: As with groups, you can specify one or more platforms:
gem "weakling", :platforms => :jruby gem "weakling", platforms: :jruby
gem "ruby-debug", :platforms => :mri_18 gem "ruby-debug", platforms: :mri_18
gem "nokogiri", :platforms => [:mri_18, :jruby] gem "nokogiri", platforms: [:mri_18, :jruby]
All operations involving groups ([`bundle install`](bundle-install.1.html), `Bundler.setup`, All operations involving groups ([`bundle install`](bundle-install.1.html), `Bundler.setup`,
`Bundler.require`) behave exactly the same as if any groups not `Bundler.require`) behave exactly the same as if any groups not
matching the current platform were explicitly excluded. matching the current platform were explicitly excluded.
### FORCE_RUBY_PLATFORM
If you always want the pure ruby variant of a gem to be chosen over platform
specific variants, you can use the `force_ruby_platform` option:
gem "ffi", force_ruby_platform: true
This can be handy (assuming the pure ruby variant works fine) when:
* You're having issues with the platform specific variant.
* The platform specific variant does not yet support a newer ruby (and thus has
a `required_ruby_version` upper bound), but you still want your Gemfile{.lock}
files to resolve under that ruby.
### SOURCE ### SOURCE
You can select an alternate Rubygems repository for a gem using the ':source' You can select an alternate Rubygems repository for a gem using the ':source'
option. option.
gem "some_internal_gem", :source => "https://gems.example.com" gem "some_internal_gem", source: "https://gems.example.com"
This forces the gem to be loaded from this source and ignores any global sources This forces the gem to be loaded from this source and ignores any global sources
declared at the top level of the file. If the gem does not exist in this source, declared at the top level of the file. If the gem does not exist in this source,
@ -263,11 +277,11 @@ git repository using the `:git` parameter. The repository can be accessed via
several protocols: several protocols:
* `HTTP(S)`: * `HTTP(S)`:
gem "rails", :git => "https://github.com/rails/rails.git" gem "rails", git: "https://github.com/rails/rails.git"
* `SSH`: * `SSH`:
gem "rails", :git => "git@github.com:rails/rails.git" gem "rails", git: "git@github.com:rails/rails.git"
* `git`: * `git`:
gem "rails", :git => "git://github.com/rails/rails.git" gem "rails", git: "git://github.com/rails/rails.git"
If using SSH, the user that you use to run `bundle install` `MUST` have the If using SSH, the user that you use to run `bundle install` `MUST` have the
appropriate keys available in their `$HOME/.ssh`. appropriate keys available in their `$HOME/.ssh`.
@ -295,7 +309,7 @@ to, a version specifier, if provided, means that the git repository is
only valid if the `.gemspec` specifies a version matching the version only valid if the `.gemspec` specifies a version matching the version
specifier. If not, bundler will print a warning. specifier. If not, bundler will print a warning.
gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git" gem "rails", "2.3.8", git: "https://github.com/rails/rails.git"
# bundle install will fail, because the .gemspec in the rails # bundle install will fail, because the .gemspec in the rails
# repository's master branch specifies version 3.0.0 # repository's master branch specifies version 3.0.0
@ -307,18 +321,18 @@ Git repositories support a number of additional options.
* `branch`, `tag`, and `ref`: * `branch`, `tag`, and `ref`:
You `MUST` only specify at most one of these options. The default You `MUST` only specify at most one of these options. The default
is `:branch => "master"`. For example: is `branch: "master"`. For example:
gem "rails", :git => "https://github.com/rails/rails.git", :branch => "5-0-stable" gem "rails", git: "https://github.com/rails/rails.git", branch: "5-0-stable"
gem "rails", :git => "https://github.com/rails/rails.git", :tag => "v5.0.0" gem "rails", git: "https://github.com/rails/rails.git", tag: "v5.0.0"
gem "rails", :git => "https://github.com/rails/rails.git", :ref => "4aded" gem "rails", git: "https://github.com/rails/rails.git", ref: "4aded"
* `submodules`: * `submodules`:
For reference, a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) For reference, a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
lets you have another git repository within a subfolder of your repository. lets you have another git repository within a subfolder of your repository.
Specify `:submodules => true` to cause bundler to expand any Specify `submodules: true` to cause bundler to expand any
submodules included in the git repository submodules included in the git repository
If a git repository contains multiple `.gemspecs`, each `.gemspec` If a git repository contains multiple `.gemspecs`, each `.gemspec`
@ -346,11 +360,11 @@ as an argument, and a block which receives a single argument and interpolates it
string to return the full repo address: string to return the full repo address:
git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" } git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" }
gem 'rails', :stash => 'forks/rails' gem 'rails', stash: 'forks/rails'
In addition, if you wish to choose a specific branch: In addition, if you wish to choose a specific branch:
gem "rails", :stash => "forks/rails", :branch => "branch_name" gem "rails", stash: "forks/rails", branch: "branch_name"
### GITHUB ### GITHUB
@ -363,33 +377,33 @@ If the git repository you want to use is hosted on GitHub and is public, you can
trailing ".git"), separated by a slash. If both the username and repository name are the trailing ".git"), separated by a slash. If both the username and repository name are the
same, you can omit one. same, you can omit one.
gem "rails", :github => "rails/rails" gem "rails", github: "rails/rails"
gem "rails", :github => "rails" gem "rails", github: "rails"
Are both equivalent to Are both equivalent to
gem "rails", :git => "git://github.com/rails/rails.git" gem "rails", git: "git://github.com/rails/rails.git"
Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument. Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument.
You can also directly pass a pull request URL: You can also directly pass a pull request URL:
gem "rails", :github => "https://github.com/rails/rails/pull/43753" gem "rails", github: "https://github.com/rails/rails/pull/43753"
Which is equivalent to: Which is equivalent to:
gem "rails", :github => "rails/rails", branch: "refs/pull/43753/head" gem "rails", github: "rails/rails", branch: "refs/pull/43753/head"
### GIST ### GIST
If the git repository you want to use is hosted as a GitHub Gist and is public, you can use If the git repository you want to use is hosted as a GitHub Gist and is public, you can use
the :gist shorthand to specify the gist identifier (without the trailing ".git"). the :gist shorthand to specify the gist identifier (without the trailing ".git").
gem "the_hatch", :gist => "4815162342" gem "the_hatch", gist: "4815162342"
Is equivalent to: Is equivalent to:
gem "the_hatch", :git => "https://gist.github.com/4815162342.git" gem "the_hatch", git: "https://gist.github.com/4815162342.git"
Since the `gist` method is a specialization of `git_source`, it accepts a `:branch` named argument. Since the `gist` method is a specialization of `git_source`, it accepts a `:branch` named argument.
@ -400,12 +414,12 @@ If the git repository you want to use is hosted on Bitbucket and is public, you
trailing ".git"), separated by a slash. If both the username and repository name are the trailing ".git"), separated by a slash. If both the username and repository name are the
same, you can omit one. same, you can omit one.
gem "rails", :bitbucket => "rails/rails" gem "rails", bitbucket: "rails/rails"
gem "rails", :bitbucket => "rails" gem "rails", bitbucket: "rails"
Are both equivalent to Are both equivalent to
gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git" gem "rails", git: "https://rails@bitbucket.org/rails/rails.git"
Since the `bitbucket` method is a specialization of `git_source`, it accepts a `:branch` named argument. Since the `bitbucket` method is a specialization of `git_source`, it accepts a `:branch` named argument.
@ -423,7 +437,7 @@ version that bundler should use.
Unlike `:git`, bundler does not compile C extensions for Unlike `:git`, bundler does not compile C extensions for
gems specified as paths. gems specified as paths.
gem "rails", :path => "vendor/rails" gem "rails", path: "vendor/rails"
If you would like to use multiple local gems directly from the filesystem, you can set a global `path` option to the path containing the gem's files. This will automatically load gemspec files from subdirectories. If you would like to use multiple local gems directly from the filesystem, you can set a global `path` option to the path containing the gem's files. This will automatically load gemspec files from subdirectories.
@ -452,7 +466,7 @@ applied to a group of gems by using block form.
gem "sqlite3" gem "sqlite3"
end end
group :development, :optional => true do group :development, optional: true do
gem "wirble" gem "wirble"
gem "faker" gem "faker"
end end
@ -495,8 +509,8 @@ the `.gemspec` file.
The `gemspec` method adds any runtime dependencies as gem requirements in the The `gemspec` method adds any runtime dependencies as gem requirements in the
default group. It also adds development dependencies as gem requirements in the default group. It also adds development dependencies as gem requirements in the
`development` group. Finally, it adds a gem requirement on your project (`:path `development` group. Finally, it adds a gem requirement on your project (`path:
=> '.'`). In conjunction with `Bundler.setup`, this allows you to require project '.'`). In conjunction with `Bundler.setup`, this allows you to require project
files in your test code as you would if the project were installed as a gem; you files in your test code as you would if the project were installed as a gem; you
need not manipulate the load path manually or require project files via relative need not manipulate the load path manually or require project files via relative
paths. paths.

View file

@ -143,9 +143,12 @@ module Bundler
end end
spec_group_ruby = SpecGroup.create_for(specs_by_platform, [Gem::Platform::RUBY], Gem::Platform::RUBY) spec_group_ruby = SpecGroup.create_for(specs_by_platform, [Gem::Platform::RUBY], Gem::Platform::RUBY)
groups << spec_group_ruby if spec_group_ruby if spec_group_ruby
spec_group_ruby.force_ruby_platform = dependency.force_ruby_platform
groups << spec_group_ruby
end
next groups if @resolving_only_for_ruby next groups if @resolving_only_for_ruby || dependency.force_ruby_platform
spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform) spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform)
groups << spec_group groups << spec_group

View file

@ -4,7 +4,7 @@ module Bundler
class Resolver class Resolver
class SpecGroup class SpecGroup
attr_accessor :name, :version, :source attr_accessor :name, :version, :source
attr_accessor :activated_platforms attr_accessor :activated_platforms, :force_ruby_platform
def self.create_for(specs, all_platforms, specific_platform) def self.create_for(specs, all_platforms, specific_platform)
specific_platform_specs = specs[specific_platform] specific_platform_specs = specs[specific_platform]
@ -35,6 +35,7 @@ module Bundler
specs.map do |s| specs.map do |s|
lazy_spec = LazySpecification.new(name, version, s.platform, source) lazy_spec = LazySpecification.new(name, version, s.platform, source)
lazy_spec.force_ruby_platform = force_ruby_platform
lazy_spec.dependencies.replace s.dependencies lazy_spec.dependencies.replace s.dependencies
lazy_spec lazy_spec
end end
@ -88,7 +89,7 @@ module Bundler
dependencies = [] dependencies = []
@specs[platform].first.dependencies.each do |dep| @specs[platform].first.dependencies.each do |dep|
next if dep.type == :development next if dep.type == :development
dependencies << DepProxy.get_proxy(dep, platform) dependencies << DepProxy.get_proxy(Dependency.new(dep.name, dep.requirement), platform)
end end
dependencies dependencies
end end
@ -98,10 +99,10 @@ module Bundler
return [] if spec.is_a?(LazySpecification) return [] if spec.is_a?(LazySpecification)
dependencies = [] dependencies = []
unless spec.required_ruby_version.none? unless spec.required_ruby_version.none?
dependencies << DepProxy.get_proxy(Gem::Dependency.new("Ruby\0", spec.required_ruby_version), platform) dependencies << DepProxy.get_proxy(Dependency.new("Ruby\0", spec.required_ruby_version), platform)
end end
unless spec.required_rubygems_version.none? unless spec.required_rubygems_version.none?
dependencies << DepProxy.get_proxy(Gem::Dependency.new("RubyGems\0", spec.required_rubygems_version), platform) dependencies << DepProxy.get_proxy(Dependency.new("RubyGems\0", spec.required_rubygems_version), platform)
end end
dependencies dependencies
end end

View file

@ -125,7 +125,6 @@ module Bundler
specs_to_cache.each do |spec| specs_to_cache.each do |spec|
next if spec.name == "bundler" next if spec.name == "bundler"
next if spec.source.is_a?(Source::Gemspec) next if spec.source.is_a?(Source::Gemspec)
spec.source.send(:fetch_gem, spec) if Bundler.settings[:cache_all_platforms] && spec.source.respond_to?(:fetch_gem, true)
spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache) spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache)
end end

View file

@ -153,13 +153,11 @@ module Bundler
# Check for this spec from other sources # Check for this spec from other sources
uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).uniq uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).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])
else
path = cached_gem(spec)
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
end end
path = fetch_gem_if_possible(spec, options[:previous_spec])
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
return if Bundler.settings[:no_install] return if Bundler.settings[:no_install]
if requires_sudo? if requires_sudo?
@ -242,7 +240,7 @@ module Bundler
end end
def cache(spec, custom_path = nil) def cache(spec, custom_path = nil)
cached_path = cached_gem(spec) cached_path = Bundler.settings[:cache_all_platforms] ? fetch_gem_if_possible(spec) : cached_gem(spec)
raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path
return if File.dirname(cached_path) == Bundler.app_cache.to_s return if File.dirname(cached_path) == Bundler.app_cache.to_s
Bundler.ui.info " * #{File.basename(cached_path)}" Bundler.ui.info " * #{File.basename(cached_path)}"
@ -462,6 +460,14 @@ module Bundler
end end
end end
def fetch_gem_if_possible(spec, previous_spec = nil)
if spec.remote
fetch_gem(spec, previous_spec)
else
cached_gem(spec)
end
end
def fetch_gem(spec, previous_spec = nil) def fetch_gem(spec, previous_spec = nil)
spec.fetch_platform spec.fetch_platform

View file

@ -30,7 +30,7 @@ module Bundler
specs_for_dep.first.dependencies.each do |d| specs_for_dep.first.dependencies.each do |d|
next if d.type == :development next if d.type == :development
d = DepProxy.get_proxy(d, dep.__platform) unless match_current_platform d = DepProxy.get_proxy(Dependency.new(d.name, d.requirement), dep.__platform) unless match_current_platform
deps << d deps << d
end end
elsif check elsif check
@ -178,7 +178,7 @@ module Bundler
if match_current_platform if match_current_platform
GemHelpers.select_best_platform_match(specs_for_name.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform) GemHelpers.select_best_platform_match(specs_for_name.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
else else
specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, dep.__platform) specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, dep.force_ruby_platform ? Gem::Platform::RUBY : dep.__platform)
specs_for_name_and_platform.any? ? specs_for_name_and_platform : specs_for_name specs_for_name_and_platform.any? ? specs_for_name_and_platform : specs_for_name
end end
end end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: false # frozen_string_literal: false
module Bundler module Bundler
VERSION = "2.3.17".freeze VERSION = "2.3.18".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.17".freeze VERSION = "3.3.18".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

View file

@ -365,10 +365,11 @@ By default, this RubyGems will install gem as:
bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") } bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
# Remove bundler-*.gemspec in default specification directory. current_default_spec = Gem::Specification.default_stubs.find {|s| s.name == "bundler" }
Dir.entries(specs_dir). if current_default_spec
select {|gs| gs.start_with?("bundler-") }. File.delete(current_default_spec.loaded_from)
each {|gs| File.delete(File.join(specs_dir, gs)) } Gem::Specification.remove_spec current_default_spec
end
default_spec_path = File.join(specs_dir, "#{bundler_spec.full_name}.gemspec") default_spec_path = File.join(specs_dir, "#{bundler_spec.full_name}.gemspec")
Gem.write_binary(default_spec_path, bundler_spec.to_ruby) Gem.write_binary(default_spec_path, bundler_spec.to_ruby)

View file

@ -118,15 +118,19 @@ command to remove old versions.
updated = update_gems gems_to_update updated = update_gems gems_to_update
installed_names = highest_installed_gems.keys
updated_names = updated.map {|spec| spec.name } updated_names = updated.map {|spec| spec.name }
not_updated_names = options[:args].uniq - updated_names not_updated_names = options[:args].uniq - updated_names
not_installed_names = not_updated_names - installed_names
up_to_date_names = not_updated_names - not_installed_names
if updated.empty? if updated.empty?
say "Nothing to update" say "Nothing to update"
else else
say "Gems updated: #{updated_names.join(' ')}" say "Gems updated: #{updated_names.join(' ')}"
say "Gems already up-to-date: #{not_updated_names.join(' ')}" unless not_updated_names.empty?
end end
say "Gems already up-to-date: #{up_to_date_names.join(' ')}" unless up_to_date_names.empty?
say "Gems not currently installed: #{not_installed_names.join(' ')}" unless not_installed_names.empty?
end end
def fetch_remote_gems(spec) # :nodoc: def fetch_remote_gems(spec) # :nodoc:

View file

@ -9,11 +9,6 @@ require_relative '../rubygems'
require_relative 'command_manager' require_relative 'command_manager'
require_relative 'deprecate' require_relative 'deprecate'
##
# Load additional plugins from $LOAD_PATH
Gem.load_env_plugins rescue nil
## ##
# Run an instance of the gem program. # Run an instance of the gem program.
# #
@ -37,6 +32,9 @@ class Gem::GemRunner
do_configuration args do_configuration args
Gem.load_env_plugins rescue nil
Gem.load_plugins
cmd = @command_manager_class.instance cmd = @command_manager_class.instance
cmd.command_names.each do |command_name| cmd.command_names.each do |command_name|
@ -75,5 +73,3 @@ class Gem::GemRunner
Gem::Command.extra_args = Gem.configuration[:gem] Gem::Command.extra_args = Gem.configuration[:gem]
end end
end end
Gem.load_plugins

View file

@ -340,7 +340,7 @@ class Gem::Installer
say spec.post_install_message if options[:post_install_message] && !spec.post_install_message.nil? say spec.post_install_message if options[:post_install_message] && !spec.post_install_message.nil?
Gem::Specification.reset Gem::Specification.add_spec(spec)
run_post_install_hooks run_post_install_hooks

View file

@ -159,6 +159,10 @@ class Gem::Platform
def ===(other) def ===(other)
return nil unless Gem::Platform === other return nil unless Gem::Platform === other
# universal-mingw32 matches x64-mingw-ucrt
return true if (@cpu == 'universal' or other.cpu == 'universal') and
@os.start_with?('mingw') and other.os.start_with?('mingw')
# cpu # cpu
([nil,'universal'].include?(@cpu) or [nil, 'universal'].include?(other.cpu) or @cpu == other.cpu or ([nil,'universal'].include?(@cpu) or [nil, 'universal'].include?(other.cpu) or @cpu == other.cpu or
(@cpu == 'arm' and other.cpu.start_with?("arm"))) and (@cpu == 'arm' and other.cpu.start_with?("arm"))) and

View file

@ -883,6 +883,30 @@ class Gem::Specification < Gem::BasicSpecification
end end
end end
##
# Adds +spec+ to the known specifications, keeping the collection
# properly sorted.
def self.add_spec(spec)
return if _all.include? spec
_all << spec
stubs << spec
(@@stubs_by_name[spec.name] ||= []) << spec
_resort!(@@stubs_by_name[spec.name])
_resort!(stubs)
end
##
# Removes +spec+ from the known specs.
def self.remove_spec(spec)
_all.delete spec.to_spec
stubs.delete spec
(@@stubs_by_name[spec.name] || []).delete spec
end
## ##
# Returns all specifications. This method is discouraged from use. # Returns all specifications. This method is discouraged from use.
# You probably want to use one of the Enumerable methods instead. # You probably want to use one of the Enumerable methods instead.

View file

@ -118,6 +118,18 @@ RSpec.describe "bundle cache" do
expect(bundled_app("vendor/cache/json-#{default_json_version}.gem")).to exist expect(bundled_app("vendor/cache/json-#{default_json_version}.gem")).to exist
end end
it "caches builtin gems when cache_all_platforms is set" do
gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem "json"
G
bundle "config set cache_all_platforms true"
bundle :cache
expect(bundled_app("vendor/cache/json-#{default_json_version}.gem")).to exist
end
it "doesn't make remote request after caching the gem" do it "doesn't make remote request after caching the gem" do
build_gem "builtin_gem_2", "1.0.2", :path => bundled_app("vendor/cache") do |s| build_gem "builtin_gem_2", "1.0.2", :path => bundled_app("vendor/cache") do |s|
s.summary = "This builtin_gem is bundled with Ruby" s.summary = "This builtin_gem is bundled with Ruby"

View file

@ -0,0 +1,118 @@
# frozen_string_literal: true
RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do
context "when no transitive deps" do
before do
build_repo4 do
# Build a gem with platform specific versions
build_gem("platform_specific") do |s|
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 RUBY'"
end
build_gem("platform_specific") do |s|
s.platform = Bundler.local_platform
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 #{Bundler.local_platform}'"
end
# Build the exact same gem with a different name to compare using vs not using the option
build_gem("platform_specific_forced") do |s|
s.write "lib/platform_specific_forced.rb", "PLATFORM_SPECIFIC_FORCED = '1.0.0 RUBY'"
end
build_gem("platform_specific_forced") do |s|
s.platform = Bundler.local_platform
s.write "lib/platform_specific_forced.rb", "PLATFORM_SPECIFIC_FORCED = '1.0.0 #{Bundler.local_platform}'"
end
end
end
it "pulls the pure ruby variant of the given gem" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo4)}"
gem "platform_specific_forced", :force_ruby_platform => true
gem "platform_specific"
G
expect(the_bundle).to include_gems "platform_specific_forced 1.0.0 RUBY"
expect(the_bundle).to include_gems "platform_specific 1.0.0 #{Bundler.local_platform}"
end
it "still respects a global `force_ruby_platform` config" do
install_gemfile <<-G, :env => { "BUNDLE_FORCE_RUBY_PLATFORM" => "true" }
source "#{file_uri_for(gem_repo4)}"
gem "platform_specific_forced", :force_ruby_platform => true
gem "platform_specific"
G
expect(the_bundle).to include_gems "platform_specific_forced 1.0.0 RUBY"
expect(the_bundle).to include_gems "platform_specific 1.0.0 RUBY"
end
end
context "when also a transitive dependency" do
before do
build_repo4 do
build_gem("depends_on_platform_specific") {|s| s.add_runtime_dependency "platform_specific" }
build_gem("platform_specific") do |s|
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 RUBY'"
end
build_gem("platform_specific") do |s|
s.platform = Bundler.local_platform
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 #{Bundler.local_platform}'"
end
end
end
it "still pulls the ruby variant" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo4)}"
gem "depends_on_platform_specific"
gem "platform_specific", :force_ruby_platform => true
G
expect(the_bundle).to include_gems "platform_specific 1.0.0 RUBY"
end
end
context "with transitive dependencies with platform specific versions" do
before do
build_repo4 do
build_gem("depends_on_platform_specific") do |s|
s.add_runtime_dependency "platform_specific"
s.write "lib/depends_on_platform_specific.rb", "DEPENDS_ON_PLATFORM_SPECIFIC = '1.0.0 RUBY'"
end
build_gem("depends_on_platform_specific") do |s|
s.add_runtime_dependency "platform_specific"
s.platform = Bundler.local_platform
s.write "lib/depends_on_platform_specific.rb", "DEPENDS_ON_PLATFORM_SPECIFIC = '1.0.0 #{Bundler.local_platform}'"
end
build_gem("platform_specific") do |s|
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 RUBY'"
end
build_gem("platform_specific") do |s|
s.platform = Bundler.local_platform
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 #{Bundler.local_platform}'"
end
end
end
it "ignores ruby variants for the transitive dependencies" do
install_gemfile <<-G, :env => { "DEBUG_RESOLVER" => "true" }
source "#{file_uri_for(gem_repo4)}"
gem "depends_on_platform_specific", :force_ruby_platform => true
G
expect(the_bundle).to include_gems "depends_on_platform_specific 1.0.0 RUBY"
expect(the_bundle).to include_gems "platform_specific 1.0.0 #{Bundler.local_platform}"
end
end
end

View file

@ -216,28 +216,28 @@ RSpec.describe "bundle install across platforms" do
pry pry
BUNDLED WITH BUNDLED WITH
#{Bundler::VERSION} 1.16.1
L L
aggregate_failures do aggregate_failures do
lockfile bad_lockfile lockfile bad_lockfile
bundle :install bundle :install, :env => { "BUNDLER_VERSION" => Bundler::VERSION }
expect(lockfile).to eq good_lockfile expect(lockfile).to eq good_lockfile
lockfile bad_lockfile lockfile bad_lockfile
bundle :update, :all => true bundle :update, :all => true, :env => { "BUNDLER_VERSION" => Bundler::VERSION }
expect(lockfile).to eq good_lockfile expect(lockfile).to eq good_lockfile
lockfile bad_lockfile lockfile bad_lockfile
bundle "update ffi" bundle "update ffi", :env => { "BUNDLER_VERSION" => Bundler::VERSION }
expect(lockfile).to eq good_lockfile expect(lockfile).to eq good_lockfile
lockfile bad_lockfile lockfile bad_lockfile
bundle "update empyrean" bundle "update empyrean", :env => { "BUNDLER_VERSION" => Bundler::VERSION }
expect(lockfile).to eq good_lockfile expect(lockfile).to eq good_lockfile
lockfile bad_lockfile lockfile bad_lockfile
bundle :lock bundle :lock, :env => { "BUNDLER_VERSION" => Bundler::VERSION }
expect(lockfile).to eq good_lockfile expect(lockfile).to eq good_lockfile
end end
end end

View file

@ -163,6 +163,25 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
end end
it "shows proper path when permission errors happen", :permissions do
gemfile <<-G
source "#{source_uri}"
gem "rack"
G
versions = File.join(Bundler.rubygems.user_home, ".bundle", "cache", "compact_index",
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions")
FileUtils.mkdir_p(File.dirname(versions))
FileUtils.touch(versions)
FileUtils.chmod("-r", versions)
bundle :install, :artifice => "compact_index", :raise_on_error => false
expect(err).to include(
"There was an error while trying to read from `#{versions}`. It is likely that you need to grant read permissions for that path."
)
end
it "falls back when the user's home directory does not exist or is not writable" do it "falls back when the user's home directory does not exist or is not writable" do
ENV["HOME"] = tmp("missing_home").to_s ENV["HOME"] = tmp("missing_home").to_s

View file

@ -337,6 +337,14 @@ RSpec.describe "Resolving platform craziness" do
should_resolve_as %w[thin-1.2.7-x64-mingw-ucrt] should_resolve_as %w[thin-1.2.7-x64-mingw-ucrt]
end end
end end
if Gem.rubygems_version >= Gem::Version.new("3.3.18")
it "finds universal-mingw gems on x64-mingw-ucrt" do
platform "x64-mingw-ucrt"
dep "win32-api"
should_resolve_as %w[win32-api-1.5.1-universal-mingw32]
end
end
end end
describe "with conflicting cases" do describe "with conflicting cases" do

View file

@ -255,6 +255,95 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
expect(the_bundle).to include_gems "platform_specific 1.0 RUBY" expect(the_bundle).to include_gems "platform_specific 1.0 RUBY"
end end
it "doesn't pull platform specific gems on truffleruby (except when whitelisted) even if lockfile was generated with an older version that declared RUBY as platform", :truffleruby_only do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "platform_specific"
G
lockfile <<-L
GEM
remote: #{file_uri_for(gem_repo1)}/
specs:
platform_specific (1.0)
PLATFORMS
ruby
DEPENDENCIES
platform_specific
BUNDLED WITH
#{Bundler::VERSION}
L
bundle "install"
expect(the_bundle).to include_gems "platform_specific 1.0 RUBY"
simulate_platform "x86_64-linux" do
build_repo4 do
build_gem "libv8"
build_gem "libv8" do |s|
s.platform = "x86_64-linux"
end
end
gemfile <<-G
source "#{file_uri_for(gem_repo4)}"
gem "libv8"
G
lockfile <<-L
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
libv8 (1.0)
PLATFORMS
ruby
DEPENDENCIES
libv8
BUNDLED WITH
#{Bundler::VERSION}
L
bundle "install"
expect(the_bundle).to include_gems "libv8 1.0 x86_64-linux"
end
end
it "doesn't pull platform specific gems on truffleruby, even if lockfile only includes those", :truffleruby_only do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "platform_specific"
G
lockfile <<-L
GEM
remote: #{file_uri_for(gem_repo1)}/
specs:
platform_specific (1.0-x86-darwin-100)
PLATFORMS
x86-darwin-100
DEPENDENCIES
platform_specific
BUNDLED WITH
#{Bundler::VERSION}
L
bundle "install"
expect(the_bundle).to include_gems "platform_specific 1.0 RUBY"
end
it "allows specifying only-ruby-platform on windows with dependency platforms" do it "allows specifying only-ruby-platform on windows with dependency platforms" do
simulate_windows do simulate_windows do
install_gemfile <<-G install_gemfile <<-G

View file

@ -663,6 +663,22 @@ RSpec.describe "Bundler.setup" do
expect(err).to be_empty expect(err).to be_empty
end end
it "doesn't re-resolve when deleting dependencies" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
gem "actionpack"
G
install_gemfile <<-G, :verbose => true
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
expect(out).to include("Some dependencies were deleted, using a subset of the resolution from the lockfile")
expect(err).to be_empty
end
it "remembers --without and does not include groups passed to Bundler.setup" do it "remembers --without and does not include groups passed to Bundler.setup" do
bundle "config set --local without rails" bundle "config set --local without rails"
install_gemfile <<-G install_gemfile <<-G

View file

@ -14,6 +14,10 @@ module Gem
@default_specifications_dir = nil @default_specifications_dir = nil
end end
if ENV["BUNDLER_SPEC_WINDOWS"]
@@win_platform = true # rubocop:disable Sryle/ClassVars
end
if ENV["BUNDLER_SPEC_PLATFORM"] if ENV["BUNDLER_SPEC_PLATFORM"]
class Platform class Platform
@local = new(ENV["BUNDLER_SPEC_PLATFORM"]) @local = new(ENV["BUNDLER_SPEC_PLATFORM"])

View file

@ -446,11 +446,15 @@ module Spec
end end
def simulate_windows(platform = mswin) def simulate_windows(platform = mswin)
old = ENV["BUNDLER_SPEC_WINDOWS"]
ENV["BUNDLER_SPEC_WINDOWS"] = "true"
simulate_platform platform do simulate_platform platform do
simulate_bundler_version_when_missing_prerelease_default_gem_activation do simulate_bundler_version_when_missing_prerelease_default_gem_activation do
yield yield
end end
end end
ensure
ENV["BUNDLER_SPEC_WINDOWS"] = old
end end
def simulate_bundler_version_when_missing_prerelease_default_gem_activation def simulate_bundler_version_when_missing_prerelease_default_gem_activation

View file

@ -137,8 +137,8 @@ module Spec
ENV["BUNDLE_PATH__SYSTEM"] = "true" ENV["BUNDLE_PATH__SYSTEM"] = "true"
end end
output = `#{Gem.ruby} #{File.expand_path("support/bundle.rb", Path.spec_dir)} install --verbose` puts `#{Gem.ruby} #{File.expand_path("support/bundle.rb", Path.spec_dir)} install --verbose`
raise "Error when installing gems in #{gemfile}: #{output}" unless $?.success? raise unless $?.success?
ensure ensure
if path if path
ENV["BUNDLE_PATH"] = old_path ENV["BUNDLE_PATH"] = old_path

View file

@ -412,6 +412,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
install_gem specs["b-1"] install_gem specs["b-1"]
FileUtils.rm File.join(gemhome2, 'cache', 'b-1.gem') FileUtils.rm File.join(gemhome2, 'cache', 'b-1.gem')
Gem::Specification.reset
@cmd.options[:args] = %w[a b] @cmd.options[:args] = %w[a b]

View file

@ -535,6 +535,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
out = @ui.output.split "\n" out = @ui.output.split "\n"
assert_equal "Updating installed gems", out.shift assert_equal "Updating installed gems", out.shift
assert_equal "Nothing to update", out.shift assert_equal "Nothing to update", out.shift
assert_equal "Gems already up-to-date: a", out.shift
assert_empty out assert_empty out
end end
@ -811,4 +812,24 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_equal " a-2", out.shift assert_equal " a-2", out.shift
assert_empty out assert_empty out
end end
def test_execute_named_not_installed_and_no_update
spec_fetcher do |fetcher|
fetcher.spec 'a', 2
end
@cmd.options[:args] = %w[a b]
use_ui @ui do
@cmd.execute
end
out = @ui.output.split "\n"
assert_equal "Updating installed gems", out.shift
assert_equal "Nothing to update", out.shift
assert_equal "Gems already up-to-date: a", out.shift
assert_equal "Gems not currently installed: b", out.shift
assert_empty out
end
end end

View file

@ -160,9 +160,9 @@ dependencies = [
[[package]] [[package]]
name = "rb-sys" name = "rb-sys"
version = "0.9.15" version = "0.9.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "104c5bcb9fa23bf3823124c003c516b22664fef50c4a481ff2d0e21b76e0f92c" checksum = "8df6990035ed930322a6b8a73783ea6af88acffd2b4322932b0eb0766a5a8673"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"linkify", "linkify",
@ -171,9 +171,9 @@ dependencies = [
[[package]] [[package]]
name = "rb-sys-build" name = "rb-sys-build"
version = "0.9.15" version = "0.9.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cdf919b75ba95aa480159f3b20070cbec110d6c8a7af86b35844270069a4cb3" checksum = "a9c3c88da760bbc2f26bbfd1acbfe9de3faa87be55feaf3413a33539d066ff3c"
dependencies = [ dependencies = [
"regex", "regex",
"shell-words", "shell-words",

View file

@ -7,4 +7,4 @@ edition = "2021"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]
rb-sys = { version = "0.9.15", features = ["gem"] } rb-sys = { version = "0.9.19", features = ["gem"] }

View file

@ -15,7 +15,7 @@ gemspec = File.expand_path('custom_name.gemspec', __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"))
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 -rcustom_name -e "puts 'Result: ' + CustomName.say_hello") system %q(ruby -rcustom_name -e "puts 'Result: ' + CustomName.say_hello")
end end

View file

@ -153,9 +153,9 @@ dependencies = [
[[package]] [[package]]
name = "rb-sys" name = "rb-sys"
version = "0.9.15" version = "0.9.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "104c5bcb9fa23bf3823124c003c516b22664fef50c4a481ff2d0e21b76e0f92c" checksum = "8df6990035ed930322a6b8a73783ea6af88acffd2b4322932b0eb0766a5a8673"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"linkify", "linkify",
@ -164,9 +164,9 @@ dependencies = [
[[package]] [[package]]
name = "rb-sys-build" name = "rb-sys-build"
version = "0.9.15" version = "0.9.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cdf919b75ba95aa480159f3b20070cbec110d6c8a7af86b35844270069a4cb3" checksum = "a9c3c88da760bbc2f26bbfd1acbfe9de3faa87be55feaf3413a33539d066ff3c"
dependencies = [ dependencies = [
"regex", "regex",
"shell-words", "shell-words",

View file

@ -7,4 +7,4 @@ edition = "2021"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]
rb-sys = { version = "0.9.15", features = ["gem"] } rb-sys = { version = "0.9.19", features = ["gem"] }

View file

@ -280,6 +280,22 @@ class TestGemPlatform < Gem::TestCase
refute((Gem::Platform.local === arm), 'armv7 === arm') refute((Gem::Platform.local === arm), 'armv7 === arm')
end end
def test_equals3_universal_mingw
uni_mingw = Gem::Platform.new 'universal-mingw'
mingw32 = Gem::Platform.new 'x64-mingw32'
mingw_ucrt = Gem::Platform.new 'x64-mingw-ucrt'
util_set_arch 'x64-mingw32'
assert((uni_mingw === Gem::Platform.local), 'uni_mingw === mingw32')
assert((mingw32 === Gem::Platform.local), 'mingw32 === mingw32')
refute((mingw_ucrt === Gem::Platform.local), 'mingw32 === mingw_ucrt')
util_set_arch 'x64-mingw-ucrt'
assert((uni_mingw === Gem::Platform.local), 'uni_mingw === mingw32')
assert((mingw_ucrt === Gem::Platform.local), 'mingw_ucrt === mingw_ucrt')
refute((mingw32 === Gem::Platform.local), 'mingw32 === mingw_ucrt')
end
def test_equals3_version def test_equals3_version
util_set_arch 'i686-darwin8' util_set_arch 'i686-darwin8'

View file

@ -3677,6 +3677,8 @@ end
install_specs b install_specs b
Gem::Specification.reset
assert Gem::Specification.find_by_name "b" assert Gem::Specification.find_by_name "b"
assert_raise Gem::MissingSpecVersionError do assert_raise Gem::MissingSpecVersionError do

View file

@ -53,4 +53,4 @@ DEPENDENCIES
webrick (~> 1.6) webrick (~> 1.6)
BUNDLED WITH BUNDLED WITH
2.3.17 2.3.18

View file

@ -62,4 +62,4 @@ DEPENDENCIES
test-unit test-unit
BUNDLED WITH BUNDLED WITH
2.3.17 2.3.18

View file

@ -68,4 +68,4 @@ DEPENDENCIES
test-unit test-unit
BUNDLED WITH BUNDLED WITH
2.3.17 2.3.18

View file

@ -43,4 +43,4 @@ DEPENDENCIES
webrick (= 1.7.0) webrick (= 1.7.0)
BUNDLED WITH BUNDLED WITH
2.3.17 2.3.18