Merge RubyGems-3.3.19 and Bundler-2.3.19

This commit is contained in:
Hiroshi SHIBATA 2022-08-22 11:49:38 +09:00 committed by nagachika
parent 0918783347
commit 44c926f3a9
362 changed files with 7843 additions and 7605 deletions

View file

@ -53,6 +53,7 @@ module Bundler
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__) autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__) autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
autoload :Graph, File.expand_path("bundler/graph", __dir__) autoload :Graph, File.expand_path("bundler/graph", __dir__)
autoload :IncompleteSpecification, File.expand_path("bundler/incomplete_specification", __dir__)
autoload :Index, File.expand_path("bundler/index", __dir__) autoload :Index, File.expand_path("bundler/index", __dir__)
autoload :Injector, File.expand_path("bundler/injector", __dir__) autoload :Injector, File.expand_path("bundler/injector", __dir__)
autoload :Installer, File.expand_path("bundler/installer", __dir__) autoload :Installer, File.expand_path("bundler/installer", __dir__)

View file

@ -15,6 +15,7 @@ module Bundler
end end
def self.output_fund_metadata_summary def self.output_fund_metadata_summary
return if Bundler.settings["ignore_funding_requests"]
definition = Bundler.definition definition = Bundler.definition
current_dependencies = definition.requested_dependencies current_dependencies = definition.requested_dependencies
current_specs = definition.specs current_specs = definition.specs

View file

@ -138,13 +138,13 @@ module Bundler
@unlock[:gems] ||= @dependencies.map(&:name) @unlock[:gems] ||= @dependencies.map(&:name)
else else
eager_unlock = expand_dependencies(@unlock[:gems] || [], true) eager_unlock = expand_dependencies(@unlock[:gems] || [], true)
@unlock[:gems] = @locked_specs.for(eager_unlock, false, false).map(&:name) @unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name)
end end
@dependency_changes = converge_dependencies @dependency_changes = converge_dependencies
@local_changes = converge_locals @local_changes = converge_locals
@locked_specs_incomplete_for_platform = !@locked_specs.for(requested_dependencies & expand_dependencies(locked_dependencies), true, true) @reresolve = nil
@requires = compute_requires @requires = compute_requires
end end
@ -279,11 +279,8 @@ module Bundler
end end
end end
else else
last_resolve = converge_locked_specs
# Run a resolve against the locally available gems
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}") Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true) @reresolve = reresolve
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
end end
end end
@ -468,7 +465,7 @@ module Bundler
private :sources private :sources
def nothing_changed? def nothing_changed?
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@locked_specs_incomplete_for_platform !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes
end end
def unlocking? def unlocking?
@ -477,8 +474,14 @@ module Bundler
private private
def reresolve
last_resolve = converge_locked_specs
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
end
def filter_specs(specs, deps) def filter_specs(specs, deps)
SpecSet.new(specs).for(expand_dependencies(deps, true), false, false) SpecSet.new(specs).for(expand_dependencies(deps, true), false, platforms)
end end
def materialize(dependencies) def materialize(dependencies)
@ -495,7 +498,22 @@ module Bundler
"removed in order to install." "removed in order to install."
end end
raise GemNotFound, "Could not find #{missing_specs.map(&:full_name).join(", ")} in any of the sources" missing_specs_list = missing_specs.group_by(&:source).map do |source, missing_specs_for_source|
"#{missing_specs_for_source.map(&:full_name).join(", ")} in #{source}"
end
raise GemNotFound, "Could not find #{missing_specs_list.join(" nor ")}"
end
if @reresolve.nil?
incomplete_specs = specs.incomplete_specs
if incomplete_specs.any?
Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
@unlock[:gems].concat(incomplete_specs.map(&:name))
@resolve = reresolve
specs = resolve.materialize(dependencies)
end
end end
unless specs["bundler"].any? unless specs["bundler"].any?
@ -545,7 +563,6 @@ module Bundler
[@new_platform, "you added a new platform to your gemfile"], [@new_platform, "you added a new platform to your gemfile"],
[@path_changes, "the gemspecs for path gems changed"], [@path_changes, "the gemspecs for path gems changed"],
[@local_changes, "the gemspecs for git local gems changed"], [@local_changes, "the gemspecs for git local gems changed"],
[@locked_specs_incomplete_for_platform, "the lockfile does not have all gems needed for the current platform"],
].select(&:first).map(&:last).join(", ") ].select(&:first).map(&:last).join(", ")
end end
@ -721,7 +738,7 @@ module Bundler
# if we won't need the source (according to the lockfile), # if we won't need the source (according to the lockfile),
# don't error if the path/git source isn't available # don't error if the path/git source isn't available
next if specs. next if specs.
for(requested_dependencies, false, true). for(requested_dependencies, false).
none? {|locked_spec| locked_spec.source == s.source } none? {|locked_spec| locked_spec.source == s.source }
raise raise
@ -789,7 +806,9 @@ module Bundler
end end
def requested_groups def requested_groups
groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with] values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
values
end end
def lockfiles_equal?(current, proposed, preserve_unknown_sections) def lockfiles_equal?(current, proposed, preserve_unknown_sections)

View file

@ -465,12 +465,12 @@ module Bundler
def multiple_global_source_warning def multiple_global_source_warning
if Bundler.feature_flag.bundler_3_mode? if Bundler.feature_flag.bundler_3_mode?
msg = "This Gemfile contains multiple primary sources. " \ msg = "This Gemfile contains multiple global sources. " \
"Each source after the first must include a block to indicate which gems " \ "Each source after the first must include a block to indicate which gems " \
"should come from that source" "should come from that source"
raise GemfileEvalError, msg raise GemfileEvalError, msg
else else
Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \ Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple global sources. " \
"Using `source` more than once without a block is a security risk, and " \ "Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \ "may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source." "a block to indicate which gems should come from the secondary source."

View file

@ -56,17 +56,17 @@ module Bundler
# Search this index's specs, and any source indexes that this index knows # Search this index's specs, and any source indexes that this index knows
# about, returning all of the results. # about, returning all of the results.
def search(query, base = nil) def search(query)
sort_specs(unsorted_search(query, base)) sort_specs(unsorted_search(query))
end end
def unsorted_search(query, base) def unsorted_search(query)
results = local_search(query, base) results = local_search(query)
seen = results.map(&:full_name).uniq unless @sources.empty? seen = results.map(&:full_name).uniq unless @sources.empty?
@sources.each do |source| @sources.each do |source|
source.unsorted_search(query, base).each do |spec| source.unsorted_search(query).each do |spec|
next if seen.include?(spec.full_name) next if seen.include?(spec.full_name)
seen << spec.full_name seen << spec.full_name
@ -89,12 +89,12 @@ module Bundler
self.class.sort_specs(specs) self.class.sort_specs(specs)
end end
def local_search(query, base = nil) def local_search(query)
case query case query
when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query) when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query)
when String then specs_by_name(query) when String then specs_by_name(query)
when Gem::Dependency then search_by_dependency(query, base) when Gem::Dependency then search_by_dependency(query)
when DepProxy then search_by_dependency(query.dep, base) when DepProxy then search_by_dependency(query.dep)
else else
raise "You can't search for a #{query.inspect}." raise "You can't search for a #{query.inspect}."
end end
@ -185,11 +185,9 @@ module Bundler
@specs[name].values @specs[name].values
end end
def search_by_dependency(dependency, base = nil) def search_by_dependency(dependency)
@cache[base || false] ||= {} @cache[dependency] ||= begin
@cache[base || false][dependency] ||= begin
specs = specs_by_name(dependency.name) specs = specs_by_name(dependency.name)
specs += base if base
found = specs.select do |spec| found = specs.select do |spec|
next true if spec.source.is_a?(Source::Gemspec) next true if spec.source.is_a?(Source::Gemspec)
dependency.matches_spec?(spec) dependency.matches_spec?(spec)

View file

@ -19,7 +19,7 @@ module Bundler
end end
def full_name def full_name
if platform == Gem::Platform::RUBY || platform.nil? if platform == Gem::Platform::RUBY
"#{@name}-#{@version}" "#{@name}-#{@version}"
else else
"#{@name}-#{@version}-#{platform}" "#{@name}-#{@version}-#{platform}"
@ -61,7 +61,7 @@ module Bundler
def to_lock def to_lock
out = String.new out = String.new
if platform == Gem::Platform::RUBY || platform.nil? if platform == Gem::Platform::RUBY
out << " #{name} (#{version})\n" out << " #{name} (#{version})\n"
else else
out << " #{name} (#{version}-#{platform})\n" out << " #{name} (#{version}-#{platform})\n"
@ -75,7 +75,17 @@ module Bundler
out out
end end
def __materialize__ def materialize_for_installation
__materialize__(ruby_platform_materializes_to_ruby_platform? ? platform : Bundler.local_platform)
end
def materialize_for_resolution
return self unless Gem::Platform.match_spec?(self)
__materialize__(platform)
end
def __materialize__(platform)
@specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
source.gemspec.tap {|s| s.source = source } source.gemspec.tap {|s| s.source = source }
else else
@ -84,10 +94,9 @@ module Bundler
else else
ruby_platform_materializes_to_ruby_platform? ? self : Dependency.new(name, version) ruby_platform_materializes_to_ruby_platform? ? self : Dependency.new(name, version)
end end
platform_object = ruby_platform_materializes_to_ruby_platform? ? Gem::Platform.new(platform) : Gem::Platform.local
candidates = source.specs.search(search_object) candidates = source.specs.search(search_object)
same_platform_candidates = candidates.select do |spec| same_platform_candidates = candidates.select do |spec|
MatchPlatform.platforms_match?(spec.platform, platform_object) MatchPlatform.platforms_match?(spec.platform, platform)
end end
installable_candidates = same_platform_candidates.select do |spec| installable_candidates = same_platform_candidates.select do |spec|
spec.is_a?(StubSpecification) || spec.is_a?(StubSpecification) ||
@ -105,7 +114,7 @@ module Bundler
end end
def to_s def to_s
@__to_s ||= if platform == Gem::Platform::RUBY || platform.nil? @__to_s ||= if platform == Gem::Platform::RUBY
"#{name} (#{version})" "#{name} (#{version})"
else else
"#{name} (#{version}-#{platform})" "#{name} (#{version}-#{platform})"

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" "June 2022" "" "" .TH "BUNDLE\-ADD" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-BINSTUBS" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-CACHE" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-CHECK" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-CLEAN" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-CONFIG" "1" "July 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options \fBbundle\-config\fR \- Set bundler configuration options
@ -74,6 +74,10 @@ Creates a directory (defaults to \fB~/bin\fR) and place any executables from the
In deployment mode, Bundler will \'roll\-out\' the bundle for \fBproduction\fR use\. Please check carefully if you want to have this option enabled in \fBdevelopment\fR or \fBtest\fR environments\. In deployment mode, Bundler will \'roll\-out\' the bundle for \fBproduction\fR use\. Please check carefully if you want to have this option enabled in \fBdevelopment\fR or \fBtest\fR environments\.
. .
.TP .TP
\fBonly\fR
A space\-separated list of groups to install only gems of the specified groups\.
.
.TP
\fBpath\fR \fBpath\fR
The location to install the specified gems to\. This defaults to Rubygems\' setting\. Bundler shares this location with Rubygems, \fBgem install \.\.\.\fR will have gem installed there, too\. Therefore, gems installed without a \fB\-\-path \.\.\.\fR setting will show up by calling \fBgem list\fR\. Accordingly, gems installed to other locations will not get listed\. The location to install the specified gems to\. This defaults to Rubygems\' setting\. Bundler shares this location with Rubygems, \fBgem install \.\.\.\fR will have gem installed there, too\. Therefore, gems installed without a \fB\-\-path \.\.\.\fR setting will show up by calling \fBgem list\fR\. Accordingly, gems installed to other locations will not get listed\.
. .
@ -205,6 +209,9 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBglobal_gem_cache\fR (\fBBUNDLE_GLOBAL_GEM_CACHE\fR): Whether Bundler should cache all gems globally, rather than locally to the installing Ruby installation\. \fBglobal_gem_cache\fR (\fBBUNDLE_GLOBAL_GEM_CACHE\fR): Whether Bundler should cache all gems globally, rather than locally to the installing Ruby installation\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBignore_funding_requests\fR (\fBBUNDLE_IGNORE_FUNDING_REQUESTS\fR): When set, no funding requests will be printed\.
.
.IP "\(bu" 4
\fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\. \fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
@ -220,6 +227,9 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBno_prune\fR (\fBBUNDLE_NO_PRUNE\fR): Whether Bundler should leave outdated gems unpruned when caching\. \fBno_prune\fR (\fBBUNDLE_NO_PRUNE\fR): Whether Bundler should leave outdated gems unpruned when caching\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBonly\fR (\fBBUNDLE_ONLY\fR): A space\-separated list of groups to install only gems of the specified groups\.
.
.IP "\(bu" 4
\fBpath\fR (\fBBUNDLE_PATH\fR): The location on disk where all gems in your bundle will be located regardless of \fB$GEM_HOME\fR or \fB$GEM_PATH\fR values\. Bundle gems not found in this location will be installed by \fBbundle install\fR\. Defaults to \fBGem\.dir\fR\. When \-\-deployment is used, defaults to vendor/bundle\. \fBpath\fR (\fBBUNDLE_PATH\fR): The location on disk where all gems in your bundle will be located regardless of \fB$GEM_HOME\fR or \fB$GEM_PATH\fR values\. Bundle gems not found in this location will be installed by \fBbundle install\fR\. Defaults to \fBGem\.dir\fR\. When \-\-deployment is used, defaults to vendor/bundle\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
@ -342,13 +352,13 @@ bundle config set \-\-global mirror\.SOURCE_URL MIRROR_URL
.IP "" 0 .IP "" 0
. .
.P .P
For example, to use a mirror of rubygems\.org hosted at rubygems\-mirror\.org: For example, to use a mirror of https://rubygems\.org hosted at https://example\.org:
. .
.IP "" 4 .IP "" 4
. .
.nf .nf
bundle config set \-\-global mirror\.http://rubygems\.org http://rubygems\-mirror\.org bundle config set \-\-global mirror\.https://rubygems\.org https://example\.org
. .
.fi .fi
. .

View file

@ -74,6 +74,9 @@ The options that can be configured are:
`production` use. Please check carefully if you want to have this option `production` use. Please check carefully if you want to have this option
enabled in `development` or `test` environments. enabled in `development` or `test` environments.
* `only`:
A space-separated list of groups to install only gems of the specified groups.
* `path`: * `path`:
The location to install the specified gems to. This defaults to Rubygems' The location to install the specified gems to. This defaults to Rubygems'
setting. Bundler shares this location with Rubygems, `gem install ...` will setting. Bundler shares this location with Rubygems, `gem install ...` will
@ -204,6 +207,8 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`): * `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`):
Whether Bundler should cache all gems globally, rather than locally to the Whether Bundler should cache all gems globally, rather than locally to the
installing Ruby installation. installing Ruby installation.
* `ignore_funding_requests` (`BUNDLE_IGNORE_FUNDING_REQUESTS`):
When set, no funding requests will be printed.
* `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`): * `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`):
When set, no post install messages will be printed. To silence a single gem, When set, no post install messages will be printed. To silence a single gem,
use dot notation like `ignore_messages.httparty true`. use dot notation like `ignore_messages.httparty true`.
@ -216,6 +221,8 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
Whether `bundle package` should skip installing gems. Whether `bundle package` should skip installing gems.
* `no_prune` (`BUNDLE_NO_PRUNE`): * `no_prune` (`BUNDLE_NO_PRUNE`):
Whether Bundler should leave outdated gems unpruned when caching. Whether Bundler should leave outdated gems unpruned when caching.
* `only` (`BUNDLE_ONLY`):
A space-separated list of groups to install only gems of the specified groups.
* `path` (`BUNDLE_PATH`): * `path` (`BUNDLE_PATH`):
The location on disk where all gems in your bundle will be located regardless The location on disk where all gems in your bundle will be located regardless
of `$GEM_HOME` or `$GEM_PATH` values. Bundle gems not found in this location of `$GEM_HOME` or `$GEM_PATH` values. Bundle gems not found in this location
@ -321,9 +328,9 @@ mirror to fetch gems.
bundle config set --global mirror.SOURCE_URL MIRROR_URL bundle config set --global mirror.SOURCE_URL MIRROR_URL
For example, to use a mirror of rubygems.org hosted at rubygems-mirror.org: For example, to use a mirror of https://rubygems.org hosted at https://example.org:
bundle config set --global mirror.http://rubygems.org http://rubygems-mirror.org bundle config set --global mirror.https://rubygems.org https://example.org
Each mirror also provides a fallback timeout setting. If the mirror does not Each mirror also provides a fallback timeout setting. If the mirror does not
respond within the fallback timeout, Bundler will try to use the original respond within the fallback timeout, Bundler will try to use the original

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" "June 2022" "" "" .TH "BUNDLE\-DOCTOR" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-EXEC" "1" "July 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
@ -155,7 +155,7 @@ You can find a list of all the gems containing gem plugins by running
. .
.nf .nf
ruby \-rrubygems \-e "puts Gem\.find_files(\'rubygems_plugin\.rb\')" ruby \-e "puts Gem\.find_files(\'rubygems_plugin\.rb\')"
. .
.fi .fi
. .

View file

@ -145,7 +145,7 @@ their plugins.
You can find a list of all the gems containing gem plugins You can find a list of all the gems containing gem plugins
by running by running
ruby -rrubygems -e "puts Gem.find_files('rubygems_plugin.rb')" ruby -e "puts Gem.find_files('rubygems_plugin.rb')"
At the very least, you should remove all but the newest At the very least, you should remove all but the newest
version of each gem plugin, and also remove all gem plugins version of each gem plugin, and also remove all gem plugins

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" "June 2022" "" "" .TH "BUNDLE\-GEM" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-INFO" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-INIT" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-INJECT" "1" "July 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
@ -30,4 +30,7 @@ bundle inject \'rack\' \'> 0\'
.IP "" 0 .IP "" 0
. .
.P .P
This will inject the \'rack\' gem with a version greater than 0 in your [\fBGemfile(5)\fR][Gemfile(5)] and Gemfile\.lock This will inject the \'rack\' gem with a version greater than 0 in your [\fBGemfile(5)\fR][Gemfile(5)] and Gemfile\.lock\.
.
.P
The \fBbundle inject\fR command was deprecated in Bundler 2\.1 and will be removed in Bundler 3\.0\.

View file

@ -19,4 +19,6 @@ Example:
bundle inject 'rack' '> 0' bundle inject 'rack' '> 0'
This will inject the 'rack' gem with a version greater than 0 in your This will inject the 'rack' gem with a version greater than 0 in your
[`Gemfile(5)`][Gemfile(5)] and Gemfile.lock [`Gemfile(5)`][Gemfile(5)] and Gemfile.lock.
The `bundle inject` command was deprecated in Bundler 2.1 and will be removed in Bundler 3.0.

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" "June 2022" "" "" .TH "BUNDLE\-INSTALL" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-LIST" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-LOCK" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-OPEN" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-OUTDATED" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-PLATFORM" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-PRISTINE" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-REMOVE" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-SHOW" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-UPDATE" "1" "July 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" "June 2022" "" "" .TH "BUNDLE\-VIZ" "1" "July 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
@ -15,6 +15,9 @@
.P .P
The associated gems must also be installed via \fBbundle install(1)\fR \fIbundle\-install\.1\.html\fR\. The associated gems must also be installed via \fBbundle install(1)\fR \fIbundle\-install\.1\.html\fR\.
. .
.P
\fBviz\fR command was deprecated in Bundler 2\.2\. Use bundler\-graph plugin \fIhttps://github\.com/rubygems/bundler\-graph\fR instead\.
.
.SH "OPTIONS" .SH "OPTIONS"
. .
.TP .TP

View file

@ -16,6 +16,8 @@ bundle-viz(1) -- Generates a visual dependency graph for your Gemfile
The associated gems must also be installed via [`bundle install(1)`](bundle-install.1.html). The associated gems must also be installed via [`bundle install(1)`](bundle-install.1.html).
`viz` command was deprecated in Bundler 2.2. Use [bundler-graph plugin](https://github.com/rubygems/bundler-graph) instead.
## OPTIONS ## OPTIONS
* `--file`, `-f`: * `--file`, `-f`:

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" "June 2022" "" "" .TH "BUNDLE" "1" "July 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\fR \- Ruby Dependency Management \fBbundle\fR \- Ruby Dependency Management
@ -93,7 +93,7 @@ Open an installed gem in the editor
Generate a lockfile for your dependencies Generate a lockfile for your dependencies
. .
.TP .TP
\fBbundle viz(1)\fR \fIbundle\-viz\.1\.html\fR \fBbundle viz(1)\fR \fIbundle\-viz\.1\.html\fR (deprecated)
Generate a visual representation of your dependencies Generate a visual representation of your dependencies
. .
.TP .TP
@ -130,7 +130,7 @@ These commands are obsolete and should no longer be used:
\fBbundle cache(1)\fR \fBbundle cache(1)\fR
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBbundle show(1)\fR \fBbundle inject(1)\fR
. .
.IP "" 0 .IP "" 0

View file

@ -76,7 +76,7 @@ We divide `bundle` subcommands into primary commands and utilities:
* [`bundle lock(1)`](bundle-lock.1.html): * [`bundle lock(1)`](bundle-lock.1.html):
Generate a lockfile for your dependencies Generate a lockfile for your dependencies
* [`bundle viz(1)`](bundle-viz.1.html): * [`bundle viz(1)`](bundle-viz.1.html) (deprecated):
Generate a visual representation of your dependencies Generate a visual representation of your dependencies
* [`bundle init(1)`](bundle-init.1.html): * [`bundle init(1)`](bundle-init.1.html):
@ -108,4 +108,4 @@ and execute it, passing down any extra arguments to it.
These commands are obsolete and should no longer be used: These commands are obsolete and should no longer be used:
* `bundle cache(1)` * `bundle cache(1)`
* `bundle show(1)` * `bundle inject(1)`

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" "June 2022" "" "" .TH "GEMFILE" "5" "July 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
@ -15,8 +15,8 @@ Place the \fBGemfile\fR in the root of the directory containing the associated c
.SH "SYNTAX" .SH "SYNTAX"
A \fBGemfile\fR is evaluated as Ruby code, in a context which makes available a number of methods used to describe the gem requirements\. A \fBGemfile\fR is evaluated as Ruby code, in a context which makes available a number of methods used to describe the gem requirements\.
. .
.SH "GLOBAL SOURCES" .SH "GLOBAL SOURCE"
At the top of the \fBGemfile\fR, add a line for the \fBRubygems\fR source that contains the gems listed in the \fBGemfile\fR\. At the top of the \fBGemfile\fR, add a single line for the \fBRubyGems\fR source that contains the gems listed in the \fBGemfile\fR\.
. .
.IP "" 4 .IP "" 4
. .
@ -29,10 +29,16 @@ source "https://rubygems\.org"
.IP "" 0 .IP "" 0
. .
.P .P
It is possible, but not recommended as of Bundler 1\.7, to add multiple global \fBsource\fR lines\. Each of these \fBsource\fRs \fBMUST\fR be a valid Rubygems repository\. You can add only one global source\. In Bundler 1\.13, adding multiple global sources was deprecated\. The \fBsource\fR \fBMUST\fR be a valid RubyGems repository\.
. .
.P .P
Sources are checked for gems following the heuristics described in \fISOURCE PRIORITY\fR\. If a gem is found in more than one global source, Bundler will print a warning after installing the gem indicating which source was used, and listing the other sources where the gem is available\. A specific source can be selected for gems that need to use a non\-standard repository, suppressing this warning, by using the \fI\fB:source\fR option\fR or a \fI\fBsource\fR block\fR\. To use more than one source of RubyGems, you should use \fI\fBsource\fR block\fR\.
.
.P
A source is checked for gems following the heuristics described in \fISOURCE PRIORITY\fR\.
.
.P
\fBNote about a behavior of the feature deprecated in Bundler 1\.13\fR: If a gem is found in more than one global source, Bundler will print a warning after installing the gem indicating which source was used, and listing the other sources where the gem is available\. A specific source can be selected for gems that need to use a non\-standard repository, suppressing this warning, by using the \fI\fB:source\fR option\fR or \fBsource\fR block\.
. .
.SS "CREDENTIALS" .SS "CREDENTIALS"
Some gem sources require a username and password\. Use bundle config(1) \fIbundle\-config\.1\.html\fR to set the username and password for any of the sources that need it\. The command must be run once on each computer that will install the Gemfile, but this keeps the credentials from being stored in plain text in version control\. Some gem sources require a username and password\. Use bundle config(1) \fIbundle\-config\.1\.html\fR to set the username and password for any of the sources that need it\. The command must be run once on each computer that will install the Gemfile, but this keeps the credentials from being stored in plain text in version control\.
@ -356,7 +362,7 @@ The platform specific variant does not yet support a newer ruby (and thus has a
.IP "" 0 .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\.
. .
.IP "" 4 .IP "" 4
. .
@ -369,13 +375,13 @@ gem "some_internal_gem", source: "https://gems\.example\.com"
.IP "" 0 .IP "" 0
. .
.P .P
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, it will not be installed\. This forces the gem to be loaded from this source and ignores the global source declared at the top level of the file\. If the gem does not exist in this source, it will not be installed\.
. .
.P .P
Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on global sources using the ordering described in \fISOURCE PRIORITY\fR\. Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on the global source\.
. .
.P .P
Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in \fIGLOBAL SOURCES (#source)\fR\. \fBNote about a behavior of the feature deprecated in Bundler 1\.13\fR: Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in \fIGLOBAL SOURCE\fR\.
. .
.P .P
Using the \fB:source\fR option for an individual gem will also make that source available as a possible global source for any other gems which do not specify explicit sources\. Thus, when adding gems with explicit sources, it is recommended that you also ensure all other gems in the Gemfile are using explicit sources\. Using the \fB:source\fR option for an individual gem will also make that source available as a possible global source for any other gems which do not specify explicit sources\. Thus, when adding gems with explicit sources, it is recommended that you also ensure all other gems in the Gemfile are using explicit sources\.
@ -730,7 +736,7 @@ The source explicitly attached to the gem (using \fB:source\fR, \fB:path\fR, or
For implicit gems (dependencies of explicit gems), any source, git, or path repository declared on the parent\. This results in bundler prioritizing the ActiveSupport gem from the Rails git repository over ones from \fBrubygems\.org\fR For implicit gems (dependencies of explicit gems), any source, git, or path repository declared on the parent\. This results in bundler prioritizing the ActiveSupport gem from the Rails git repository over ones from \fBrubygems\.org\fR
. .
.IP "3." 4 .IP "3." 4
The sources specified via global \fBsource\fR lines, searching each source in your \fBGemfile\fR from last added to first added\. If neither of the above conditions are met, the global source will be used\. If multiple global sources are specified, they will be prioritized from last to first, but this is deprecated since Bundler 1\.13, so Bundler prints a warning and will abort with an error in the future\.
. .
.IP "" 0 .IP "" 0

View file

@ -15,23 +15,28 @@ directory as the `Rakefile`.
A `Gemfile` is evaluated as Ruby code, in a context which makes available A `Gemfile` is evaluated as Ruby code, in a context which makes available
a number of methods used to describe the gem requirements. a number of methods used to describe the gem requirements.
## GLOBAL SOURCES ## GLOBAL SOURCE
At the top of the `Gemfile`, add a line for the `Rubygems` source that contains At the top of the `Gemfile`, add a single line for the `RubyGems` source that
the gems listed in the `Gemfile`. contains the gems listed in the `Gemfile`.
source "https://rubygems.org" source "https://rubygems.org"
It is possible, but not recommended as of Bundler 1.7, to add multiple global You can add only one global source. In Bundler 1.13, adding multiple global
`source` lines. Each of these `source`s `MUST` be a valid Rubygems repository. sources was deprecated. The `source` `MUST` be a valid RubyGems repository.
Sources are checked for gems following the heuristics described in To use more than one source of RubyGems, you should use [`source` block
[SOURCE PRIORITY][]. If a gem is found in more than one global source, Bundler ](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS).
A source is checked for gems following the heuristics described in
[SOURCE PRIORITY][].
**Note about a behavior of the feature deprecated in Bundler 1.13**:
If a gem is found in more than one global source, Bundler
will print a warning after installing the gem indicating which source was used, will print a warning after installing the gem indicating which source was used,
and listing the other sources where the gem is available. A specific source can and listing the other sources where the gem is available. A specific source can
be selected for gems that need to use a non-standard repository, suppressing be selected for gems that need to use a non-standard repository, suppressing
this warning, by using the [`:source` option](#SOURCE) or a this warning, by using the [`:source` option](#SOURCE) or `source` block.
[`source` block](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS).
### CREDENTIALS ### CREDENTIALS
@ -247,22 +252,22 @@ This can be handy (assuming the pure ruby variant works fine) when:
### 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 the global source
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,
it will not be installed. it will not be installed.
Bundler will search for child dependencies of this gem by first looking in the Bundler will search for child dependencies of this gem by first looking in the
source selected for the parent, but if they are not found there, it will fall source selected for the parent, but if they are not found there, it will fall
back on global sources using the ordering described in [SOURCE PRIORITY][]. back on the global source.
**Note about a behavior of the feature deprecated in Bundler 1.13**:
Selecting a specific source repository this way also suppresses the ambiguous Selecting a specific source repository this way also suppresses the ambiguous
gem warning described above in gem warning described above in [GLOBAL SOURCE](#GLOBAL-SOURCE).
[GLOBAL SOURCES (#source)](#GLOBAL-SOURCES).
Using the `:source` option for an individual gem will also make that source Using the `:source` option for an individual gem will also make that source
available as a possible global source for any other gems which do not specify available as a possible global source for any other gems which do not specify
@ -535,5 +540,7 @@ bundler uses the following priority order:
repository declared on the parent. This results in bundler prioritizing the repository declared on the parent. This results in bundler prioritizing the
ActiveSupport gem from the Rails git repository over ones from ActiveSupport gem from the Rails git repository over ones from
`rubygems.org` `rubygems.org`
3. The sources specified via global `source` lines, searching each source in 3. If neither of the above conditions are met, the global source will be used.
your `Gemfile` from last added to first added. If multiple global sources are specified, they will be prioritized from
last to first, but this is deprecated since Bundler 1.13, so Bundler prints
a warning and will abort with an error in the future.

View file

@ -16,7 +16,8 @@ module Bundler
def initialize(name, version, platform, spec_fetcher) def initialize(name, version, platform, spec_fetcher)
@name = name @name = name
@version = Gem::Version.create version @version = Gem::Version.create version
@platform = platform @original_platform = platform || Gem::Platform::RUBY
@platform = Gem::Platform.new(platform)
@spec_fetcher = spec_fetcher @spec_fetcher = spec_fetcher
@dependencies = nil @dependencies = nil
end end
@ -35,10 +36,10 @@ module Bundler
end end
def full_name def full_name
if platform == Gem::Platform::RUBY || platform.nil? if @original_platform == Gem::Platform::RUBY
"#{@name}-#{@version}" "#{@name}-#{@version}"
else else
"#{@name}-#{@version}-#{platform}" "#{@name}-#{@version}-#{@original_platform}"
end end
end end
@ -105,7 +106,7 @@ module Bundler
end end
def _remote_specification def _remote_specification
@_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform]) @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @original_platform])
@_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \ @_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \
" missing from the server! Try installing with `--full-index` as a workaround.") " missing from the server! Try installing with `--full-index` as a workaround.")
end end

View file

@ -22,17 +22,16 @@ module Bundler
metadata_requirements, regular_requirements = requirements.partition {|dep| dep.name.end_with?("\0") } metadata_requirements, regular_requirements = requirements.partition {|dep| dep.name.end_with?("\0") }
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements) resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
result = resolver.start(requirements) result = resolver.start(requirements)
SpecSet.new(SpecSet.new(result).for(regular_requirements)) SpecSet.new(SpecSet.new(result).for(regular_requirements, false, platforms))
end end
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements) def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
@source_requirements = source_requirements @source_requirements = source_requirements
@metadata_requirements = metadata_requirements @metadata_requirements = metadata_requirements
@base = base
@resolver = Molinillo::Resolver.new(self, self) @resolver = Molinillo::Resolver.new(self, self)
@search_for = {} @search_for = {}
@base_dg = Molinillo::DependencyGraph.new @base_dg = Molinillo::DependencyGraph.new
@base.each do |ls| @base = base.materialized_for_resolution do |ls|
dep = Dependency.new(ls.name, ls.version) dep = Dependency.new(ls.name, ls.version)
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true) @base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
end end
@ -111,7 +110,7 @@ module Bundler
dependency = dependency_proxy.dep dependency = dependency_proxy.dep
name = dependency.name name = dependency.name
@search_for[dependency_proxy] ||= begin @search_for[dependency_proxy] ||= begin
results = results_for(dependency, @base[name]) results = results_for(dependency) + @base[name].select {|spec| requirement_satisfied_by?(dependency, nil, spec) }
if vertex = @base_dg.vertex_named(name) if vertex = @base_dg.vertex_named(name)
locked_requirement = vertex.payload.requirement locked_requirement = vertex.payload.requirement
@ -176,8 +175,8 @@ module Bundler
@source_requirements[name] || @source_requirements[:default] @source_requirements[name] || @source_requirements[:default]
end end
def results_for(dependency, base) def results_for(dependency)
index_for(dependency).search(dependency, base) index_for(dependency).search(dependency)
end end
def name_for(dependency) def name_for(dependency)

View file

@ -25,7 +25,7 @@ module Bundler
extract_files extract_files
build_extensions build_extensions if spec.extensions.any?
write_build_info_file write_build_info_file
run_post_build_hooks run_post_build_hooks
@ -66,26 +66,26 @@ module Bundler
def build_extensions def build_extensions
extension_cache_path = options[:bundler_extension_cache_path] extension_cache_path = options[:bundler_extension_cache_path]
unless extension_cache_path && extension_dir = spec.extension_dir extension_dir = spec.extension_dir
require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25") unless extension_cache_path && extension_dir
prepare_extension_build(extension_dir)
return super return super
end end
extension_dir = Pathname.new(extension_dir)
build_complete = SharedHelpers.filesystem_access(extension_cache_path.join("gem.build_complete"), :read, &:file?) build_complete = SharedHelpers.filesystem_access(extension_cache_path.join("gem.build_complete"), :read, &:file?)
if build_complete && !options[:force] if build_complete && !options[:force]
SharedHelpers.filesystem_access(extension_dir.parent, &:mkpath) SharedHelpers.filesystem_access(File.dirname(extension_dir)) do |p|
FileUtils.mkpath p
end
SharedHelpers.filesystem_access(extension_cache_path) do SharedHelpers.filesystem_access(extension_cache_path) do
FileUtils.cp_r extension_cache_path, spec.extension_dir FileUtils.cp_r extension_cache_path, extension_dir
end end
else else
require "shellwords" # compensate missing require in rubygems before version 3.2.25 prepare_extension_build(extension_dir)
super super
if extension_dir.directory? # not made for gems without extensions SharedHelpers.filesystem_access(extension_cache_path.parent, &:mkpath)
SharedHelpers.filesystem_access(extension_cache_path.parent, &:mkpath) SharedHelpers.filesystem_access(extension_cache_path) do
SharedHelpers.filesystem_access(extension_cache_path) do FileUtils.cp_r extension_dir, extension_cache_path
FileUtils.cp_r extension_dir, extension_cache_path
end
end end
end end
end end
@ -100,6 +100,13 @@ module Bundler
private private
def prepare_extension_build(extension_dir)
SharedHelpers.filesystem_access(extension_dir, :create) do
FileUtils.mkdir_p extension_dir
end
require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25")
end
def strict_rm_rf(dir) def strict_rm_rf(dir)
Bundler.rm_rf dir Bundler.rm_rf dir
rescue Errno::ENOTEMPTY => e rescue Errno::ENOTEMPTY => e

View file

@ -57,6 +57,7 @@ module Bundler
].freeze ].freeze
ARRAY_KEYS = %w[ ARRAY_KEYS = %w[
only
with with
without without
].freeze ].freeze

View file

@ -11,30 +11,27 @@ module Bundler
@specs = specs @specs = specs
end end
def for(dependencies, check = false, match_current_platform = false) def for(dependencies, check = false, platforms = [nil])
# dep.name => [list, of, deps] handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h
handled = Hash.new {|h, k| h[k] = [] } deps = dependencies.product(platforms).map {|dep, platform| [dep.name, platform && dep.force_ruby_platform ? Gem::Platform::RUBY : platform] }
deps = dependencies.dup
specs = [] specs = []
loop do loop do
break unless dep = deps.shift break unless dep = deps.shift
next if handled[dep.name].any? {|d| match_current_platform || d.__platform == dep.__platform } || dep.name == "bundler" next if handled.key?(dep)
# use a hash here to ensure constant lookup time in the `any?` call above handled[dep] = true
handled[dep.name] << dep
specs_for_dep = specs_for_dependency(dep, match_current_platform) specs_for_dep = specs_for_dependency(*dep)
if specs_for_dep.any? if specs_for_dep.any?
specs.concat(specs_for_dep) specs.concat(specs_for_dep)
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(Dependency.new(d.name, d.requirement), dep.__platform) unless match_current_platform deps << [d.name, dep[1]]
deps << d
end end
elsif check elsif check
return false specs << IncompleteSpecification.new(*dep)
end end
end end
@ -42,9 +39,7 @@ module Bundler
specs << spec specs << spec
end end
specs.uniq! unless match_current_platform specs
check ? true : specs
end end
def [](key) def [](key)
@ -71,12 +66,12 @@ module Bundler
end end
def materialize(deps) def materialize(deps)
materialized = self.for(deps, false, true) materialized = self.for(deps, true).uniq
materialized.map! do |s| materialized.map! do |s|
next s unless s.is_a?(LazySpecification) next s unless s.is_a?(LazySpecification)
s.source.local! s.source.local!
s.__materialize__ || s s.materialize_for_installation || s
end end
SpecSet.new(materialized) SpecSet.new(materialized)
end end
@ -89,16 +84,29 @@ module Bundler
next s unless s.is_a?(LazySpecification) next s unless s.is_a?(LazySpecification)
s.source.local! s.source.local!
s.source.remote! s.source.remote!
spec = s.__materialize__ spec = s.materialize_for_installation
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
spec spec
end end
end end
def materialized_for_resolution
materialized = @specs.map do |s|
spec = s.materialize_for_resolution
yield spec if spec
spec
end.compact
SpecSet.new(materialized)
end
def missing_specs def missing_specs
@specs.select {|s| s.is_a?(LazySpecification) } @specs.select {|s| s.is_a?(LazySpecification) }
end end
def incomplete_specs
@specs.select {|s| s.is_a?(IncompleteSpecification) }
end
def merge(set) def merge(set)
arr = sorted.dup arr = sorted.dup
set.each do |set_spec| set.each do |set_spec|
@ -173,12 +181,12 @@ module Bundler
@specs.sort_by(&:name).each {|s| yield s } @specs.sort_by(&:name).each {|s| yield s }
end end
def specs_for_dependency(dep, match_current_platform) def specs_for_dependency(name, platform)
specs_for_name = lookup[dep.name] specs_for_name = lookup[name]
if match_current_platform if platform.nil?
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.force_ruby_platform ? Gem::Platform::RUBY : dep.__platform) specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, 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.18".freeze VERSION = "2.3.19".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

@ -5,18 +5,18 @@
# See LICENSE.txt for permissions. # See LICENSE.txt for permissions.
#++ #++
require 'rbconfig' require "rbconfig"
module Gem module Gem
VERSION = "3.3.18".freeze VERSION = "3.3.19".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
require_relative 'rubygems/compatibility' require_relative "rubygems/compatibility"
require_relative 'rubygems/defaults' require_relative "rubygems/defaults"
require_relative 'rubygems/deprecate' require_relative "rubygems/deprecate"
require_relative 'rubygems/errors' require_relative "rubygems/errors"
## ##
# RubyGems is the Ruby standard for publishing and managing third party # RubyGems is the Ruby standard for publishing and managing third party
@ -117,11 +117,11 @@ module Gem
# Taint support is deprecated in Ruby 2.7. # Taint support is deprecated in Ruby 2.7.
# This allows switching ".untaint" to ".tap(&Gem::UNTAINT)", # This allows switching ".untaint" to ".tap(&Gem::UNTAINT)",
# to avoid deprecation warnings in Ruby 2.7. # to avoid deprecation warnings in Ruby 2.7.
UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc {} UNTAINT = RUBY_VERSION < "2.7" ? :untaint.to_sym : proc {}
# When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn # When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn
KERNEL_WARN_IGNORES_INTERNAL_ENTRIES = RUBY_ENGINE == "truffleruby" || KERNEL_WARN_IGNORES_INTERNAL_ENTRIES = RUBY_ENGINE == "truffleruby" ||
(RUBY_ENGINE == "ruby" && RUBY_VERSION >= '3.0') (RUBY_ENGINE == "ruby" && RUBY_VERSION >= "3.0")
## ##
# An Array of Regexps that match windows Ruby platforms. # An Array of Regexps that match windows Ruby platforms.
@ -293,14 +293,14 @@ module Gem
# The mode needed to read a file as straight binary. # The mode needed to read a file as straight binary.
def self.binary_mode def self.binary_mode
'rb' "rb"
end end
## ##
# The path where gem executables are to be installed. # The path where gem executables are to be installed.
def self.bindir(install_dir=Gem.dir) def self.bindir(install_dir=Gem.dir)
return File.join install_dir, 'bin' unless return File.join install_dir, "bin" unless
install_dir.to_s == Gem.default_dir.to_s install_dir.to_s == Gem.default_dir.to_s
Gem.default_bindir Gem.default_bindir
end end
@ -309,7 +309,7 @@ module Gem
# The path were rubygems plugins are to be installed. # The path were rubygems plugins are to be installed.
def self.plugindir(install_dir=Gem.dir) def self.plugindir(install_dir=Gem.dir)
File.join install_dir, 'plugins' File.join install_dir, "plugins"
end end
## ##
@ -353,7 +353,7 @@ module Gem
# A Zlib::Deflate.deflate wrapper # A Zlib::Deflate.deflate wrapper
def self.deflate(data) def self.deflate(data)
require 'zlib' require "zlib"
Zlib::Deflate.deflate data Zlib::Deflate.deflate data
end end
@ -375,7 +375,7 @@ module Gem
target = {} target = {}
env.each_pair do |k,v| env.each_pair do |k,v|
case k case k
when 'GEM_HOME', 'GEM_PATH', 'GEM_SPEC_CACHE' when "GEM_HOME", "GEM_PATH", "GEM_SPEC_CACHE"
case v case v
when nil, String when nil, String
target[k] = v target[k] = v
@ -442,8 +442,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
old_umask = File.umask old_umask = File.umask
File.umask old_umask | 002 File.umask old_umask | 002
require 'fileutils'
options = {} options = {}
options[:mode] = mode if mode options[:mode] = mode if mode
@ -451,6 +449,9 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
subdirs.each do |name| subdirs.each do |name|
subdir = File.join dir, name subdir = File.join dir, name
next if File.exist? subdir next if File.exist? subdir
require "fileutils"
begin begin
FileUtils.mkdir_p subdir, **options FileUtils.mkdir_p subdir, **options
rescue SystemCallError rescue SystemCallError
@ -465,7 +466,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# distinction as extensions cannot be shared between the two. # distinction as extensions cannot be shared between the two.
def self.extension_api_version # :nodoc: def self.extension_api_version # :nodoc:
if 'no' == RbConfig::CONFIG['ENABLE_SHARED'] if "no" == RbConfig::CONFIG["ENABLE_SHARED"]
"#{ruby_api_version}-static" "#{ruby_api_version}-static"
else else
ruby_api_version ruby_api_version
@ -575,7 +576,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
return i if path.instance_variable_defined?(:@gem_prelude_index) return i if path.instance_variable_defined?(:@gem_prelude_index)
end end
index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir'] index = $LOAD_PATH.index RbConfig::CONFIG["sitelibdir"]
index || 0 index || 0
end end
@ -606,10 +607,10 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.load_yaml def self.load_yaml
return if @yaml_loaded return if @yaml_loaded
require 'psych' require "psych"
require_relative 'rubygems/psych_tree' require_relative "rubygems/psych_tree"
require_relative 'rubygems/safe_yaml' require_relative "rubygems/safe_yaml"
@yaml_loaded = true @yaml_loaded = true
end end
@ -740,9 +741,9 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.prefix def self.prefix
prefix = File.dirname RUBYGEMS_DIR prefix = File.dirname RUBYGEMS_DIR
if prefix != File.expand_path(RbConfig::CONFIG['sitelibdir']) and if prefix != File.expand_path(RbConfig::CONFIG["sitelibdir"]) and
prefix != File.expand_path(RbConfig::CONFIG['libdir']) and prefix != File.expand_path(RbConfig::CONFIG["libdir"]) and
'lib' == File.basename(RUBYGEMS_DIR) "lib" == File.basename(RUBYGEMS_DIR)
prefix prefix
end end
end end
@ -758,11 +759,11 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Safely read a file in binary mode on all platforms. # Safely read a file in binary mode on all platforms.
def self.read_binary(path) def self.read_binary(path)
open_file(path, 'rb+') do |io| open_file(path, "rb+") do |io|
io.read io.read
end end
rescue Errno::EACCES, Errno::EROFS rescue Errno::EACCES, Errno::EROFS
open_file(path, 'rb') do |io| open_file(path, "rb") do |io|
io.read io.read
end end
end end
@ -770,7 +771,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
## ##
# Safely write a file in binary mode on all platforms. # Safely write a file in binary mode on all platforms.
def self.write_binary(path, data) def self.write_binary(path, data)
open_file(path, 'wb') do |io| open_file(path, "wb") do |io|
io.write data io.write data
end end
end end
@ -815,13 +816,13 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Returns a String containing the API compatibility version of Ruby # Returns a String containing the API compatibility version of Ruby
def self.ruby_api_version def self.ruby_api_version
@ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup @ruby_api_version ||= RbConfig::CONFIG["ruby_version"].dup
end end
def self.env_requirement(gem_name) def self.env_requirement(gem_name)
@env_requirements_by_name ||= {} @env_requirements_by_name ||= {}
@env_requirements_by_name[gem_name] ||= begin @env_requirements_by_name[gem_name] ||= begin
req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || '>= 0'.freeze req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || ">= 0".freeze
Gem::Requirement.create(req) Gem::Requirement.create(req)
end end
end end
@ -844,7 +845,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Returns the latest release version of RubyGems. # Returns the latest release version of RubyGems.
def self.latest_rubygems_version def self.latest_rubygems_version
latest_version_for('rubygems-update') or latest_version_for("rubygems-update") or
raise "Can't find 'rubygems-update' in any repo. Check `gem source list`." raise "Can't find 'rubygems-update' in any repo. Check `gem source list`."
end end
@ -939,8 +940,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Suffixes for require-able paths. # Suffixes for require-able paths.
def self.suffixes def self.suffixes
@suffixes ||= ['', @suffixes ||= ["",
'.rb', ".rb",
*%w[DLEXT DLEXT2].map do |key| *%w[DLEXT DLEXT2].map do |key|
val = RbConfig::CONFIG[key] val = RbConfig::CONFIG[key]
next unless val and not val.empty? next unless val and not val.empty?
@ -969,7 +970,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Lazily loads DefaultUserInteraction and returns the default UI. # Lazily loads DefaultUserInteraction and returns the default UI.
def self.ui def self.ui
require_relative 'rubygems/user_interaction' require_relative "rubygems/user_interaction"
Gem::DefaultUserInteraction.ui Gem::DefaultUserInteraction.ui
end end
@ -991,7 +992,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.win_platform? def self.win_platform?
if @@win_platform.nil? if @@win_platform.nil?
ruby_platform = RbConfig::CONFIG['host_os'] ruby_platform = RbConfig::CONFIG["host_os"]
@@win_platform = !!WIN_PATTERNS.find {|r| ruby_platform =~ r } @@win_platform = !!WIN_PATTERNS.find {|r| ruby_platform =~ r }
end end
@ -1017,7 +1018,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.load_plugin_files(plugins) # :nodoc: def self.load_plugin_files(plugins) # :nodoc:
plugins.each do |plugin| plugins.each do |plugin|
# Skip older versions of the GemCutter plugin: Its commands are in # Skip older versions of the GemCutter plugin: Its commands are in
# RubyGems proper now. # RubyGems proper now.
@ -1071,7 +1071,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.use_gemdeps(path = nil) def self.use_gemdeps(path = nil)
raise_exception = path raise_exception = path
path ||= ENV['RUBYGEMS_GEMDEPS'] path ||= ENV["RUBYGEMS_GEMDEPS"]
return unless path return unless path
path = path.dup path = path.dup
@ -1096,7 +1096,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
end end
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path) ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path)
require_relative 'rubygems/user_interaction' require_relative "rubygems/user_interaction"
require "bundler" require "bundler"
begin begin
Gem::DefaultUserInteraction.use_ui(ui) do Gem::DefaultUserInteraction.use_ui(ui) do
@ -1293,33 +1293,34 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/".freeze MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/".freeze
autoload :BundlerVersionFinder, File.expand_path('rubygems/bundler_version_finder', __dir__) autoload :BundlerVersionFinder, File.expand_path("rubygems/bundler_version_finder", __dir__)
autoload :ConfigFile, File.expand_path('rubygems/config_file', __dir__) autoload :ConfigFile, File.expand_path("rubygems/config_file", __dir__)
autoload :Dependency, File.expand_path('rubygems/dependency', __dir__) autoload :Dependency, File.expand_path("rubygems/dependency", __dir__)
autoload :DependencyList, File.expand_path('rubygems/dependency_list', __dir__) autoload :DependencyList, File.expand_path("rubygems/dependency_list", __dir__)
autoload :Installer, File.expand_path('rubygems/installer', __dir__) autoload :Installer, File.expand_path("rubygems/installer", __dir__)
autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__) autoload :Licenses, File.expand_path("rubygems/util/licenses", __dir__)
autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__) autoload :NameTuple, File.expand_path("rubygems/name_tuple", __dir__)
autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__) autoload :PathSupport, File.expand_path("rubygems/path_support", __dir__)
autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__) autoload :RequestSet, File.expand_path("rubygems/request_set", __dir__)
autoload :Resolver, File.expand_path('rubygems/resolver', __dir__) autoload :Requirement, File.expand_path("rubygems/requirement", __dir__)
autoload :Source, File.expand_path('rubygems/source', __dir__) autoload :Resolver, File.expand_path("rubygems/resolver", __dir__)
autoload :SourceList, File.expand_path('rubygems/source_list', __dir__) autoload :Source, File.expand_path("rubygems/source", __dir__)
autoload :SpecFetcher, File.expand_path('rubygems/spec_fetcher', __dir__) autoload :SourceList, File.expand_path("rubygems/source_list", __dir__)
autoload :SpecificationPolicy, File.expand_path('rubygems/specification_policy', __dir__) autoload :SpecFetcher, File.expand_path("rubygems/spec_fetcher", __dir__)
autoload :Util, File.expand_path('rubygems/util', __dir__) autoload :SpecificationPolicy, File.expand_path("rubygems/specification_policy", __dir__)
autoload :Version, File.expand_path('rubygems/version', __dir__) autoload :Util, File.expand_path("rubygems/util", __dir__)
autoload :Version, File.expand_path("rubygems/version", __dir__)
end end
require_relative 'rubygems/exceptions' require_relative "rubygems/exceptions"
require_relative 'rubygems/specification' require_relative "rubygems/specification"
# REFACTOR: This should be pulled out into some kind of hacks file. # REFACTOR: This should be pulled out into some kind of hacks file.
begin begin
## ##
# Defaults the operating system (or packager) wants to provide for RubyGems. # Defaults the operating system (or packager) wants to provide for RubyGems.
require 'rubygems/defaults/operating_system' require "rubygems/defaults/operating_system"
rescue LoadError rescue LoadError
# Ignored # Ignored
rescue StandardError => e rescue StandardError => e
@ -1344,6 +1345,6 @@ end
# Loads the default specs. # Loads the default specs.
Gem::Specification.load_defaults Gem::Specification.load_defaults
require_relative 'rubygems/core_ext/kernel_gem' require_relative "rubygems/core_ext/kernel_gem"
require_relative 'rubygems/core_ext/kernel_require' require_relative "rubygems/core_ext/kernel_require"
require_relative 'rubygems/core_ext/kernel_warn' require_relative "rubygems/core_ext/kernel_warn"

View file

@ -47,7 +47,7 @@ class Gem::BasicSpecification
# directory. # directory.
def gem_build_complete_path # :nodoc: def gem_build_complete_path # :nodoc:
File.join extension_dir, 'gem.build_complete' File.join extension_dir, "gem.build_complete"
end end
## ##
@ -103,7 +103,7 @@ class Gem::BasicSpecification
def extensions_dir def extensions_dir
Gem.default_ext_dir_for(base_dir) || Gem.default_ext_dir_for(base_dir) ||
File.join(base_dir, 'extensions', Gem::Platform.local.to_s, File.join(base_dir, "extensions", Gem::Platform.local.to_s,
Gem.extension_api_version) Gem.extension_api_version)
end end

View file

@ -5,9 +5,9 @@
# See LICENSE.txt for permissions. # See LICENSE.txt for permissions.
#++ #++
require_relative 'optparse' require_relative "optparse"
require_relative 'requirement' require_relative "requirement"
require_relative 'user_interaction' require_relative "user_interaction"
## ##
# Base class for all Gem commands. When creating a new gem command, define # Base class for all Gem commands. When creating a new gem command, define
@ -76,7 +76,7 @@ class Gem::Command
when Array when Array
@extra_args = value @extra_args = value
when String when String
@extra_args = value.split(' ') @extra_args = value.split(" ")
end end
end end
@ -556,7 +556,7 @@ class Gem::Command
def configure_options(header, option_list) def configure_options(header, option_list)
return if option_list.nil? or option_list.empty? return if option_list.nil? or option_list.empty?
header = header.to_s.empty? ? '' : "#{header} " header = header.to_s.empty? ? "" : "#{header} "
@parser.separator " #{header}Options:" @parser.separator " #{header}Options:"
option_list.each do |args, handler| option_list.each do |args, handler|
@ -565,7 +565,7 @@ class Gem::Command
end end
end end
@parser.separator '' @parser.separator ""
end end
## ##
@ -578,13 +578,13 @@ class Gem::Command
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# Add the options common to all commands. # Add the options common to all commands.
add_common_option('-h', '--help', add_common_option("-h", "--help",
'Get help on this command') do |value, options| "Get help on this command") do |value, options|
options[:help] = true options[:help] = true
end end
add_common_option('-V', '--[no-]verbose', add_common_option("-V", "--[no-]verbose",
'Set the verbose level of output') do |value, options| "Set the verbose level of output") do |value, options|
# Set us to "really verbose" so the progress meter works # Set us to "really verbose" so the progress meter works
if Gem.configuration.verbose and value if Gem.configuration.verbose and value
Gem.configuration.verbose = 1 Gem.configuration.verbose = 1
@ -593,7 +593,7 @@ class Gem::Command
end end
end end
add_common_option('-q', '--quiet', 'Silence command progress meter') do |value, options| add_common_option("-q", "--quiet", "Silence command progress meter") do |value, options|
Gem.configuration.verbose = false Gem.configuration.verbose = false
end end
@ -606,20 +606,20 @@ class Gem::Command
# commands. Both options are actually handled before the other # commands. Both options are actually handled before the other
# options get parsed. # options get parsed.
add_common_option('--config-file FILE', add_common_option("--config-file FILE",
'Use this config file instead of default') do "Use this config file instead of default") do
end end
add_common_option('--backtrace', add_common_option("--backtrace",
'Show stack backtrace on errors') do "Show stack backtrace on errors") do
end end
add_common_option('--debug', add_common_option("--debug",
'Turn on Ruby debugging') do "Turn on Ruby debugging") do
end end
add_common_option('--norc', add_common_option("--norc",
'Avoid loading any .gemrc file') do "Avoid loading any .gemrc file") do
end end
# :stopdoc: # :stopdoc:

View file

@ -5,9 +5,9 @@
# See LICENSE.txt for permissions. # See LICENSE.txt for permissions.
#++ #++
require_relative 'command' require_relative "command"
require_relative 'user_interaction' require_relative "user_interaction"
require_relative 'text' require_relative "text"
## ##
# The command manager registers and installs all the individual sub-commands # The command manager registers and installs all the individual sub-commands
@ -73,9 +73,9 @@ class Gem::CommandManager
].freeze ].freeze
ALIAS_COMMANDS = { ALIAS_COMMANDS = {
'i' => 'install', "i" => "install",
'login' => 'signin', "login" => "signin",
'logout' => 'signout', "logout" => "signout",
}.freeze }.freeze
## ##
@ -104,7 +104,7 @@ class Gem::CommandManager
# Register all the subcommands supported by the gem command. # Register all the subcommands supported by the gem command.
def initialize def initialize
require 'timeout' require "timeout"
@commands = {} @commands = {}
BUILTIN_COMMANDS.each do |name| BUILTIN_COMMANDS.each do |name|
@ -169,10 +169,10 @@ class Gem::CommandManager
end end
case args.first case args.first
when '-h', '--help' then when "-h", "--help" then
say Gem::Command::HELP say Gem::Command::HELP
terminate_interaction 0 terminate_interaction 0
when '-v', '--version' then when "-v", "--version" then
say Gem::VERSION say Gem::VERSION
terminate_interaction 0 terminate_interaction 0
when /^-/ then when /^-/ then

View file

@ -1,29 +1,29 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../package' require_relative "../package"
require_relative '../version_option' require_relative "../version_option"
class Gem::Commands::BuildCommand < Gem::Command class Gem::Commands::BuildCommand < Gem::Command
include Gem::VersionOption include Gem::VersionOption
def initialize def initialize
super 'build', 'Build a gem from a gemspec' super "build", "Build a gem from a gemspec"
add_platform_option add_platform_option
add_option '--force', 'skip validation of the spec' do |value, options| add_option "--force", "skip validation of the spec" do |value, options|
options[:force] = true options[:force] = true
end end
add_option '--strict', 'consider warnings as errors when validating the spec' do |value, options| add_option "--strict", "consider warnings as errors when validating the spec" do |value, options|
options[:strict] = true options[:strict] = true
end end
add_option '-o', '--output FILE', 'output gem with the given filename' do |value, options| add_option "-o", "--output FILE", "output gem with the given filename" do |value, options|
options[:output] = value options[:output] = value
end end
add_option '-C PATH', 'Run as if gem build was started in <PATH> instead of the current working directory.' do |value, options| add_option "-C PATH", "Run as if gem build was started in <PATH> instead of the current working directory." do |value, options|
options[:build_path] = value options[:build_path] = value
end end
end end

View file

@ -1,69 +1,69 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../security' require_relative "../security"
class Gem::Commands::CertCommand < Gem::Command class Gem::Commands::CertCommand < Gem::Command
def initialize def initialize
super 'cert', 'Manage RubyGems certificates and signing settings', super "cert", "Manage RubyGems certificates and signing settings",
:add => [], :remove => [], :list => [], :build => [], :sign => [] :add => [], :remove => [], :list => [], :build => [], :sign => []
add_option('-a', '--add CERT', add_option("-a", "--add CERT",
'Add a trusted certificate.') do |cert_file, options| "Add a trusted certificate.") do |cert_file, options|
options[:add] << open_cert(cert_file) options[:add] << open_cert(cert_file)
end end
add_option('-l', '--list [FILTER]', add_option("-l", "--list [FILTER]",
'List trusted certificates where the', "List trusted certificates where the",
'subject contains FILTER') do |filter, options| "subject contains FILTER") do |filter, options|
filter ||= '' filter ||= ""
options[:list] << filter options[:list] << filter
end end
add_option('-r', '--remove FILTER', add_option("-r", "--remove FILTER",
'Remove trusted certificates where the', "Remove trusted certificates where the",
'subject contains FILTER') do |filter, options| "subject contains FILTER") do |filter, options|
options[:remove] << filter options[:remove] << filter
end end
add_option('-b', '--build EMAIL_ADDR', add_option("-b", "--build EMAIL_ADDR",
'Build private key and self-signed', "Build private key and self-signed",
'certificate for EMAIL_ADDR') do |email_address, options| "certificate for EMAIL_ADDR") do |email_address, options|
options[:build] << email_address options[:build] << email_address
end end
add_option('-C', '--certificate CERT', add_option("-C", "--certificate CERT",
'Signing certificate for --sign') do |cert_file, options| "Signing certificate for --sign") do |cert_file, options|
options[:issuer_cert] = open_cert(cert_file) options[:issuer_cert] = open_cert(cert_file)
options[:issuer_cert_file] = cert_file options[:issuer_cert_file] = cert_file
end end
add_option('-K', '--private-key KEY', add_option("-K", "--private-key KEY",
'Key for --sign or --build') do |key_file, options| "Key for --sign or --build") do |key_file, options|
options[:key] = open_private_key(key_file) options[:key] = open_private_key(key_file)
end end
add_option('-A', '--key-algorithm ALGORITHM', add_option("-A", "--key-algorithm ALGORITHM",
'Select which key algorithm to use for --build') do |algorithm, options| "Select which key algorithm to use for --build") do |algorithm, options|
options[:key_algorithm] = algorithm options[:key_algorithm] = algorithm
end end
add_option('-s', '--sign CERT', add_option("-s", "--sign CERT",
'Signs CERT with the key from -K', "Signs CERT with the key from -K",
'and the certificate from -C') do |cert_file, options| "and the certificate from -C") do |cert_file, options|
raise Gem::OptionParser::InvalidArgument, "#{cert_file}: does not exist" unless raise Gem::OptionParser::InvalidArgument, "#{cert_file}: does not exist" unless
File.file? cert_file File.file? cert_file
options[:sign] << cert_file options[:sign] << cert_file
end end
add_option('-d', '--days NUMBER_OF_DAYS', add_option("-d", "--days NUMBER_OF_DAYS",
'Days before the certificate expires') do |days, options| "Days before the certificate expires") do |days, options|
options[:expiration_length_days] = days.to_i options[:expiration_length_days] = days.to_i
end end
add_option('-R', '--re-sign', add_option("-R", "--re-sign",
'Re-signs the certificate from -C with the key from -K') do |resign, options| "Re-signs the certificate from -C with the key from -K") do |resign, options|
options[:resign] = resign options[:resign] = resign
end end
end end
@ -93,7 +93,7 @@ class Gem::Commands::CertCommand < Gem::Command
def open_private_key(key_file) def open_private_key(key_file)
check_openssl check_openssl
passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE'] passphrase = ENV["GEM_PRIVATE_KEY_PASSPHRASE"]
key = OpenSSL::PKey.read File.read(key_file), passphrase key = OpenSSL::PKey.read File.read(key_file), passphrase
raise Gem::OptionParser::InvalidArgument, raise Gem::OptionParser::InvalidArgument,
"#{key_file}: private key not found" unless key.private? "#{key_file}: private key not found" unless key.private?
@ -166,10 +166,10 @@ class Gem::Commands::CertCommand < Gem::Command
def build_key # :nodoc: def build_key # :nodoc:
return options[:key] if options[:key] return options[:key] if options[:key]
passphrase = ask_for_password 'Passphrase for your Private Key:' passphrase = ask_for_password "Passphrase for your Private Key:"
say "\n" say "\n"
passphrase_confirmation = ask_for_password 'Please repeat the passphrase for your Private Key:' passphrase_confirmation = ask_for_password "Please repeat the passphrase for your Private Key:"
say "\n" say "\n"
raise Gem::CommandLineError, raise Gem::CommandLineError,
@ -260,7 +260,7 @@ For further reading on signing gems see `ri Gem::Security`.
def load_default_key def load_default_key
key_file = File.join Gem.default_key_path key_file = File.join Gem.default_key_path
key = File.read key_file key = File.read key_file
passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE'] passphrase = ENV["GEM_PRIVATE_KEY_PASSPHRASE"]
options[:key] = OpenSSL::PKey.read key, passphrase options[:key] = OpenSSL::PKey.read key, passphrase
rescue Errno::ENOENT rescue Errno::ENOENT

View file

@ -1,44 +1,44 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../version_option' require_relative "../version_option"
require_relative '../validator' require_relative "../validator"
require_relative '../doctor' require_relative "../doctor"
class Gem::Commands::CheckCommand < Gem::Command class Gem::Commands::CheckCommand < Gem::Command
include Gem::VersionOption include Gem::VersionOption
def initialize def initialize
super 'check', 'Check a gem repository for added or missing files', super "check", "Check a gem repository for added or missing files",
:alien => true, :doctor => false, :dry_run => false, :gems => true :alien => true, :doctor => false, :dry_run => false, :gems => true
add_option('-a', '--[no-]alien', add_option("-a", "--[no-]alien",
'Report "unmanaged" or rogue files in the', 'Report "unmanaged" or rogue files in the',
'gem repository') do |value, options| "gem repository") do |value, options|
options[:alien] = value options[:alien] = value
end end
add_option('--[no-]doctor', add_option("--[no-]doctor",
'Clean up uninstalled gems and broken', "Clean up uninstalled gems and broken",
'specifications') do |value, options| "specifications") do |value, options|
options[:doctor] = value options[:doctor] = value
end end
add_option('--[no-]dry-run', add_option("--[no-]dry-run",
'Do not remove files, only report what', "Do not remove files, only report what",
'would be removed') do |value, options| "would be removed") do |value, options|
options[:dry_run] = value options[:dry_run] = value
end end
add_option('--[no-]gems', add_option("--[no-]gems",
'Check installed gems for problems') do |value, options| "Check installed gems for problems") do |value, options|
options[:gems] = value options[:gems] = value
end end
add_version_option 'check' add_version_option "check"
end end
def check_gems def check_gems
say 'Checking gems...' say "Checking gems..."
say say
gems = get_all_gem_names rescue [] gems = get_all_gem_names rescue []
@ -57,7 +57,7 @@ class Gem::Commands::CheckCommand < Gem::Command
end end
def doctor def doctor
say 'Checking for files from uninstalled gems...' say "Checking for files from uninstalled gems..."
say say
Gem.path.each do |gem_repo| Gem.path.each do |gem_repo|
@ -72,11 +72,11 @@ class Gem::Commands::CheckCommand < Gem::Command
end end
def arguments # :nodoc: def arguments # :nodoc:
'GEMNAME name of gem to check' "GEMNAME name of gem to check"
end end
def defaults_str # :nodoc: def defaults_str # :nodoc:
'--gems --alien' "--gems --alien"
end end
def description # :nodoc: def description # :nodoc:

View file

@ -1,35 +1,35 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../dependency_list' require_relative "../dependency_list"
require_relative '../uninstaller' require_relative "../uninstaller"
class Gem::Commands::CleanupCommand < Gem::Command class Gem::Commands::CleanupCommand < Gem::Command
def initialize def initialize
super 'cleanup', super "cleanup",
'Clean up old versions of installed gems', "Clean up old versions of installed gems",
:force => false, :install_dir => Gem.dir, :force => false, :install_dir => Gem.dir,
:check_dev => true :check_dev => true
add_option('-n', '-d', '--dry-run', add_option("-n", "-d", "--dry-run",
'Do not uninstall gems') do |value, options| "Do not uninstall gems") do |value, options|
options[:dryrun] = true options[:dryrun] = true
end end
add_option(:Deprecated, '--dryrun', add_option(:Deprecated, "--dryrun",
'Do not uninstall gems') do |value, options| "Do not uninstall gems") do |value, options|
options[:dryrun] = true options[:dryrun] = true
end end
deprecate_option('--dryrun', extra_msg: 'Use --dry-run instead') deprecate_option("--dryrun", extra_msg: "Use --dry-run instead")
add_option('-D', '--[no-]check-development', add_option("-D", "--[no-]check-development",
'Check development dependencies while uninstalling', "Check development dependencies while uninstalling",
'(default: true)') do |value, options| "(default: true)") do |value, options|
options[:check_dev] = value options[:check_dev] = value
end end
add_option('--[no-]user-install', add_option("--[no-]user-install",
'Cleanup in user\'s home directory instead', "Cleanup in user's home directory instead",
'of GEM_HOME.') do |value, options| "of GEM_HOME.") do |value, options|
options[:user_install] = value options[:user_install] = value
end end

View file

@ -1,39 +1,39 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../version_option' require_relative "../version_option"
class Gem::Commands::ContentsCommand < Gem::Command class Gem::Commands::ContentsCommand < Gem::Command
include Gem::VersionOption include Gem::VersionOption
def initialize def initialize
super 'contents', 'Display the contents of the installed gems', super "contents", "Display the contents of the installed gems",
:specdirs => [], :lib_only => false, :prefix => true, :specdirs => [], :lib_only => false, :prefix => true,
:show_install_dir => false :show_install_dir => false
add_version_option add_version_option
add_option('--all', add_option("--all",
"Contents for all gems") do |all, options| "Contents for all gems") do |all, options|
options[:all] = all options[:all] = all
end end
add_option('-s', '--spec-dir a,b,c', Array, add_option("-s", "--spec-dir a,b,c", Array,
"Search for gems under specific paths") do |spec_dirs, options| "Search for gems under specific paths") do |spec_dirs, options|
options[:specdirs] = spec_dirs options[:specdirs] = spec_dirs
end end
add_option('-l', '--[no-]lib-only', add_option("-l", "--[no-]lib-only",
"Only return files in the Gem's lib_dirs") do |lib_only, options| "Only return files in the Gem's lib_dirs") do |lib_only, options|
options[:lib_only] = lib_only options[:lib_only] = lib_only
end end
add_option('--[no-]prefix', add_option("--[no-]prefix",
"Don't include installed path prefix") do |prefix, options| "Don't include installed path prefix") do |prefix, options|
options[:prefix] = prefix options[:prefix] = prefix
end end
add_option('--[no-]show-install-dir', add_option("--[no-]show-install-dir",
'Show only the gem install dir') do |show, options| "Show only the gem install dir") do |show, options|
options[:show_install_dir] = show options[:show_install_dir] = show
end end
@ -105,11 +105,11 @@ prefix or only the files that are requireable.
case file case file
when /\A#{spec.bindir}\// when /\A#{spec.bindir}\//
# $' is POSTMATCH # $' is POSTMATCH
[RbConfig::CONFIG['bindir'], $'] [RbConfig::CONFIG["bindir"], $']
when /\.so\z/ when /\.so\z/
[RbConfig::CONFIG['archdir'], file] [RbConfig::CONFIG["archdir"], file]
else else
[RbConfig::CONFIG['rubylibdir'], file] [RbConfig::CONFIG["rubylibdir"], file]
end end
end end
end end

View file

@ -1,28 +1,28 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../local_remote_options' require_relative "../local_remote_options"
require_relative '../version_option' require_relative "../version_option"
class Gem::Commands::DependencyCommand < Gem::Command class Gem::Commands::DependencyCommand < Gem::Command
include Gem::LocalRemoteOptions include Gem::LocalRemoteOptions
include Gem::VersionOption include Gem::VersionOption
def initialize def initialize
super 'dependency', super "dependency",
'Show the dependencies of an installed gem', "Show the dependencies of an installed gem",
:version => Gem::Requirement.default, :domain => :local :version => Gem::Requirement.default, :domain => :local
add_version_option add_version_option
add_platform_option add_platform_option
add_prerelease_option add_prerelease_option
add_option('-R', '--[no-]reverse-dependencies', add_option("-R", "--[no-]reverse-dependencies",
'Include reverse dependencies in the output') do "Include reverse dependencies in the output") do
|value, options| |value, options|
options[:reverse_dependencies] = value options[:reverse_dependencies] = value
end end
add_option('-p', '--pipe', add_option("-p", "--pipe",
"Pipe Format (name --version ver)") do |value, options| "Pipe Format (name --version ver)") do |value, options|
options[:pipe_format] = value options[:pipe_format] = value
end end
@ -134,7 +134,7 @@ use with other commands.
def ensure_local_only_reverse_dependencies # :nodoc: def ensure_local_only_reverse_dependencies # :nodoc:
if options[:reverse_dependencies] and remote? and not local? if options[:reverse_dependencies] and remote? and not local?
alert_error 'Only reverse dependencies for local gems are supported.' alert_error "Only reverse dependencies for local gems are supported."
terminate_interaction 1 terminate_interaction 1
end end
end end
@ -142,7 +142,7 @@ use with other commands.
def ensure_specs(specs) # :nodoc: def ensure_specs(specs) # :nodoc:
return unless specs.empty? return unless specs.empty?
patterns = options[:args].join ',' patterns = options[:args].join ","
say "No gems found matching #{patterns} (#{options[:version]})" if say "No gems found matching #{patterns} (#{options[:version]})" if
Gem.configuration.verbose Gem.configuration.verbose
@ -151,10 +151,10 @@ use with other commands.
def print_dependencies(spec, level = 0) # :nodoc: def print_dependencies(spec, level = 0) # :nodoc:
response = String.new response = String.new
response << ' ' * level + "Gem #{spec.full_name}\n" response << " " * level + "Gem #{spec.full_name}\n"
unless spec.dependencies.empty? unless spec.dependencies.empty?
spec.dependencies.sort_by {|dep| dep.name }.each do |dep| spec.dependencies.sort_by {|dep| dep.name }.each do |dep|
response << ' ' * level + " #{dep}\n" response << " " * level + " #{dep}\n"
end end
end end
response response

View file

@ -1,9 +1,9 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
class Gem::Commands::EnvironmentCommand < Gem::Command class Gem::Commands::EnvironmentCommand < Gem::Command
def initialize def initialize
super 'environment', 'Display information about the RubyGems environment' super "environment", "Display information about the RubyGems environment"
end end
def arguments # :nodoc: def arguments # :nodoc:
@ -16,7 +16,7 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
platform display the supported gem platforms platform display the supported gem platforms
<omitted> display everything <omitted> display everything
EOF EOF
return args.gsub(/^\s+/, '') return args.gsub(/^\s+/, "")
end end
def description # :nodoc: def description # :nodoc:
@ -141,7 +141,7 @@ lib/rubygems/defaults/operating_system.rb
out << " - GEM CONFIGURATION:\n" out << " - GEM CONFIGURATION:\n"
Gem.configuration.each do |name, value| Gem.configuration.each do |name, value|
value = value.gsub(/./, '*') if name == 'gemcutter_key' value = value.gsub(/./, "*") if name == "gemcutter_key"
out << " - #{name.inspect} => #{value.inspect}\n" out << " - #{name.inspect} => #{value.inspect}\n"
end end
@ -152,7 +152,7 @@ lib/rubygems/defaults/operating_system.rb
out << " - SHELL PATH:\n" out << " - SHELL PATH:\n"
shell_path = ENV['PATH'].split(File::PATH_SEPARATOR) shell_path = ENV["PATH"].split(File::PATH_SEPARATOR)
add_path out, shell_path add_path out, shell_path
out out

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../local_remote_options' require_relative "../local_remote_options"
require_relative '../version_option' require_relative "../version_option"
class Gem::Commands::FetchCommand < Gem::Command class Gem::Commands::FetchCommand < Gem::Command
include Gem::LocalRemoteOptions include Gem::LocalRemoteOptions
@ -13,7 +13,7 @@ class Gem::Commands::FetchCommand < Gem::Command
:version => Gem::Requirement.default, :version => Gem::Requirement.default,
} }
super 'fetch', 'Download a gem and place it in the current directory', defaults super "fetch", "Download a gem and place it in the current directory", defaults
add_bulk_threshold_option add_bulk_threshold_option
add_proxy_option add_proxy_option
@ -24,13 +24,13 @@ class Gem::Commands::FetchCommand < Gem::Command
add_platform_option add_platform_option
add_prerelease_option add_prerelease_option
add_option '--[no-]suggestions', 'Suggest alternates when gems are not found' do |value, options| add_option "--[no-]suggestions", "Suggest alternates when gems are not found" do |value, options|
options[:suggest_alternate] = value options[:suggest_alternate] = value
end end
end end
def arguments # :nodoc: def arguments # :nodoc:
'GEMNAME name of gem to download' "GEMNAME name of gem to download"
end end
def defaults_str # :nodoc: def defaults_str # :nodoc:

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../indexer' require_relative "../indexer"
## ##
# Generates a index files for use as a gem server. # Generates a index files for use as a gem server.
@ -9,27 +9,27 @@ require_relative '../indexer'
class Gem::Commands::GenerateIndexCommand < Gem::Command class Gem::Commands::GenerateIndexCommand < Gem::Command
def initialize def initialize
super 'generate_index', super "generate_index",
'Generates the index files for a gem server directory', "Generates the index files for a gem server directory",
:directory => '.', :build_modern => true :directory => ".", :build_modern => true
add_option '-d', '--directory=DIRNAME', add_option "-d", "--directory=DIRNAME",
'repository base dir containing gems subdir' do |dir, options| "repository base dir containing gems subdir" do |dir, options|
options[:directory] = File.expand_path dir options[:directory] = File.expand_path dir
end end
add_option '--[no-]modern', add_option "--[no-]modern",
'Generate indexes for RubyGems', "Generate indexes for RubyGems",
'(always true)' do |value, options| "(always true)" do |value, options|
options[:build_modern] = value options[:build_modern] = value
end end
deprecate_option('--modern', version: '4.0', extra_msg: 'Modern indexes (specs, latest_specs, and prerelease_specs) are always generated, so this option is not needed.') deprecate_option("--modern", version: "4.0", extra_msg: "Modern indexes (specs, latest_specs, and prerelease_specs) are always generated, so this option is not needed.")
deprecate_option('--no-modern', version: '4.0', extra_msg: 'The `--no-modern` option is currently ignored. Modern indexes (specs, latest_specs, and prerelease_specs) are always generated.') deprecate_option("--no-modern", version: "4.0", extra_msg: "The `--no-modern` option is currently ignored. Modern indexes (specs, latest_specs, and prerelease_specs) are always generated.")
add_option '--update', add_option "--update",
'Update modern indexes with gems added', "Update modern indexes with gems added",
'since the last update' do |value, options| "since the last update" do |value, options|
options[:update] = value options[:update] = value
end end
end end

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
class Gem::Commands::HelpCommand < Gem::Command class Gem::Commands::HelpCommand < Gem::Command
# :stopdoc: # :stopdoc:
@ -280,7 +280,7 @@ platform.
# :startdoc: # :startdoc:
def initialize def initialize
super 'help', "Provide help on the 'gem' command" super "help", "Provide help on the 'gem' command"
@command_manager = Gem::CommandManager.instance @command_manager = Gem::CommandManager.instance
end end
@ -326,7 +326,7 @@ platform.
desc_width = @command_manager.command_names.map {|n| n.size }.max + 4 desc_width = @command_manager.command_names.map {|n| n.size }.max + 4
summary_width = 80 - margin_width - desc_width summary_width = 80 - margin_width - desc_width
wrap_indent = ' ' * (margin_width + desc_width) wrap_indent = " " * (margin_width + desc_width)
format = "#{' ' * margin_width}%-#{desc_width}s%s" format = "#{' ' * margin_width}%-#{desc_width}s%s"
@command_manager.command_names.each do |cmd_name| @command_manager.command_names.each do |cmd_name|

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../query_utils' require_relative "../query_utils"
class Gem::Commands::InfoCommand < Gem::Command class Gem::Commands::InfoCommand < Gem::Command
include Gem::QueryUtils include Gem::QueryUtils
@ -13,7 +13,7 @@ class Gem::Commands::InfoCommand < Gem::Command
add_query_options add_query_options
remove_option('-d') remove_option("-d")
defaults[:details] = true defaults[:details] = true
defaults[:exact] = true defaults[:exact] = true

View file

@ -1,10 +1,10 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../install_update_options' require_relative "../install_update_options"
require_relative '../dependency_installer' require_relative "../dependency_installer"
require_relative '../local_remote_options' require_relative "../local_remote_options"
require_relative '../validator' require_relative "../validator"
require_relative '../version_option' require_relative "../version_option"
## ##
# Gem installer command line tool # Gem installer command line tool
@ -29,7 +29,7 @@ class Gem::Commands::InstallCommand < Gem::Command
defaults.merge!(install_update_options) defaults.merge!(install_update_options)
super 'install', 'Install a gem into the local repository', defaults super "install", "Install a gem into the local repository", defaults
add_install_update_options add_install_update_options
add_local_remote_options add_local_remote_options
@ -157,7 +157,7 @@ You can use `i` command instead of `install`.
@installed_specs = [] @installed_specs = []
ENV.delete 'GEM_PATH' if options[:install_dir].nil? ENV.delete "GEM_PATH" if options[:install_dir].nil?
check_install_dir check_install_dir
check_version check_version
@ -172,7 +172,7 @@ You can use `i` command instead of `install`.
end end
def install_from_gemdeps # :nodoc: def install_from_gemdeps # :nodoc:
require_relative '../request_set' require_relative "../request_set"
rs = Gem::RequestSet.new rs = Gem::RequestSet.new
specs = rs.install_from_gemdeps options do |req, inst| specs = rs.install_from_gemdeps options do |req, inst|
@ -247,11 +247,11 @@ You can use `i` command instead of `install`.
def load_hooks # :nodoc: def load_hooks # :nodoc:
if options[:install_as_default] if options[:install_as_default]
require_relative '../install_default_message' require_relative "../install_default_message"
else else
require_relative '../install_message' require_relative "../install_message"
end end
require_relative '../rdoc' require_relative "../rdoc"
end end
def show_install_errors(errors) # :nodoc: def show_install_errors(errors) # :nodoc:
@ -270,7 +270,7 @@ You can use `i` command instead of `install`.
def show_installed # :nodoc: def show_installed # :nodoc:
return if @installed_specs.empty? return if @installed_specs.empty?
gems = @installed_specs.length == 1 ? 'gem' : 'gems' gems = @installed_specs.length == 1 ? "gem" : "gems"
say "#{@installed_specs.length} #{gems} installed" say "#{@installed_specs.length} #{gems} installed"
end end
end end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../query_utils' require_relative "../query_utils"
## ##
# Searches for gems starting with the supplied argument. # Searches for gems starting with the supplied argument.
@ -9,7 +9,7 @@ class Gem::Commands::ListCommand < Gem::Command
include Gem::QueryUtils include Gem::QueryUtils
def initialize def initialize
super 'list', 'Display local gems whose name matches REGEXP', super "list", "Display local gems whose name matches REGEXP",
:domain => :local, :details => false, :versions => true, :domain => :local, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default :installed => nil, :version => Gem::Requirement.default

View file

@ -1,13 +1,13 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
class Gem::Commands::LockCommand < Gem::Command class Gem::Commands::LockCommand < Gem::Command
def initialize def initialize
super 'lock', 'Generate a lockdown list of gems', super "lock", "Generate a lockdown list of gems",
:strict => false :strict => false
add_option '-s', '--[no-]strict', add_option "-s", "--[no-]strict",
'fail if unable to satisfy a dependency' do |strict, options| "fail if unable to satisfy a dependency" do |strict, options|
options[:strict] = strict options[:strict] = strict
end end
end end

View file

@ -1,12 +1,12 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
unless defined? Gem::Commands::MirrorCommand unless defined? Gem::Commands::MirrorCommand
class Gem::Commands::MirrorCommand < Gem::Command class Gem::Commands::MirrorCommand < Gem::Command
def initialize def initialize
super('mirror', 'Mirror all gem files (requires rubygems-mirror)') super("mirror", "Mirror all gem files (requires rubygems-mirror)")
begin begin
Gem::Specification.find_by_name('rubygems-mirror').activate Gem::Specification.find_by_name("rubygems-mirror").activate
rescue Gem::LoadError rescue Gem::LoadError
# no-op # no-op
end end

View file

@ -1,18 +1,18 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../version_option' require_relative "../version_option"
class Gem::Commands::OpenCommand < Gem::Command class Gem::Commands::OpenCommand < Gem::Command
include Gem::VersionOption include Gem::VersionOption
def initialize def initialize
super 'open', 'Open gem sources in editor' super "open", "Open gem sources in editor"
add_option('-e', '--editor COMMAND', String, add_option("-e", "--editor COMMAND", String,
"Prepends COMMAND to gem path. Could be used to specify editor.") do |command, options| "Prepends COMMAND to gem path. Could be used to specify editor.") do |command, options|
options[:editor] = command || get_env_editor options[:editor] = command || get_env_editor
end end
add_option('-v', '--version VERSION', String, add_option("-v", "--version VERSION", String,
"Opens specific gem version") do |version| "Opens specific gem version") do |version|
options[:version] = version options[:version] = version
end end
@ -40,10 +40,10 @@ class Gem::Commands::OpenCommand < Gem::Command
end end
def get_env_editor def get_env_editor
ENV['GEM_EDITOR'] || ENV["GEM_EDITOR"] ||
ENV['VISUAL'] || ENV["VISUAL"] ||
ENV['EDITOR'] || ENV["EDITOR"] ||
'vi' "vi"
end end
def execute def execute

View file

@ -1,15 +1,15 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../local_remote_options' require_relative "../local_remote_options"
require_relative '../spec_fetcher' require_relative "../spec_fetcher"
require_relative '../version_option' require_relative "../version_option"
class Gem::Commands::OutdatedCommand < Gem::Command class Gem::Commands::OutdatedCommand < Gem::Command
include Gem::LocalRemoteOptions include Gem::LocalRemoteOptions
include Gem::VersionOption include Gem::VersionOption
def initialize def initialize
super 'outdated', 'Display all gems that need updates' super "outdated", "Display all gems that need updates"
add_local_remote_options add_local_remote_options
add_platform_option add_platform_option

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../local_remote_options' require_relative "../local_remote_options"
require_relative '../gemcutter_utilities' require_relative "../gemcutter_utilities"
require_relative '../text' require_relative "../text"
class Gem::Commands::OwnerCommand < Gem::Command class Gem::Commands::OwnerCommand < Gem::Command
include Gem::Text include Gem::Text
@ -34,23 +34,23 @@ permission to.
end end
def initialize def initialize
super 'owner', 'Manage gem owners of a gem on the push server' super "owner", "Manage gem owners of a gem on the push server"
add_proxy_option add_proxy_option
add_key_option add_key_option
add_otp_option add_otp_option
defaults.merge! :add => [], :remove => [] defaults.merge! :add => [], :remove => []
add_option '-a', '--add NEW_OWNER', 'Add an owner by user identifier' do |value, options| add_option "-a", "--add NEW_OWNER", "Add an owner by user identifier" do |value, options|
options[:add] << value options[:add] << value
end end
add_option '-r', '--remove OLD_OWNER', 'Remove an owner by user identifier' do |value, options| add_option "-r", "--remove OLD_OWNER", "Remove an owner by user identifier" do |value, options|
options[:remove] << value options[:remove] << value
end end
add_option '-h', '--host HOST', add_option "-h", "--host HOST",
'Use another gemcutter-compatible host', "Use another gemcutter-compatible host",
' (e.g. https://rubygems.org)' do |value, options| " (e.g. https://rubygems.org)" do |value, options|
options[:host] = value options[:host] = value
end end
end end
@ -108,7 +108,7 @@ permission to.
def send_owner_request(method, name, owner) def send_owner_request(method, name, owner)
rubygems_api_request method, "api/v1/gems/#{name}/owners", scope: get_owner_scope(method: method) do |request| rubygems_api_request method, "api/v1/gems/#{name}/owners", scope: get_owner_scope(method: method) do |request|
request.set_form_data 'email' => owner request.set_form_data "email" => owner
request.add_field "Authorization", api_key request.add_field "Authorization", api_key
end end
end end

View file

@ -1,67 +1,67 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../package' require_relative "../package"
require_relative '../installer' require_relative "../installer"
require_relative '../version_option' require_relative "../version_option"
class Gem::Commands::PristineCommand < Gem::Command class Gem::Commands::PristineCommand < Gem::Command
include Gem::VersionOption include Gem::VersionOption
def initialize def initialize
super 'pristine', super "pristine",
'Restores installed gems to pristine condition from files located in the gem cache', "Restores installed gems to pristine condition from files located in the gem cache",
:version => Gem::Requirement.default, :version => Gem::Requirement.default,
:extensions => true, :extensions => true,
:extensions_set => false, :extensions_set => false,
:all => false :all => false
add_option('--all', add_option("--all",
'Restore all installed gems to pristine', "Restore all installed gems to pristine",
'condition') do |value, options| "condition") do |value, options|
options[:all] = value options[:all] = value
end end
add_option('--skip=gem_name', add_option("--skip=gem_name",
'used on --all, skip if name == gem_name') do |value, options| "used on --all, skip if name == gem_name") do |value, options|
options[:skip] ||= [] options[:skip] ||= []
options[:skip] << value options[:skip] << value
end end
add_option('--[no-]extensions', add_option("--[no-]extensions",
'Restore gems with extensions', "Restore gems with extensions",
'in addition to regular gems') do |value, options| "in addition to regular gems") do |value, options|
options[:extensions_set] = true options[:extensions_set] = true
options[:extensions] = value options[:extensions] = value
end end
add_option('--only-executables', add_option("--only-executables",
'Only restore executables') do |value, options| "Only restore executables") do |value, options|
options[:only_executables] = value options[:only_executables] = value
end end
add_option('--only-plugins', add_option("--only-plugins",
'Only restore plugins') do |value, options| "Only restore plugins") do |value, options|
options[:only_plugins] = value options[:only_plugins] = value
end end
add_option('-E', '--[no-]env-shebang', add_option("-E", "--[no-]env-shebang",
'Rewrite executables with a shebang', "Rewrite executables with a shebang",
'of /usr/bin/env') do |value, options| "of /usr/bin/env") do |value, options|
options[:env_shebang] = value options[:env_shebang] = value
end end
add_option('-i', '--install-dir DIR', add_option("-i", "--install-dir DIR",
'Gem repository to get binstubs and plugins installed') do |value, options| "Gem repository to get binstubs and plugins installed") do |value, options|
options[:install_dir] = File.expand_path(value) options[:install_dir] = File.expand_path(value)
end end
add_option('-n', '--bindir DIR', add_option("-n", "--bindir DIR",
'Directory where executables are', "Directory where executables are",
'located') do |value, options| "located") do |value, options|
options[:bin_dir] = File.expand_path(value) options[:bin_dir] = File.expand_path(value)
end end
add_version_option('restore to', 'pristine condition') add_version_option("restore to", "pristine condition")
end end
def arguments # :nodoc: def arguments # :nodoc:
@ -69,7 +69,7 @@ class Gem::Commands::PristineCommand < Gem::Command
end end
def defaults_str # :nodoc: def defaults_str # :nodoc:
'--extensions' "--extensions"
end end
def description # :nodoc: def description # :nodoc:
@ -143,7 +143,7 @@ extensions will be restored.
gem = spec.cache_file gem = spec.cache_file
unless File.exist? gem or options[:only_executables] or options[:only_plugins] unless File.exist? gem or options[:only_executables] or options[:only_plugins]
require_relative '../remote_fetcher' require_relative "../remote_fetcher"
say "Cached gem for #{spec.full_name} not found, attempting to fetch..." say "Cached gem for #{spec.full_name} not found, attempting to fetch..."
@ -163,8 +163,8 @@ extensions will be restored.
if options.include? :env_shebang if options.include? :env_shebang
options[:env_shebang] options[:env_shebang]
else else
install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS['install'] install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS["install"]
install_defaults.to_s['--env-shebang'] install_defaults.to_s["--env-shebang"]
end end
bin_dir = options[:bin_dir] if options[:bin_dir] bin_dir = options[:bin_dir] if options[:bin_dir]

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../local_remote_options' require_relative "../local_remote_options"
require_relative '../gemcutter_utilities' require_relative "../gemcutter_utilities"
require_relative '../package' require_relative "../package"
class Gem::Commands::PushCommand < Gem::Command class Gem::Commands::PushCommand < Gem::Command
include Gem::LocalRemoteOptions include Gem::LocalRemoteOptions
@ -29,7 +29,7 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
end end
def initialize def initialize
super 'push', 'Push a gem up to the gem server', :host => self.host super "push", "Push a gem up to the gem server", :host => self.host
@user_defined_host = false @user_defined_host = false
@ -37,9 +37,9 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
add_key_option add_key_option
add_otp_option add_otp_option
add_option('--host HOST', add_option("--host HOST",
'Push to another gemcutter-compatible host', "Push to another gemcutter-compatible host",
' (e.g. https://rubygems.org)') do |value, options| " (e.g. https://rubygems.org)") do |value, options|
options[:host] = value options[:host] = value
@user_defined_host = true @user_defined_host = true
end end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../query_utils' require_relative "../query_utils"
require_relative '../deprecate' require_relative "../deprecate"
class Gem::Commands::QueryCommand < Gem::Command class Gem::Commands::QueryCommand < Gem::Command
extend Gem::Deprecate extend Gem::Deprecate
@ -17,15 +17,15 @@ class Gem::Commands::QueryCommand < Gem::Command
alert_warning message unless Gem::Deprecate.skip alert_warning message unless Gem::Deprecate.skip
end end
def initialize(name = 'query', def initialize(name = "query",
summary = 'Query gem information in local or remote repositories') summary = "Query gem information in local or remote repositories")
super name, summary, super name, summary,
:domain => :local, :details => false, :versions => true, :domain => :local, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default :installed => nil, :version => Gem::Requirement.default
add_option('-n', '--name-matches REGEXP', add_option("-n", "--name-matches REGEXP",
'Name of gem(s) to query on matches the', "Name of gem(s) to query on matches the",
'provided REGEXP') do |value, options| "provided REGEXP") do |value, options|
options[:name] = /#{value}/i options[:name] = /#{value}/i
end end

View file

@ -1,35 +1,35 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../version_option' require_relative "../version_option"
require_relative '../rdoc' require_relative "../rdoc"
require 'fileutils' require "fileutils"
class Gem::Commands::RdocCommand < Gem::Command class Gem::Commands::RdocCommand < Gem::Command
include Gem::VersionOption include Gem::VersionOption
def initialize def initialize
super 'rdoc', 'Generates RDoc for pre-installed gems', super "rdoc", "Generates RDoc for pre-installed gems",
:version => Gem::Requirement.default, :version => Gem::Requirement.default,
:include_rdoc => false, :include_ri => true, :overwrite => false :include_rdoc => false, :include_ri => true, :overwrite => false
add_option('--all', add_option("--all",
'Generate RDoc/RI documentation for all', "Generate RDoc/RI documentation for all",
'installed gems') do |value, options| "installed gems") do |value, options|
options[:all] = value options[:all] = value
end end
add_option('--[no-]rdoc', add_option("--[no-]rdoc",
'Generate RDoc HTML') do |value, options| "Generate RDoc HTML") do |value, options|
options[:include_rdoc] = value options[:include_rdoc] = value
end end
add_option('--[no-]ri', add_option("--[no-]ri",
'Generate RI data') do |value, options| "Generate RI data") do |value, options|
options[:include_ri] = value options[:include_ri] = value
end end
add_option('--[no-]overwrite', add_option("--[no-]overwrite",
'Overwrite installed documents') do |value, options| "Overwrite installed documents") do |value, options|
options[:overwrite] = value options[:overwrite] = value
end end
@ -69,7 +69,7 @@ Use --overwrite to force rebuilding of documentation.
end end
if specs.empty? if specs.empty?
alert_error 'No matching gems found' alert_error "No matching gems found"
terminate_interaction 1 terminate_interaction 1
end end
@ -79,8 +79,8 @@ Use --overwrite to force rebuilding of documentation.
doc.force = options[:overwrite] doc.force = options[:overwrite]
if options[:overwrite] if options[:overwrite]
FileUtils.rm_rf File.join(spec.doc_dir, 'ri') FileUtils.rm_rf File.join(spec.doc_dir, "ri")
FileUtils.rm_rf File.join(spec.doc_dir, 'rdoc') FileUtils.rm_rf File.join(spec.doc_dir, "rdoc")
end end
begin begin

View file

@ -1,12 +1,12 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../query_utils' require_relative "../query_utils"
class Gem::Commands::SearchCommand < Gem::Command class Gem::Commands::SearchCommand < Gem::Command
include Gem::QueryUtils include Gem::QueryUtils
def initialize def initialize
super 'search', 'Display remote gems whose name matches REGEXP', super "search", "Display remote gems whose name matches REGEXP",
:domain => :remote, :details => false, :versions => true, :domain => :remote, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default :installed => nil, :version => Gem::Requirement.default

View file

@ -1,12 +1,12 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
unless defined? Gem::Commands::ServerCommand unless defined? Gem::Commands::ServerCommand
class Gem::Commands::ServerCommand < Gem::Command class Gem::Commands::ServerCommand < Gem::Command
def initialize def initialize
super('server', 'Starts up a web server that hosts the RDoc (requires rubygems-server)') super("server", "Starts up a web server that hosts the RDoc (requires rubygems-server)")
begin begin
Gem::Specification.find_by_name('rubygems-server').activate Gem::Specification.find_by_name("rubygems-server").activate
rescue Gem::LoadError rescue Gem::LoadError
# no-op # no-op
end end

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
## ##
# Installs RubyGems itself. This command is ordinarily only available from a # Installs RubyGems itself. This command is ordinarily only available from a
@ -12,47 +12,47 @@ class Gem::Commands::SetupCommand < Gem::Command
ENV_PATHS = %w[/usr/bin/env /bin/env].freeze ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
def initialize def initialize
super 'setup', 'Install RubyGems', super "setup", "Install RubyGems",
:format_executable => false, :document => %w[ri], :format_executable => false, :document => %w[ri],
:force => true, :force => true,
:site_or_vendor => 'sitelibdir', :site_or_vendor => "sitelibdir",
:destdir => '', :prefix => '', :previous_version => '', :destdir => "", :prefix => "", :previous_version => "",
:regenerate_binstubs => true, :regenerate_binstubs => true,
:regenerate_plugins => true :regenerate_plugins => true
add_option '--previous-version=VERSION', add_option "--previous-version=VERSION",
'Previous version of RubyGems', "Previous version of RubyGems",
'Used for changelog processing' do |version, options| "Used for changelog processing" do |version, options|
options[:previous_version] = version options[:previous_version] = version
end end
add_option '--prefix=PREFIX', add_option "--prefix=PREFIX",
'Prefix path for installing RubyGems', "Prefix path for installing RubyGems",
'Will not affect gem repository location' do |prefix, options| "Will not affect gem repository location" do |prefix, options|
options[:prefix] = File.expand_path prefix options[:prefix] = File.expand_path prefix
end end
add_option '--destdir=DESTDIR', add_option "--destdir=DESTDIR",
'Root directory to install RubyGems into', "Root directory to install RubyGems into",
'Mainly used for packaging RubyGems' do |destdir, options| "Mainly used for packaging RubyGems" do |destdir, options|
options[:destdir] = File.expand_path destdir options[:destdir] = File.expand_path destdir
end end
add_option '--[no-]vendor', add_option "--[no-]vendor",
'Install into vendorlibdir not sitelibdir' do |vendor, options| "Install into vendorlibdir not sitelibdir" do |vendor, options|
options[:site_or_vendor] = vendor ? 'vendorlibdir' : 'sitelibdir' options[:site_or_vendor] = vendor ? "vendorlibdir" : "sitelibdir"
end end
add_option '--[no-]format-executable', add_option "--[no-]format-executable",
'Makes `gem` match ruby', "Makes `gem` match ruby",
'If Ruby is ruby18, gem will be gem18' do |value, options| "If Ruby is ruby18, gem will be gem18" do |value, options|
options[:format_executable] = value options[:format_executable] = value
end end
add_option '--[no-]document [TYPES]', Array, add_option "--[no-]document [TYPES]", Array,
'Generate documentation for RubyGems', "Generate documentation for RubyGems",
'List the documentation types you wish to', "List the documentation types you wish to",
'generate. For example: rdoc,ri' do |value, options| "generate. For example: rdoc,ri" do |value, options|
options[:document] = case value options[:document] = case value
when nil then %w[rdoc ri] when nil then %w[rdoc ri]
when false then [] when false then []
@ -60,46 +60,46 @@ class Gem::Commands::SetupCommand < Gem::Command
end end
end end
add_option '--[no-]rdoc', add_option "--[no-]rdoc",
'Generate RDoc documentation for RubyGems' do |value, options| "Generate RDoc documentation for RubyGems" do |value, options|
if value if value
options[:document] << 'rdoc' options[:document] << "rdoc"
else else
options[:document].delete 'rdoc' options[:document].delete "rdoc"
end end
options[:document].uniq! options[:document].uniq!
end end
add_option '--[no-]ri', add_option "--[no-]ri",
'Generate RI documentation for RubyGems' do |value, options| "Generate RI documentation for RubyGems" do |value, options|
if value if value
options[:document] << 'ri' options[:document] << "ri"
else else
options[:document].delete 'ri' options[:document].delete "ri"
end end
options[:document].uniq! options[:document].uniq!
end end
add_option '--[no-]regenerate-binstubs', add_option "--[no-]regenerate-binstubs",
'Regenerate gem binstubs' do |value, options| "Regenerate gem binstubs" do |value, options|
options[:regenerate_binstubs] = value options[:regenerate_binstubs] = value
end end
add_option '--[no-]regenerate-plugins', add_option "--[no-]regenerate-plugins",
'Regenerate gem plugins' do |value, options| "Regenerate gem plugins" do |value, options|
options[:regenerate_plugins] = value options[:regenerate_plugins] = value
end end
add_option '-f', '--[no-]force', add_option "-f", "--[no-]force",
'Forcefully overwrite binstubs' do |value, options| "Forcefully overwrite binstubs" do |value, options|
options[:force] = value options[:force] = value
end end
add_option('-E', '--[no-]env-shebang', add_option("-E", "--[no-]env-shebang",
'Rewrite executables with a shebang', "Rewrite executables with a shebang",
'of /usr/bin/env') do |value, options| "of /usr/bin/env") do |value, options|
options[:env_shebang] = value options[:env_shebang] = value
end end
@ -107,7 +107,7 @@ class Gem::Commands::SetupCommand < Gem::Command
end end
def check_ruby_version def check_ruby_version
required_version = Gem::Requirement.new '>= 2.3.0' required_version = Gem::Requirement.new ">= 2.3.0"
unless required_version.satisfied_by? Gem.ruby_version unless required_version.satisfied_by? Gem.ruby_version
alert_error "Expected Ruby version #{required_version}, is #{Gem.ruby_version}" alert_error "Expected Ruby version #{required_version}, is #{Gem.ruby_version}"
@ -149,7 +149,7 @@ By default, this RubyGems will install gem as:
check_ruby_version check_ruby_version
require 'fileutils' require "fileutils"
if Gem.configuration.really_verbose if Gem.configuration.really_verbose
extend FileUtils::Verbose extend FileUtils::Verbose
else else
@ -194,7 +194,7 @@ By default, this RubyGems will install gem as:
end end
if options[:previous_version].empty? if options[:previous_version].empty?
options[:previous_version] = Gem::VERSION.sub(/[0-9]+$/, '0') options[:previous_version] = Gem::VERSION.sub(/[0-9]+$/, "0")
end end
options[:previous_version] = Gem::Version.new(options[:previous_version]) options[:previous_version] = Gem::Version.new(options[:previous_version])
@ -216,7 +216,7 @@ By default, this RubyGems will install gem as:
end end
if documentation_success if documentation_success
if options[:document].include? 'rdoc' if options[:document].include? "rdoc"
say "Rdoc documentation was installed. You may now invoke:" say "Rdoc documentation was installed. You may now invoke:"
say " gem server" say " gem server"
say "and then peruse beautifully formatted documentation for your gems" say "and then peruse beautifully formatted documentation for your gems"
@ -227,7 +227,7 @@ By default, this RubyGems will install gem as:
say say
end end
if options[:document].include? 'ri' if options[:document].include? "ri"
say "Ruby Interactive (ri) documentation was installed. ri is kind of like man " say "Ruby Interactive (ri) documentation was installed. ri is kind of like man "
say "pages for Ruby libraries. You may access it like this:" say "pages for Ruby libraries. You may access it like this:"
say " ri Classname" say " ri Classname"
@ -244,14 +244,14 @@ By default, this RubyGems will install gem as:
def install_executables(bin_dir) def install_executables(bin_dir)
prog_mode = options[:prog_mode] || 0755 prog_mode = options[:prog_mode] || 0755
executables = { 'gem' => 'bin' } executables = { "gem" => "bin" }
executables.each do |tool, path| executables.each do |tool, path|
say "Installing #{tool} executable" if @verbose say "Installing #{tool} executable" if @verbose
Dir.chdir path do Dir.chdir path do
bin_file = "gem" bin_file = "gem"
require 'tmpdir' require "tmpdir"
dest_file = target_bin_path(bin_dir, bin_file) dest_file = target_bin_path(bin_dir, bin_file)
bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}" bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}"
@ -260,7 +260,7 @@ By default, this RubyGems will install gem as:
bin = File.readlines bin_file bin = File.readlines bin_file
bin[0] = shebang bin[0] = shebang
File.open bin_tmp_file, 'w' do |fp| File.open bin_tmp_file, "w" do |fp|
fp.puts bin.join fp.puts bin.join
end end
@ -275,7 +275,7 @@ By default, this RubyGems will install gem as:
begin begin
bin_cmd_file = File.join Dir.tmpdir, "#{bin_file}.bat" bin_cmd_file = File.join Dir.tmpdir, "#{bin_file}.bat"
File.open bin_cmd_file, 'w' do |file| File.open bin_cmd_file, "w" do |file|
file.puts <<-TEXT file.puts <<-TEXT
@ECHO OFF @ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT IF NOT "%~f0" == "~f0" GOTO :WinNT
@ -296,7 +296,7 @@ By default, this RubyGems will install gem as:
def shebang def shebang
if options[:env_shebang] if options[:env_shebang]
ruby_name = RbConfig::CONFIG['ruby_install_name'] ruby_name = RbConfig::CONFIG["ruby_install_name"]
@env_path ||= ENV_PATHS.find {|env_path| File.executable? env_path } @env_path ||= ENV_PATHS.find {|env_path| File.executable? env_path }
"#!#{@env_path} #{ruby_name}\n" "#!#{@env_path} #{ruby_name}\n"
else else
@ -305,8 +305,8 @@ By default, this RubyGems will install gem as:
end end
def install_lib(lib_dir) def install_lib(lib_dir)
libs = { 'RubyGems' => 'lib' } libs = { "RubyGems" => "lib" }
libs['Bundler'] = 'bundler/lib' libs["Bundler"] = "bundler/lib"
libs.each do |tool, path| libs.each do |tool, path|
say "Installing #{tool}" if @verbose say "Installing #{tool}" if @verbose
@ -319,7 +319,7 @@ By default, this RubyGems will install gem as:
end end
def install_rdoc def install_rdoc
gem_doc_dir = File.join Gem.dir, 'doc' gem_doc_dir = File.join Gem.dir, "doc"
rubygems_name = "rubygems-#{Gem::VERSION}" rubygems_name = "rubygems-#{Gem::VERSION}"
rubygems_doc_dir = File.join gem_doc_dir, rubygems_name rubygems_doc_dir = File.join gem_doc_dir, rubygems_name
@ -333,19 +333,19 @@ By default, this RubyGems will install gem as:
(not File.exist? rubygems_doc_dir or (not File.exist? rubygems_doc_dir or
File.writable? rubygems_doc_dir) File.writable? rubygems_doc_dir)
say "Removing old RubyGems RDoc and ri" if @verbose say "Removing old RubyGems RDoc and ri" if @verbose
Dir[File.join(Gem.dir, 'doc', 'rubygems-[0-9]*')].each do |dir| Dir[File.join(Gem.dir, "doc", "rubygems-[0-9]*")].each do |dir|
rm_rf dir rm_rf dir
end end
require_relative '../rdoc' require_relative "../rdoc"
fake_spec = Gem::Specification.new 'rubygems', Gem::VERSION fake_spec = Gem::Specification.new "rubygems", Gem::VERSION
def fake_spec.full_gem_path def fake_spec.full_gem_path
File.expand_path '../../..', __dir__ File.expand_path "../../..", __dir__
end end
generate_ri = options[:document].include? 'ri' generate_ri = options[:document].include? "ri"
generate_rdoc = options[:document].include? 'rdoc' generate_rdoc = options[:document].include? "rdoc"
rdoc = Gem::RDoc.new fake_spec, generate_rdoc, generate_ri rdoc = Gem::RDoc.new fake_spec, generate_rdoc, generate_ri
rdoc.generate rdoc.generate
@ -360,34 +360,24 @@ By default, this RubyGems will install gem as:
end end
def install_default_bundler_gem(bin_dir) def install_default_bundler_gem(bin_dir)
specs_dir = File.join(default_dir, "specifications", "default")
mkdir_p specs_dir, :mode => 0755
bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
current_default_spec = Gem::Specification.default_stubs.find {|s| s.name == "bundler" } current_default_spec = Gem::Specification.default_stubs.find {|s| s.name == "bundler" }
if current_default_spec specs_dir = if current_default_spec && default_dir == Gem.default_dir
File.delete(current_default_spec.loaded_from)
Gem::Specification.remove_spec current_default_spec Gem::Specification.remove_spec current_default_spec
loaded_from = current_default_spec.loaded_from
File.delete(loaded_from)
File.dirname(loaded_from)
else
target_specs_dir = File.join(default_dir, "specifications", "default")
mkdir_p target_specs_dir, :mode => 0755
target_specs_dir
end end
bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
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)
bundler_spec = Gem::Specification.load(default_spec_path) bundler_spec = Gem::Specification.load(default_spec_path)
# The base_dir value for a specification is inferred by walking up from the
# folder where the spec was `loaded_from`. In the case of default gems, we
# walk up two levels, because they live at `specifications/default/`, whereas
# in the case of regular gems we walk up just one level because they live at
# `specifications/`. However, in this case, the gem we are installing is
# misdetected as a regular gem, when it's a default gem in reality. This is
# because when there's a `:destdir`, the `loaded_from` path has changed and
# doesn't match `Gem.default_specifications_dir` which is the criteria to
# tag a gem as a default gem. So, in that case, write the correct
# `@base_dir` directly.
bundler_spec.instance_variable_set(:@base_dir, File.dirname(File.dirname(specs_dir)))
# Remove gemspec that was same version of vendored bundler. # Remove gemspec that was same version of vendored bundler.
normal_gemspec = File.join(default_dir, "specifications", "bundler-#{bundler_spec.version}.gemspec") normal_gemspec = File.join(default_dir, "specifications", "bundler-#{bundler_spec.version}.gemspec")
if File.file? normal_gemspec if File.file? normal_gemspec
@ -407,7 +397,7 @@ By default, this RubyGems will install gem as:
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e) cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
end end
require_relative '../installer' require_relative "../installer"
Dir.chdir("bundler") do Dir.chdir("bundler") do
built_gem = Gem::Package.build(bundler_spec) built_gem = Gem::Package.build(bundler_spec)
@ -449,10 +439,10 @@ By default, this RubyGems will install gem as:
prefix = options[:prefix] prefix = options[:prefix]
if prefix.empty? if prefix.empty?
man_dir = RbConfig::CONFIG['mandir'] man_dir = RbConfig::CONFIG["mandir"]
return unless man_dir return unless man_dir
else else
man_dir = File.join prefix, 'man' man_dir = File.join prefix, "man"
end end
prepend_destdir_if_present(man_dir) prepend_destdir_if_present(man_dir)
@ -464,10 +454,10 @@ By default, this RubyGems will install gem as:
if prefix.empty? if prefix.empty?
lib_dir = RbConfig::CONFIG[site_or_vendor] lib_dir = RbConfig::CONFIG[site_or_vendor]
bin_dir = RbConfig::CONFIG['bindir'] bin_dir = RbConfig::CONFIG["bindir"]
else else
lib_dir = File.join prefix, 'lib' lib_dir = File.join prefix, "lib"
bin_dir = File.join prefix, 'bin' bin_dir = File.join prefix, "bin"
end end
[prepend_destdir_if_present(lib_dir), prepend_destdir_if_present(bin_dir)] [prepend_destdir_if_present(lib_dir), prepend_destdir_if_present(bin_dir)]
@ -475,19 +465,19 @@ By default, this RubyGems will install gem as:
def files_in(dir) def files_in(dir)
Dir.chdir dir do Dir.chdir dir do
Dir.glob(File.join('**', '*'), File::FNM_DOTMATCH). Dir.glob(File.join("**", "*"), File::FNM_DOTMATCH).
select {|f| !File.directory?(f) } select {|f| !File.directory?(f) }
end end
end end
def remove_old_bin_files(bin_dir) def remove_old_bin_files(bin_dir)
old_bin_files = { old_bin_files = {
'gem_mirror' => 'gem mirror', "gem_mirror" => "gem mirror",
'gem_server' => 'gem server', "gem_server" => "gem server",
'gemlock' => 'gem lock', "gemlock" => "gem lock",
'gemri' => 'ri', "gemri" => "ri",
'gemwhich' => 'gem which', "gemwhich" => "gem which",
'index_gem_repository.rb' => 'gem generate_index', "index_gem_repository.rb" => "gem generate_index",
} }
old_bin_files.each do |old_bin_file, new_name| old_bin_files.each do |old_bin_file, new_name|
@ -496,7 +486,7 @@ By default, this RubyGems will install gem as:
deprecation_message = "`#{old_bin_file}` has been deprecated. Use `#{new_name}` instead." deprecation_message = "`#{old_bin_file}` has been deprecated. Use `#{new_name}` instead."
File.open old_bin_path, 'w' do |fp| File.open old_bin_path, "w" do |fp|
fp.write <<-EOF fp.write <<-EOF
#!#{Gem.ruby} #!#{Gem.ruby}
@ -506,15 +496,15 @@ abort "#{deprecation_message}"
next unless Gem.win_platform? next unless Gem.win_platform?
File.open "#{old_bin_path}.bat", 'w' do |fp| File.open "#{old_bin_path}.bat", "w" do |fp|
fp.puts %(@ECHO.#{deprecation_message}) fp.puts %(@ECHO.#{deprecation_message})
end end
end end
end end
def remove_old_lib_files(lib_dir) def remove_old_lib_files(lib_dir)
lib_dirs = { File.join(lib_dir, 'rubygems') => 'lib/rubygems' } lib_dirs = { File.join(lib_dir, "rubygems") => "lib/rubygems" }
lib_dirs[File.join(lib_dir, 'bundler')] = 'bundler/lib/bundler' lib_dirs[File.join(lib_dir, "bundler")] = "bundler/lib/bundler"
lib_dirs.each do |old_lib_dir, new_lib_dir| lib_dirs.each do |old_lib_dir, new_lib_dir|
lib_files = files_in(new_lib_dir) lib_files = files_in(new_lib_dir)
@ -522,11 +512,11 @@ abort "#{deprecation_message}"
to_remove = old_lib_files - lib_files to_remove = old_lib_files - lib_files
gauntlet_rubygems = File.join(lib_dir, 'gauntlet_rubygems.rb') gauntlet_rubygems = File.join(lib_dir, "gauntlet_rubygems.rb")
to_remove << gauntlet_rubygems if File.exist? gauntlet_rubygems to_remove << gauntlet_rubygems if File.exist? gauntlet_rubygems
to_remove.delete_if do |file| to_remove.delete_if do |file|
file.start_with? 'defaults' file.start_with? "defaults"
end end
remove_file_list(to_remove, old_lib_dir) remove_file_list(to_remove, old_lib_dir)
@ -552,7 +542,7 @@ abort "#{deprecation_message}"
end end
def show_release_notes def show_release_notes
release_notes = File.join Dir.pwd, 'CHANGELOG.md' release_notes = File.join Dir.pwd, "CHANGELOG.md"
release_notes = release_notes =
if File.exist? release_notes if File.exist? release_notes
@ -583,10 +573,10 @@ abort "#{deprecation_message}"
end end
def uninstall_old_gemcutter def uninstall_old_gemcutter
require_relative '../uninstaller' require_relative "../uninstaller"
ui = Gem::Uninstaller.new('gemcutter', :all => true, :ignore => true, ui = Gem::Uninstaller.new("gemcutter", :all => true, :ignore => true,
:version => '< 0.4') :version => "< 0.4")
ui.uninstall ui.uninstall
rescue Gem::InstallError rescue Gem::InstallError
end end
@ -635,7 +625,7 @@ abort "#{deprecation_message}"
destdir = options[:destdir] destdir = options[:destdir]
return path if destdir.empty? return path if destdir.empty?
File.join(options[:destdir], path.gsub(/^[a-zA-Z]:/, '')) File.join(options[:destdir], path.gsub(/^[a-zA-Z]:/, ""))
end end
def install_file_list(files, dest_dir) def install_file_list(files, dest_dir)

View file

@ -1,15 +1,15 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../gemcutter_utilities' require_relative "../gemcutter_utilities"
class Gem::Commands::SigninCommand < Gem::Command class Gem::Commands::SigninCommand < Gem::Command
include Gem::GemcutterUtilities include Gem::GemcutterUtilities
def initialize def initialize
super 'signin', 'Sign in to any gemcutter-compatible host. '\ super "signin", "Sign in to any gemcutter-compatible host. "\
'It defaults to https://rubygems.org' "It defaults to https://rubygems.org"
add_option('--host HOST', 'Push to another gemcutter-compatible host') do |value, options| add_option("--host HOST", "Push to another gemcutter-compatible host") do |value, options|
options[:host] = value options[:host] = value
end end
@ -17,10 +17,10 @@ class Gem::Commands::SigninCommand < Gem::Command
end end
def description # :nodoc: def description # :nodoc:
'The signin command executes host sign in for a push server (the default is'\ "The signin command executes host sign in for a push server (the default is"\
' https://rubygems.org). The host can be provided with the host flag or can'\ " https://rubygems.org). The host can be provided with the host flag or can"\
' be inferred from the provided gem. Host resolution matches the resolution'\ " be inferred from the provided gem. Host resolution matches the resolution"\
' strategy for the push command.' " strategy for the push command."
end end
def usage # :nodoc: def usage # :nodoc:

View file

@ -1,14 +1,14 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
class Gem::Commands::SignoutCommand < Gem::Command class Gem::Commands::SignoutCommand < Gem::Command
def initialize def initialize
super 'signout', 'Sign out from all the current sessions.' super "signout", "Sign out from all the current sessions."
end end
def description # :nodoc: def description # :nodoc:
'The `signout` command is used to sign out from all current sessions,'\ "The `signout` command is used to sign out from all current sessions,"\
' allowing you to sign in using a different set of credentials.' " allowing you to sign in using a different set of credentials."
end end
def usage # :nodoc: def usage # :nodoc:
@ -19,13 +19,13 @@ class Gem::Commands::SignoutCommand < Gem::Command
credentials_path = Gem.configuration.credentials_path credentials_path = Gem.configuration.credentials_path
if !File.exist?(credentials_path) if !File.exist?(credentials_path)
alert_error 'You are not currently signed in.' alert_error "You are not currently signed in."
elsif !File.writable?(credentials_path) elsif !File.writable?(credentials_path)
alert_error "File '#{Gem.configuration.credentials_path}' is read-only."\ alert_error "File '#{Gem.configuration.credentials_path}' is read-only."\
' Please make sure it is writable.' " Please make sure it is writable."
else else
Gem.configuration.unset_api_key! Gem.configuration.unset_api_key!
say 'You have successfully signed out from all sessions.' say "You have successfully signed out from all sessions."
end end
end end
end end

View file

@ -1,40 +1,40 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../remote_fetcher' require_relative "../remote_fetcher"
require_relative '../spec_fetcher' require_relative "../spec_fetcher"
require_relative '../local_remote_options' require_relative "../local_remote_options"
class Gem::Commands::SourcesCommand < Gem::Command class Gem::Commands::SourcesCommand < Gem::Command
include Gem::LocalRemoteOptions include Gem::LocalRemoteOptions
def initialize def initialize
require 'fileutils' require "fileutils"
super 'sources', super "sources",
'Manage the sources and cache file RubyGems uses to search for gems' "Manage the sources and cache file RubyGems uses to search for gems"
add_option '-a', '--add SOURCE_URI', 'Add source' do |value, options| add_option "-a", "--add SOURCE_URI", "Add source" do |value, options|
options[:add] = value options[:add] = value
end end
add_option '-l', '--list', 'List sources' do |value, options| add_option "-l", "--list", "List sources" do |value, options|
options[:list] = value options[:list] = value
end end
add_option '-r', '--remove SOURCE_URI', 'Remove source' do |value, options| add_option "-r", "--remove SOURCE_URI", "Remove source" do |value, options|
options[:remove] = value options[:remove] = value
end end
add_option '-c', '--clear-all', add_option "-c", "--clear-all",
'Remove all sources (clear the cache)' do |value, options| "Remove all sources (clear the cache)" do |value, options|
options[:clear_all] = value options[:clear_all] = value
end end
add_option '-u', '--update', 'Update source cache' do |value, options| add_option "-u", "--update", "Update source cache" do |value, options|
options[:update] = value options[:update] = value
end end
add_option '-f', '--[no-]force', "Do not show any confirmation prompts and behave as if 'yes' was always answered" do |value, options| add_option "-f", "--[no-]force", "Do not show any confirmation prompts and behave as if 'yes' was always answered" do |value, options|
options[:force] = value options[:force] = value
end end
@ -82,8 +82,8 @@ Do you want to add this source?
def check_rubygems_https(source_uri) # :nodoc: def check_rubygems_https(source_uri) # :nodoc:
uri = URI source_uri uri = URI source_uri
if uri.scheme and uri.scheme.downcase == 'http' and if uri.scheme and uri.scheme.downcase == "http" and
uri.host.downcase == 'rubygems.org' uri.host.downcase == "rubygems.org"
question = <<-QUESTION.chomp question = <<-QUESTION.chomp
https://rubygems.org is recommended for security over #{uri} https://rubygems.org is recommended for security over #{uri}
@ -112,7 +112,7 @@ Do you want to add this insecure source?
end end
def defaults_str # :nodoc: def defaults_str # :nodoc:
'--list' "--list"
end end
def description # :nodoc: def description # :nodoc:
@ -138,8 +138,8 @@ do not recognize you should remove them.
RubyGems has been configured to serve gems via the following URLs through RubyGems has been configured to serve gems via the following URLs through
its history: its history:
* http://gems.rubyforge.org (RubyGems 1.3.6 and earlier) * http://gems.rubyforge.org (RubyGems 1.3.5 and earlier)
* https://rubygems.org/ (RubyGems 1.3.7 through 1.8.25) * http://rubygems.org (RubyGems 1.3.6 through 1.8.30, and 2.0.0)
* https://rubygems.org (RubyGems 2.0.1 and newer) * https://rubygems.org (RubyGems 2.0.1 and newer)
Since all of these sources point to the same set of gems you only need one Since all of these sources point to the same set of gems you only need one

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../local_remote_options' require_relative "../local_remote_options"
require_relative '../version_option' require_relative "../version_option"
require_relative '../package' require_relative "../package"
class Gem::Commands::SpecificationCommand < Gem::Command class Gem::Commands::SpecificationCommand < Gem::Command
include Gem::LocalRemoteOptions include Gem::LocalRemoteOptions
@ -11,28 +11,28 @@ class Gem::Commands::SpecificationCommand < Gem::Command
def initialize def initialize
Gem.load_yaml Gem.load_yaml
super 'specification', 'Display gem specification (in yaml)', super "specification", "Display gem specification (in yaml)",
:domain => :local, :version => Gem::Requirement.default, :domain => :local, :version => Gem::Requirement.default,
:format => :yaml :format => :yaml
add_version_option('examine') add_version_option("examine")
add_platform_option add_platform_option
add_prerelease_option add_prerelease_option
add_option('--all', 'Output specifications for all versions of', add_option("--all", "Output specifications for all versions of",
'the gem') do |value, options| "the gem") do |value, options|
options[:all] = true options[:all] = true
end end
add_option('--ruby', 'Output ruby format') do |value, options| add_option("--ruby", "Output ruby format") do |value, options|
options[:format] = :ruby options[:format] = :ruby
end end
add_option('--yaml', 'Output YAML format') do |value, options| add_option("--yaml", "Output YAML format") do |value, options|
options[:format] = :yaml options[:format] = :yaml
end end
add_option('--marshal', 'Output Marshal format') do |value, options| add_option("--marshal", "Output Marshal format") do |value, options|
options[:format] = :marshal options[:format] = :marshal
end end

View file

@ -1,9 +1,9 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
class Gem::Commands::StaleCommand < Gem::Command class Gem::Commands::StaleCommand < Gem::Command
def initialize def initialize
super('stale', 'List gems along with access times') super("stale", "List gems along with access times")
end end
def description # :nodoc: def description # :nodoc:

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../version_option' require_relative "../version_option"
require_relative '../uninstaller' require_relative "../uninstaller"
require 'fileutils' require "fileutils"
## ##
# Gem uninstaller command line tool # Gem uninstaller command line tool
@ -13,78 +13,78 @@ class Gem::Commands::UninstallCommand < Gem::Command
include Gem::VersionOption include Gem::VersionOption
def initialize def initialize
super 'uninstall', 'Uninstall gems from the local repository', super "uninstall", "Uninstall gems from the local repository",
:version => Gem::Requirement.default, :user_install => true, :version => Gem::Requirement.default, :user_install => true,
:check_dev => false, :vendor => false :check_dev => false, :vendor => false
add_option('-a', '--[no-]all', add_option("-a", "--[no-]all",
'Uninstall all matching versions' "Uninstall all matching versions"
) do |value, options| ) do |value, options|
options[:all] = value options[:all] = value
end end
add_option('-I', '--[no-]ignore-dependencies', add_option("-I", "--[no-]ignore-dependencies",
'Ignore dependency requirements while', "Ignore dependency requirements while",
'uninstalling') do |value, options| "uninstalling") do |value, options|
options[:ignore] = value options[:ignore] = value
end end
add_option('-D', '--[no-]check-development', add_option("-D", "--[no-]check-development",
'Check development dependencies while uninstalling', "Check development dependencies while uninstalling",
'(default: false)') do |value, options| "(default: false)") do |value, options|
options[:check_dev] = value options[:check_dev] = value
end end
add_option('-x', '--[no-]executables', add_option("-x", "--[no-]executables",
'Uninstall applicable executables without', "Uninstall applicable executables without",
'confirmation') do |value, options| "confirmation") do |value, options|
options[:executables] = value options[:executables] = value
end end
add_option('-i', '--install-dir DIR', add_option("-i", "--install-dir DIR",
'Directory to uninstall gem from') do |value, options| "Directory to uninstall gem from") do |value, options|
options[:install_dir] = File.expand_path(value) options[:install_dir] = File.expand_path(value)
end end
add_option('-n', '--bindir DIR', add_option("-n", "--bindir DIR",
'Directory to remove executables from') do |value, options| "Directory to remove executables from") do |value, options|
options[:bin_dir] = File.expand_path(value) options[:bin_dir] = File.expand_path(value)
end end
add_option('--[no-]user-install', add_option("--[no-]user-install",
'Uninstall from user\'s home directory', "Uninstall from user's home directory",
'in addition to GEM_HOME.') do |value, options| "in addition to GEM_HOME.") do |value, options|
options[:user_install] = value options[:user_install] = value
end end
add_option('--[no-]format-executable', add_option("--[no-]format-executable",
'Assume executable names match Ruby\'s prefix and suffix.') do |value, options| "Assume executable names match Ruby's prefix and suffix.") do |value, options|
options[:format_executable] = value options[:format_executable] = value
end end
add_option('--[no-]force', add_option("--[no-]force",
'Uninstall all versions of the named gems', "Uninstall all versions of the named gems",
'ignoring dependencies') do |value, options| "ignoring dependencies") do |value, options|
options[:force] = value options[:force] = value
end end
add_option('--[no-]abort-on-dependent', add_option("--[no-]abort-on-dependent",
'Prevent uninstalling gems that are', "Prevent uninstalling gems that are",
'depended on by other gems.') do |value, options| "depended on by other gems.") do |value, options|
options[:abort_on_dependent] = value options[:abort_on_dependent] = value
end end
add_version_option add_version_option
add_platform_option add_platform_option
add_option('--vendor', add_option("--vendor",
'Uninstall gem from the vendor directory.', "Uninstall gem from the vendor directory.",
'Only for use by gem repackagers.') do |value, options| "Only for use by gem repackagers.") do |value, options|
unless Gem.vendor_dir unless Gem.vendor_dir
raise Gem::OptionParser::InvalidOption.new 'your platform is not supported' raise Gem::OptionParser::InvalidOption.new "your platform is not supported"
end end
alert_warning 'Use your OS package manager to uninstall vendor gems' alert_warning "Use your OS package manager to uninstall vendor gems"
options[:vendor] = true options[:vendor] = true
options[:install_dir] = Gem.vendor_dir options[:install_dir] = Gem.vendor_dir
end end

View file

@ -1,9 +1,9 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../version_option' require_relative "../version_option"
require_relative '../security_option' require_relative "../security_option"
require_relative '../remote_fetcher' require_relative "../remote_fetcher"
require_relative '../package' require_relative "../package"
# forward-declare # forward-declare
@ -17,18 +17,18 @@ class Gem::Commands::UnpackCommand < Gem::Command
include Gem::SecurityOption include Gem::SecurityOption
def initialize def initialize
require 'fileutils' require "fileutils"
super 'unpack', 'Unpack an installed gem to the current directory', super "unpack", "Unpack an installed gem to the current directory",
:version => Gem::Requirement.default, :version => Gem::Requirement.default,
:target => Dir.pwd :target => Dir.pwd
add_option('--target=DIR', add_option("--target=DIR",
'target directory for unpacking') do |value, options| "target directory for unpacking") do |value, options|
options[:target] = value options[:target] = value
end end
add_option('--spec', 'unpack the gem specification') do |value, options| add_option("--spec", "unpack the gem specification") do |value, options|
options[:spec] = true options[:spec] = true
end end
@ -103,11 +103,11 @@ command help for an example.
end end
end end
File.open destination, 'w' do |io| File.open destination, "w" do |io|
io.write metadata io.write metadata
end end
else else
basename = File.basename path, '.gem' basename = File.basename path, ".gem"
target_dir = File.expand_path basename, options[:target] target_dir = File.expand_path basename, options[:target]
package = Gem::Package.new path, security_policy package = Gem::Package.new path, security_policy

View file

@ -1,13 +1,13 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../command_manager' require_relative "../command_manager"
require_relative '../dependency_installer' require_relative "../dependency_installer"
require_relative '../install_update_options' require_relative "../install_update_options"
require_relative '../local_remote_options' require_relative "../local_remote_options"
require_relative '../spec_fetcher' require_relative "../spec_fetcher"
require_relative '../version_option' require_relative "../version_option"
require_relative '../install_message' # must come before rdoc for messaging require_relative "../install_message" # must come before rdoc for messaging
require_relative '../rdoc' require_relative "../rdoc"
class Gem::Commands::UpdateCommand < Gem::Command class Gem::Commands::UpdateCommand < Gem::Command
include Gem::InstallUpdateOptions include Gem::InstallUpdateOptions
@ -25,7 +25,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
options.merge!(install_update_options) options.merge!(install_update_options)
super 'update', 'Update installed gems to the latest version', options super "update", "Update installed gems to the latest version", options
add_install_update_options add_install_update_options
@ -35,8 +35,8 @@ class Gem::Commands::UpdateCommand < Gem::Command
value value
end end
add_option('--system [VERSION]', Gem::Version, add_option("--system [VERSION]", Gem::Version,
'Update the RubyGems system software') do |value, options| "Update the RubyGems system software") do |value, options|
value = true unless value value = true unless value
options[:system] = value options[:system] = value
@ -166,13 +166,8 @@ command to remove old versions.
def highest_remote_name_tuple(spec) # :nodoc: def highest_remote_name_tuple(spec) # :nodoc:
spec_tuples = fetch_remote_gems spec spec_tuples = fetch_remote_gems spec
matching_gems = spec_tuples.select do |g,_| highest_remote_gem = spec_tuples.max
g.name == spec.name and g.match_platform? return unless highest_remote_gem
end
highest_remote_gem = matching_gems.max
highest_remote_gem ||= [Gem::NameTuple.null]
highest_remote_gem.first highest_remote_gem.first
end end
@ -181,13 +176,13 @@ command to remove old versions.
args = update_rubygems_arguments args = update_rubygems_arguments
version = spec.version version = spec.version
update_dir = File.join spec.base_dir, 'gems', "rubygems-update-#{version}" update_dir = File.join spec.base_dir, "gems", "rubygems-update-#{version}"
Dir.chdir update_dir do Dir.chdir update_dir do
say "Installing RubyGems #{version}" unless options[:silent] say "Installing RubyGems #{version}" unless options[:silent]
installed = preparing_gem_layout_for(version) do installed = preparing_gem_layout_for(version) do
system Gem.ruby, '--disable-gems', 'setup.rb', *args system Gem.ruby, "--disable-gems", "setup.rb", *args
end end
say "RubyGems system software updated" if installed unless options[:silent] say "RubyGems system software updated" if installed unless options[:silent]
@ -218,30 +213,22 @@ command to remove old versions.
version = options[:system] version = options[:system]
update_latest = version == true update_latest = version == true
if update_latest unless update_latest
version = Gem::Version.new Gem::VERSION
requirement = Gem::Requirement.new ">= #{Gem::VERSION}"
else
version = Gem::Version.new version version = Gem::Version.new version
requirement = Gem::Requirement.new version requirement = Gem::Requirement.new version
return version, requirement
end end
version = Gem::Version.new Gem::VERSION
requirement = Gem::Requirement.new ">= #{Gem::VERSION}"
rubygems_update = Gem::Specification.new rubygems_update = Gem::Specification.new
rubygems_update.name = 'rubygems-update' rubygems_update.name = "rubygems-update"
rubygems_update.version = version rubygems_update.version = version
hig = { highest_remote_tup = highest_remote_name_tuple(rubygems_update)
'rubygems-update' => rubygems_update, target = highest_remote_tup ? highest_remote_tup.version : version
}
gems_to_update = which_to_update hig, options[:args], :system
up_ver = gems_to_update.first.version
target = if update_latest
up_ver
else
version
end
return target, requirement return target, requirement
end end
@ -291,8 +278,8 @@ command to remove old versions.
check_oldest_rubygems version check_oldest_rubygems version
installed_gems = Gem::Specification.find_all_by_name 'rubygems-update', requirement installed_gems = Gem::Specification.find_all_by_name "rubygems-update", requirement
installed_gems = update_gem('rubygems-update', version) if installed_gems.empty? || installed_gems.first.version != version installed_gems = update_gem("rubygems-update", version) if installed_gems.empty? || installed_gems.first.version != version
return if installed_gems.empty? return if installed_gems.empty?
install_rubygems installed_gems.first install_rubygems installed_gems.first
@ -300,17 +287,17 @@ command to remove old versions.
def update_rubygems_arguments # :nodoc: def update_rubygems_arguments # :nodoc:
args = [] args = []
args << '--silent' if options[:silent] args << "--silent" if options[:silent]
args << '--prefix' << Gem.prefix if Gem.prefix args << "--prefix" << Gem.prefix if Gem.prefix
args << '--no-document' unless options[:document].include?('rdoc') || options[:document].include?('ri') args << "--no-document" unless options[:document].include?("rdoc") || options[:document].include?("ri")
args << '--no-format-executable' if options[:no_format_executable] args << "--no-format-executable" if options[:no_format_executable]
args << '--previous-version' << Gem::VERSION if args << "--previous-version" << Gem::VERSION if
options[:system] == true or options[:system] == true or
Gem::Version.new(options[:system]) >= Gem::Version.new(2) Gem::Version.new(options[:system]) >= Gem::Version.new(2)
args args
end end
def which_to_update(highest_installed_gems, gem_names, system = false) def which_to_update(highest_installed_gems, gem_names)
result = [] result = []
highest_installed_gems.each do |l_name, l_spec| highest_installed_gems.each do |l_name, l_spec|
@ -318,12 +305,9 @@ command to remove old versions.
gem_names.none? {|name| name == l_spec.name } gem_names.none? {|name| name == l_spec.name }
highest_remote_tup = highest_remote_name_tuple l_spec highest_remote_tup = highest_remote_name_tuple l_spec
highest_remote_ver = highest_remote_tup.version next unless highest_remote_tup
highest_installed_ver = l_spec.version
if system or (highest_installed_ver < highest_remote_ver) result << highest_remote_tup
result << Gem::NameTuple.new(l_spec.name, [highest_installed_ver, highest_remote_ver].max, highest_remote_tup.platform)
end
end end
result result

View file

@ -1,17 +1,17 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
class Gem::Commands::WhichCommand < Gem::Command class Gem::Commands::WhichCommand < Gem::Command
def initialize def initialize
super 'which', 'Find the location of a library file you can require', super "which", "Find the location of a library file you can require",
:search_gems_first => false, :show_all => false :search_gems_first => false, :show_all => false
add_option '-a', '--[no-]all', 'show all matching files' do |show_all, options| add_option "-a", "--[no-]all", "show all matching files" do |show_all, options|
options[:show_all] = show_all options[:show_all] = show_all
end end
add_option '-g', '--[no-]gems-first', add_option "-g", "--[no-]gems-first",
'search gems before non-gems' do |gems_first, options| "search gems before non-gems" do |gems_first, options|
options[:search_gems_first] = gems_first options[:search_gems_first] = gems_first
end end
end end
@ -39,7 +39,7 @@ requiring to see why it does not behave as you expect.
found = true found = true
options[:args].each do |arg| options[:args].each do |arg|
arg = arg.sub(/#{Regexp.union(*Gem.suffixes)}$/, '') arg = arg.sub(/#{Regexp.union(*Gem.suffixes)}$/, "")
dirs = $LOAD_PATH dirs = $LOAD_PATH
spec = Gem::Specification.find_by_path arg spec = Gem::Specification.find_by_path arg

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../command' require_relative "../command"
require_relative '../local_remote_options' require_relative "../local_remote_options"
require_relative '../version_option' require_relative "../version_option"
require_relative '../gemcutter_utilities' require_relative "../gemcutter_utilities"
class Gem::Commands::YankCommand < Gem::Command class Gem::Commands::YankCommand < Gem::Command
include Gem::LocalRemoteOptions include Gem::LocalRemoteOptions
@ -28,15 +28,15 @@ data you will need to change them immediately and yank your gem.
end end
def initialize def initialize
super 'yank', 'Remove a pushed gem from the index' super "yank", "Remove a pushed gem from the index"
add_version_option("remove") add_version_option("remove")
add_platform_option("remove") add_platform_option("remove")
add_otp_option add_otp_option
add_option('--host HOST', add_option("--host HOST",
'Yank from another gemcutter-compatible host', "Yank from another gemcutter-compatible host",
' (e.g. https://rubygems.org)') do |value, options| " (e.g. https://rubygems.org)") do |value, options|
options[:host] = value options[:host] = value
end end
@ -76,10 +76,10 @@ data you will need to change them immediately and yank your gem.
request.add_field("Authorization", api_key) request.add_field("Authorization", api_key)
data = { data = {
'gem_name' => name, "gem_name" => name,
'version' => version, "version" => version,
} }
data['platform'] = platform if platform data["platform"] = platform if platform
request.set_form_data data request.set_form_data data
end end

View file

@ -5,8 +5,8 @@
# See LICENSE.txt for permissions. # See LICENSE.txt for permissions.
#++ #++
require_relative 'user_interaction' require_relative "user_interaction"
require 'rbconfig' require "rbconfig"
## ##
# Gem::ConfigFile RubyGems options and gem command options from gemrc. # Gem::ConfigFile RubyGems options and gem command options from gemrc.
@ -71,7 +71,7 @@ class Gem::ConfigFile
# :startdoc: # :startdoc:
SYSTEM_WIDE_CONFIG_FILE = File.join SYSTEM_CONFIG_PATH, 'gemrc' SYSTEM_WIDE_CONFIG_FILE = File.join SYSTEM_CONFIG_PATH, "gemrc"
## ##
# List of arguments supplied to the config file object. # List of arguments supplied to the config file object.
@ -182,20 +182,20 @@ class Gem::ConfigFile
@update_sources = DEFAULT_UPDATE_SOURCES @update_sources = DEFAULT_UPDATE_SOURCES
@concurrent_downloads = DEFAULT_CONCURRENT_DOWNLOADS @concurrent_downloads = DEFAULT_CONCURRENT_DOWNLOADS
@cert_expiration_length_days = DEFAULT_CERT_EXPIRATION_LENGTH_DAYS @cert_expiration_length_days = DEFAULT_CERT_EXPIRATION_LENGTH_DAYS
@ipv4_fallback_enabled = ENV['IPV4_FALLBACK_ENABLED'] == 'true' || DEFAULT_IPV4_FALLBACK_ENABLED @ipv4_fallback_enabled = ENV["IPV4_FALLBACK_ENABLED"] == "true" || DEFAULT_IPV4_FALLBACK_ENABLED
operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS) operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS)
platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS) platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
system_config = load_file SYSTEM_WIDE_CONFIG_FILE system_config = load_file SYSTEM_WIDE_CONFIG_FILE
user_config = load_file config_file_name.dup.tap(&Gem::UNTAINT) user_config = load_file config_file_name.dup.tap(&Gem::UNTAINT)
environment_config = (ENV['GEMRC'] || '') environment_config = (ENV["GEMRC"] || "")
.split(File::PATH_SEPARATOR).inject({}) do |result, file| .split(File::PATH_SEPARATOR).inject({}) do |result, file|
result.merge load_file file result.merge load_file file
end end
@hash = operating_system_config.merge platform_config @hash = operating_system_config.merge platform_config
unless args.index '--norc' unless args.index "--norc"
@hash = @hash.merge system_config @hash = @hash.merge system_config
@hash = @hash.merge user_config @hash = @hash.merge user_config
@hash = @hash.merge environment_config @hash = @hash.merge environment_config
@ -269,7 +269,7 @@ if you believe they were disclosed to a third party.
# Location of RubyGems.org credentials # Location of RubyGems.org credentials
def credentials_path def credentials_path
credentials = File.join Gem.user_home, '.gem', 'credentials' credentials = File.join Gem.user_home, ".gem", "credentials"
if File.exist? credentials if File.exist? credentials
credentials credentials
else else
@ -320,13 +320,13 @@ if you believe they were disclosed to a third party.
config = load_file(credentials_path).merge(host => api_key) config = load_file(credentials_path).merge(host => api_key)
dirname = File.dirname credentials_path dirname = File.dirname credentials_path
require 'fileutils' require "fileutils"
FileUtils.mkdir_p(dirname) FileUtils.mkdir_p(dirname)
Gem.load_yaml Gem.load_yaml
permissions = 0600 & (~File.umask) permissions = 0600 & (~File.umask)
File.open(credentials_path, 'w', permissions) do |f| File.open(credentials_path, "w", permissions) do |f|
f.write config.to_yaml f.write config.to_yaml
end end
@ -389,7 +389,7 @@ if you believe they were disclosed to a third party.
yield :backtrace, @backtrace yield :backtrace, @backtrace
yield :bulk_threshold, @bulk_threshold yield :bulk_threshold, @bulk_threshold
yield 'config_file_name', @config_file_name if @config_file_name yield "config_file_name", @config_file_name if @config_file_name
hash.each(&block) hash.each(&block)
end end
@ -405,7 +405,7 @@ if you believe they were disclosed to a third party.
when /^--debug$/ then when /^--debug$/ then
$DEBUG = true $DEBUG = true
warn 'NOTE: Debugging mode prints all exceptions even when rescued' warn "NOTE: Debugging mode prints all exceptions even when rescued"
else else
@args << arg @args << arg
end end
@ -444,7 +444,7 @@ if you believe they were disclosed to a third party.
@hash[:ssl_client_cert] if @hash.key? :ssl_client_cert @hash[:ssl_client_cert] if @hash.key? :ssl_client_cert
keys = yaml_hash.keys.map {|key| key.to_s } keys = yaml_hash.keys.map {|key| key.to_s }
keys << 'debug' keys << "debug"
re = Regexp.union(*keys) re = Regexp.union(*keys)
@hash.each do |key, value| @hash.each do |key, value|
@ -458,10 +458,10 @@ if you believe they were disclosed to a third party.
# Writes out this config file, replacing its source. # Writes out this config file, replacing its source.
def write def write
require 'fileutils' require "fileutils"
FileUtils.mkdir_p File.dirname(config_file_name) FileUtils.mkdir_p File.dirname(config_file_name)
File.open config_file_name, 'w' do |io| File.open config_file_name, "w" do |io|
io.write to_yaml io.write to_yaml
end end
end end

View file

@ -39,7 +39,7 @@ module Kernel
# GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb # GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb
def gem(gem_name, *requirements) # :doc: def gem(gem_name, *requirements) # :doc:
skip_list = (ENV['GEM_SKIP'] || "").split(/:/) skip_list = (ENV["GEM_SKIP"] || "").split(/:/)
raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
if gem_name.kind_of? Gem::Dependency if gem_name.kind_of? Gem::Dependency

View file

@ -5,7 +5,7 @@
# See LICENSE.txt for permissions. # See LICENSE.txt for permissions.
#++ #++
require 'monitor' require "monitor"
module Kernel module Kernel

View file

@ -39,7 +39,7 @@ if RUBY_VERSION >= "2.5" && !Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES
start += 1 start += 1
if path = loc.path if path = loc.path
unless path.start_with?(rubygems_path) or path.start_with?('<internal:') unless path.start_with?(rubygems_path) or path.start_with?("<internal:")
# Non-rubygems frames # Non-rubygems frames
uplevel -= 1 uplevel -= 1
end end

View file

@ -1,4 +1,4 @@
require 'socket' require "socket"
module CoreExtensions module CoreExtensions
module TCPSocketExt module TCPSocketExt

View file

@ -20,10 +20,10 @@ module Gem
# specified in the environment # specified in the environment
def self.default_spec_cache_dir def self.default_spec_cache_dir
default_spec_cache_dir = File.join Gem.user_home, '.gem', 'specs' default_spec_cache_dir = File.join Gem.user_home, ".gem", "specs"
unless File.exist?(default_spec_cache_dir) unless File.exist?(default_spec_cache_dir)
default_spec_cache_dir = File.join Gem.data_home, 'gem', 'specs' default_spec_cache_dir = File.join Gem.data_home, "gem", "specs"
end end
default_spec_cache_dir default_spec_cache_dir
@ -34,7 +34,7 @@ module Gem
# specified in the environment # specified in the environment
def self.default_dir def self.default_dir
@default_dir ||= File.join(RbConfig::CONFIG['rubylibprefix'], 'gems', RbConfig::CONFIG['ruby_version']) @default_dir ||= File.join(RbConfig::CONFIG["rubylibprefix"], "gems", RbConfig::CONFIG["ruby_version"])
end end
## ##
@ -81,7 +81,7 @@ module Gem
Dir.home.dup Dir.home.dup
rescue rescue
if Gem.win_platform? if Gem.win_platform?
File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/') File.expand_path File.join(ENV["HOMEDRIVE"] || ENV["SystemDrive"], "/")
else else
File.expand_path "/" File.expand_path "/"
end end
@ -103,7 +103,7 @@ module Gem
gem_dir = File.join(Gem.user_home, ".gem") gem_dir = File.join(Gem.user_home, ".gem")
gem_dir = File.join(Gem.data_home, "gem") unless File.exist?(gem_dir) gem_dir = File.join(Gem.data_home, "gem") unless File.exist?(gem_dir)
parts = [gem_dir, ruby_engine] parts = [gem_dir, ruby_engine]
parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty? parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty?
File.join parts File.join parts
end end
@ -111,14 +111,14 @@ module Gem
# The path to standard location of the user's configuration directory. # The path to standard location of the user's configuration directory.
def self.config_home def self.config_home
@config_home ||= (ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, '.config')) @config_home ||= (ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, ".config"))
end end
## ##
# Finds the user's config file # Finds the user's config file
def self.find_config_file def self.find_config_file
gemrc = File.join Gem.user_home, '.gemrc' gemrc = File.join Gem.user_home, ".gemrc"
if File.exist? gemrc if File.exist? gemrc
gemrc gemrc
else else
@ -137,14 +137,14 @@ module Gem
# The path to standard location of the user's cache directory. # The path to standard location of the user's cache directory.
def self.cache_home def self.cache_home
@cache_home ||= (ENV["XDG_CACHE_HOME"] || File.join(Gem.user_home, '.cache')) @cache_home ||= (ENV["XDG_CACHE_HOME"] || File.join(Gem.user_home, ".cache"))
end end
## ##
# The path to standard location of the user's data directory. # The path to standard location of the user's data directory.
def self.data_home def self.data_home
@data_home ||= (ENV["XDG_DATA_HOME"] || File.join(Gem.user_home, '.local', 'share')) @data_home ||= (ENV["XDG_DATA_HOME"] || File.join(Gem.user_home, ".local", "share"))
end end
## ##
@ -169,7 +169,7 @@ module Gem
# Deduce Ruby's --program-prefix and --program-suffix from its install name # Deduce Ruby's --program-prefix and --program-suffix from its install name
def self.default_exec_format def self.default_exec_format
exec_format = RbConfig::CONFIG['ruby_install_name'].sub('ruby', '%s') rescue '%s' exec_format = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "%s") rescue "%s"
unless exec_format =~ /%s/ unless exec_format =~ /%s/
raise Gem::Exception, raise Gem::Exception,
@ -183,7 +183,7 @@ module Gem
# The default directory for binaries # The default directory for binaries
def self.default_bindir def self.default_bindir
RbConfig::CONFIG['bindir'] RbConfig::CONFIG["bindir"]
end end
def self.ruby_engine def self.ruby_engine
@ -227,14 +227,14 @@ module Gem
# Directory where vendor gems are installed. # Directory where vendor gems are installed.
def self.vendor_dir # :nodoc: def self.vendor_dir # :nodoc:
if vendor_dir = ENV['GEM_VENDOR'] if vendor_dir = ENV["GEM_VENDOR"]
return vendor_dir.dup return vendor_dir.dup
end end
return nil unless RbConfig::CONFIG.key? 'vendordir' return nil unless RbConfig::CONFIG.key? "vendordir"
File.join RbConfig::CONFIG['vendordir'], 'gems', File.join RbConfig::CONFIG["vendordir"], "gems",
RbConfig::CONFIG['ruby_version'] RbConfig::CONFIG["ruby_version"]
end end
## ##

View file

@ -97,14 +97,14 @@ class Gem::Dependency
end end
def pretty_print(q) # :nodoc: def pretty_print(q) # :nodoc:
q.group 1, 'Gem::Dependency.new(', ')' do q.group 1, "Gem::Dependency.new(", ")" do
q.pp name q.pp name
q.text ',' q.text ","
q.breakable q.breakable
q.pp requirement q.pp requirement
q.text ',' q.text ","
q.breakable q.breakable
q.pp type q.pp type
@ -197,7 +197,7 @@ class Gem::Dependency
reqs = other.requirement.requirements reqs = other.requirement.requirements
return false unless reqs.length == 1 return false unless reqs.length == 1
return false unless reqs.first.first == '=' return false unless reqs.first.first == "="
version = reqs.first.last version = reqs.first.last

View file

@ -1,12 +1,12 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../rubygems' require_relative "../rubygems"
require_relative 'dependency_list' require_relative "dependency_list"
require_relative 'package' require_relative "package"
require_relative 'installer' require_relative "installer"
require_relative 'spec_fetcher' require_relative "spec_fetcher"
require_relative 'user_interaction' require_relative "user_interaction"
require_relative 'available_set' require_relative "available_set"
require_relative 'deprecate' require_relative "deprecate"
## ##
# Installs a gem along with all its dependencies from local and remote gems. # Installs a gem along with all its dependencies from local and remote gems.

View file

@ -5,8 +5,8 @@
# See LICENSE.txt for permissions. # See LICENSE.txt for permissions.
#++ #++
require_relative 'tsort' require_relative "tsort"
require_relative 'deprecate' require_relative "deprecate"
## ##
# Gem::DependencyList is used for installing and uninstalling gems in the # Gem::DependencyList is used for installing and uninstalling gems in the

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative '../rubygems' require_relative "../rubygems"
require_relative 'user_interaction' require_relative "user_interaction"
## ##
# Cleans up after a partially-failed uninstall or for an invalid # Cleans up after a partially-failed uninstall or for an invalid
@ -19,13 +19,13 @@ class Gem::Doctor
# subdirectory. # subdirectory.
REPOSITORY_EXTENSION_MAP = [ # :nodoc: REPOSITORY_EXTENSION_MAP = [ # :nodoc:
['specifications', '.gemspec'], ["specifications", ".gemspec"],
['build_info', '.info'], ["build_info", ".info"],
['cache', '.gem'], ["cache", ".gem"],
['doc', ''], ["doc", ""],
['extensions', ''], ["extensions", ""],
['gems', ''], ["gems", ""],
['plugins', ''], ["plugins", ""],
].freeze ].freeze
missing = missing =
@ -74,8 +74,8 @@ class Gem::Doctor
Gem.use_paths @gem_repository.to_s Gem.use_paths @gem_repository.to_s
unless gem_repository? unless gem_repository?
say 'This directory does not appear to be a RubyGems repository, ' + say "This directory does not appear to be a RubyGems repository, " +
'skipping' "skipping"
say say
return return
end end
@ -111,16 +111,16 @@ class Gem::Doctor
basename = File.basename(child, extension) basename = File.basename(child, extension)
next if installed_specs.include? basename next if installed_specs.include? basename
next if /^rubygems-\d/ =~ basename next if /^rubygems-\d/ =~ basename
next if 'specifications' == sub_directory and 'default' == basename next if "specifications" == sub_directory and "default" == basename
next if 'plugins' == sub_directory and Gem.plugin_suffix_regexp =~ basename next if "plugins" == sub_directory and Gem.plugin_suffix_regexp =~ basename
type = File.directory?(child) ? 'directory' : 'file' type = File.directory?(child) ? "directory" : "file"
action = if @dry_run action = if @dry_run
'Extra' "Extra"
else else
FileUtils.rm_r(child) FileUtils.rm_r(child)
'Removed' "Removed"
end end
say "#{action} #{type} #{sub_directory}/#{File.basename(child)}" say "#{action} #{type} #{sub_directory}/#{File.basename(child)}"

View file

@ -136,8 +136,8 @@ module Gem
"Found %s (%s), but was for platform%s %s" % "Found %s (%s), but was for platform%s %s" %
[@name, [@name,
@version, @version,
@platforms.size == 1 ? '' : 's', @platforms.size == 1 ? "" : "s",
@platforms.join(' ,')] @platforms.join(" ,")]
end end
end end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative 'deprecate' require_relative "deprecate"
require_relative 'unknown_command_spell_checker' require_relative "unknown_command_spell_checker"
## ##
# Base exception class for RubyGems. All exception raised by RubyGems are a # Base exception class for RubyGems. All exception raised by RubyGems are a
@ -27,7 +27,7 @@ class Gem::UnknownCommandError < Gem::Exception
if DidYouMean.respond_to?(:correct_error) if DidYouMean.respond_to?(:correct_error)
DidYouMean.correct_error(Gem::UnknownCommandError, Gem::UnknownCommandSpellChecker) DidYouMean.correct_error(Gem::UnknownCommandError, Gem::UnknownCommandSpellChecker)
else else
DidYouMean::SPELL_CHECKERS['Gem::UnknownCommandError'] = DidYouMean::SPELL_CHECKERS["Gem::UnknownCommandError"] =
Gem::UnknownCommandSpellChecker Gem::UnknownCommandSpellChecker
prepend DidYouMean::Correctable prepend DidYouMean::Correctable
@ -154,7 +154,7 @@ class Gem::ImpossibleDependenciesError < Gem::Exception
def build_message # :nodoc: def build_message # :nodoc:
requester = @request.requester requester = @request.requester
requester = requester ? requester.spec.full_name : 'The user' requester = requester ? requester.spec.full_name : "The user"
dependency = @request.dependency dependency = @request.dependency
message = "#{requester} requires #{dependency} but it conflicted:\n".dup message = "#{requester} requires #{dependency} but it conflicted:\n".dup

View file

@ -10,10 +10,10 @@
module Gem::Ext; end module Gem::Ext; end
require_relative 'ext/build_error' require_relative "ext/build_error"
require_relative 'ext/builder' require_relative "ext/builder"
require_relative 'ext/configure_builder' require_relative "ext/configure_builder"
require_relative 'ext/ext_conf_builder' require_relative "ext/ext_conf_builder"
require_relative 'ext/rake_builder' require_relative "ext/rake_builder"
require_relative 'ext/cmake_builder' require_relative "ext/cmake_builder"
require_relative 'ext/cargo_builder' require_relative "ext/cargo_builder"

View file

@ -2,7 +2,7 @@
## ##
# Raised when there is an error while building extensions. # Raised when there is an error while building extensions.
require_relative '../exceptions' require_relative "../exceptions"
class Gem::Ext::BuildError < Gem::InstallError class Gem::Ext::BuildError < Gem::InstallError
end end

View file

@ -5,7 +5,7 @@
# See LICENSE.txt for permissions. # See LICENSE.txt for permissions.
#++ #++
require_relative '../user_interaction' require_relative "../user_interaction"
class Gem::Ext::Builder class Gem::Ext::Builder
include Gem::UserInteraction include Gem::UserInteraction
@ -18,29 +18,29 @@ class Gem::Ext::Builder
end end
def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil) def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil)
unless File.exist? File.join(make_dir, 'Makefile') unless File.exist? File.join(make_dir, "Makefile")
raise Gem::InstallError, 'Makefile not found' raise Gem::InstallError, "Makefile not found"
end end
# try to find make program from Ruby configure arguments first # try to find make program from Ruby configure arguments first
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/ RbConfig::CONFIG["configure_args"] =~ /with-make-prog\=(\w+)/
make_program_name = ENV['MAKE'] || ENV['make'] || $1 make_program_name = ENV["MAKE"] || ENV["make"] || $1
unless make_program_name unless make_program_name
make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make' make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? "nmake" : "make"
end end
make_program = Shellwords.split(make_program_name) make_program = Shellwords.split(make_program_name)
# The installation of the bundled gems is failed when DESTDIR is empty in mswin platform. # The installation of the bundled gems is failed when DESTDIR is empty in mswin platform.
destdir = (/\bnmake/i !~ make_program_name || ENV['DESTDIR'] && ENV['DESTDIR'] != "") ? 'DESTDIR=%s' % ENV['DESTDIR'] : '' destdir = (/\bnmake/i !~ make_program_name || ENV["DESTDIR"] && ENV["DESTDIR"] != "") ? "DESTDIR=%s" % ENV["DESTDIR"] : ""
env = [destdir] env = [destdir]
if sitedir if sitedir
env << 'sitearchdir=%s' % sitedir env << "sitearchdir=%s" % sitedir
env << 'sitelibdir=%s' % sitedir env << "sitelibdir=%s" % sitedir
end end
['clean', '', 'install'].each do |target| ["clean", "", "install"].each do |target|
# Pass DESTDIR via command line to override what's in MAKEFLAGS # Pass DESTDIR via command line to override what's in MAKEFLAGS
cmd = [ cmd = [
*make_program, *make_program,
@ -50,7 +50,7 @@ class Gem::Ext::Builder
begin begin
run(cmd, results, "make #{target}".rstrip, make_dir) run(cmd, results, "make #{target}".rstrip, make_dir)
rescue Gem::InstallError rescue Gem::InstallError
raise unless target == 'clean' # ignore clean failure raise unless target == "clean" # ignore clean failure
end end
end end
end end
@ -59,7 +59,7 @@ class Gem::Ext::Builder
verbose = Gem.configuration.really_verbose verbose = Gem.configuration.really_verbose
begin begin
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil rubygems_gemdeps, ENV["RUBYGEMS_GEMDEPS"] = ENV["RUBYGEMS_GEMDEPS"], nil
if verbose if verbose
puts("current directory: #{dir}") puts("current directory: #{dir}")
p(command) p(command)
@ -70,7 +70,7 @@ class Gem::Ext::Builder
require "open3" require "open3"
# Set $SOURCE_DATE_EPOCH for the subprocess. # Set $SOURCE_DATE_EPOCH for the subprocess.
build_env = { 'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string }.merge(env) build_env = { "SOURCE_DATE_EPOCH" => Gem.source_date_epoch_string }.merge(env)
output, status = begin output, status = begin
Open3.capture2e(build_env, *command, :chdir => dir) Open3.capture2e(build_env, *command, :chdir => dir)
rescue => error rescue => error
@ -82,7 +82,7 @@ class Gem::Ext::Builder
results << output results << output
end end
ensure ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps ENV["RUBYGEMS_GEMDEPS"] = rubygems_gemdeps
end end
unless status.success? unless status.success?
@ -212,11 +212,11 @@ EOF
# Writes +output+ to gem_make.out in the extension install directory. # Writes +output+ to gem_make.out in the extension install directory.
def write_gem_make_out(output) # :nodoc: def write_gem_make_out(output) # :nodoc:
destination = File.join @spec.extension_dir, 'gem_make.out' destination = File.join @spec.extension_dir, "gem_make.out"
FileUtils.mkdir_p @spec.extension_dir FileUtils.mkdir_p @spec.extension_dir
File.open destination, 'wb' do |io| File.open destination, "wb" do |io|
io.puts output io.puts output
end end

View file

@ -29,14 +29,14 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
def build_crate(dest_path, results, args, cargo_dir) def build_crate(dest_path, results, args, cargo_dir)
env = build_env env = build_env
cmd = cargo_command(cargo_dir, dest_path, args) cmd = cargo_command(cargo_dir, dest_path, args)
runner.call cmd, results, 'cargo', cargo_dir, env runner.call cmd, results, "cargo", cargo_dir, env
results results
end end
def build_env def build_env
build_env = rb_config_env build_env = rb_config_env
build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?('RUBY_STATIC') build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?("RUBY_STATIC")
build_env build_env
end end
@ -46,7 +46,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
cmd = [] cmd = []
cmd += [cargo, "rustc"] cmd += [cargo, "rustc"]
cmd += ["--target", ENV['CARGO_BUILD_TARGET']] if ENV['CARGO_BUILD_TARGET'] 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"] cmd += ["--lib"]
@ -144,13 +144,13 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
def cargo_dylib_path(dest_path) def cargo_dylib_path(dest_path)
prefix = so_ext == "dll" ? "" : "lib" prefix = so_ext == "dll" ? "" : "lib"
path_parts = [dest_path] path_parts = [dest_path]
path_parts << ENV['CARGO_BUILD_TARGET'] if ENV['CARGO_BUILD_TARGET'] path_parts << ENV["CARGO_BUILD_TARGET"] if ENV["CARGO_BUILD_TARGET"]
path_parts += [profile_target_directory, "#{prefix}#{cargo_crate_name}.#{so_ext}"] path_parts += [profile_target_directory, "#{prefix}#{cargo_crate_name}.#{so_ext}"]
File.join(*path_parts) File.join(*path_parts)
end 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
def rustc_dynamic_linker_flags(dest_dir) def rustc_dynamic_linker_flags(dest_dir)
@ -297,8 +297,8 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
def profile_target_directory def profile_target_directory
case profile case profile
when :release then 'release' when :release then "release"
when :dev then 'debug' when :dev then "debug"
else raise "unknown target directory for profile: #{profile}" else raise "unknown target directory for profile: #{profile}"
end end
end end

View file

@ -2,8 +2,8 @@
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd) def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd)
unless File.exist?(File.join(cmake_dir, 'Makefile')) unless File.exist?(File.join(cmake_dir, "Makefile"))
require_relative '../command' require_relative "../command"
cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args] cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args]
run cmd, results, class_name, cmake_dir run cmd, results, class_name, cmake_dir

View file

@ -7,7 +7,7 @@
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd) def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd)
unless File.exist?(File.join(configure_dir, 'Makefile')) unless File.exist?(File.join(configure_dir, "Makefile"))
cmd = ["sh", "./configure", "--prefix=#{dest_path}", *args] cmd = ["sh", "./configure", "--prefix=#{dest_path}", *args]
run cmd, results, class_name, configure_dir run cmd, results, class_name, configure_dir

Some files were not shown because too many files have changed in this diff Show more