mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 03:24:00 +02:00
Merge RubyGems-3.3.19 and Bundler-2.3.19
This commit is contained in:
parent
0918783347
commit
44c926f3a9
362 changed files with 7843 additions and 7605 deletions
|
@ -53,6 +53,7 @@ module Bundler
|
|||
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
|
||||
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __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 :Injector, File.expand_path("bundler/injector", __dir__)
|
||||
autoload :Installer, File.expand_path("bundler/installer", __dir__)
|
||||
|
|
|
@ -15,6 +15,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def self.output_fund_metadata_summary
|
||||
return if Bundler.settings["ignore_funding_requests"]
|
||||
definition = Bundler.definition
|
||||
current_dependencies = definition.requested_dependencies
|
||||
current_specs = definition.specs
|
||||
|
|
|
@ -138,13 +138,13 @@ module Bundler
|
|||
@unlock[:gems] ||= @dependencies.map(&:name)
|
||||
else
|
||||
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
|
||||
|
||||
@dependency_changes = converge_dependencies
|
||||
@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
|
||||
end
|
||||
|
@ -279,11 +279,8 @@ module Bundler
|
|||
end
|
||||
end
|
||||
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}")
|
||||
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)
|
||||
@reresolve = reresolve
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -468,7 +465,7 @@ module Bundler
|
|||
private :sources
|
||||
|
||||
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
|
||||
|
||||
def unlocking?
|
||||
|
@ -477,8 +474,14 @@ module Bundler
|
|||
|
||||
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)
|
||||
SpecSet.new(specs).for(expand_dependencies(deps, true), false, false)
|
||||
SpecSet.new(specs).for(expand_dependencies(deps, true), false, platforms)
|
||||
end
|
||||
|
||||
def materialize(dependencies)
|
||||
|
@ -495,7 +498,22 @@ module Bundler
|
|||
"removed in order to install."
|
||||
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
|
||||
|
||||
unless specs["bundler"].any?
|
||||
|
@ -545,7 +563,6 @@ module Bundler
|
|||
[@new_platform, "you added a new platform to your gemfile"],
|
||||
[@path_changes, "the gemspecs for path 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(", ")
|
||||
end
|
||||
|
||||
|
@ -721,7 +738,7 @@ module Bundler
|
|||
# if we won't need the source (according to the lockfile),
|
||||
# don't error if the path/git source isn't available
|
||||
next if specs.
|
||||
for(requested_dependencies, false, true).
|
||||
for(requested_dependencies, false).
|
||||
none? {|locked_spec| locked_spec.source == s.source }
|
||||
|
||||
raise
|
||||
|
@ -789,7 +806,9 @@ module Bundler
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
def lockfiles_equal?(current, proposed, preserve_unknown_sections)
|
||||
|
|
|
@ -465,12 +465,12 @@ module Bundler
|
|||
|
||||
def multiple_global_source_warning
|
||||
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 " \
|
||||
"should come from that source"
|
||||
raise GemfileEvalError, msg
|
||||
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 " \
|
||||
"may result in installing unexpected gems. To resolve this warning, use " \
|
||||
"a block to indicate which gems should come from the secondary source."
|
||||
|
|
|
@ -56,17 +56,17 @@ module Bundler
|
|||
|
||||
# Search this index's specs, and any source indexes that this index knows
|
||||
# about, returning all of the results.
|
||||
def search(query, base = nil)
|
||||
sort_specs(unsorted_search(query, base))
|
||||
def search(query)
|
||||
sort_specs(unsorted_search(query))
|
||||
end
|
||||
|
||||
def unsorted_search(query, base)
|
||||
results = local_search(query, base)
|
||||
def unsorted_search(query)
|
||||
results = local_search(query)
|
||||
|
||||
seen = results.map(&:full_name).uniq unless @sources.empty?
|
||||
|
||||
@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)
|
||||
|
||||
seen << spec.full_name
|
||||
|
@ -89,12 +89,12 @@ module Bundler
|
|||
self.class.sort_specs(specs)
|
||||
end
|
||||
|
||||
def local_search(query, base = nil)
|
||||
def local_search(query)
|
||||
case query
|
||||
when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query)
|
||||
when String then specs_by_name(query)
|
||||
when Gem::Dependency then search_by_dependency(query, base)
|
||||
when DepProxy then search_by_dependency(query.dep, base)
|
||||
when Gem::Dependency then search_by_dependency(query)
|
||||
when DepProxy then search_by_dependency(query.dep)
|
||||
else
|
||||
raise "You can't search for a #{query.inspect}."
|
||||
end
|
||||
|
@ -185,11 +185,9 @@ module Bundler
|
|||
@specs[name].values
|
||||
end
|
||||
|
||||
def search_by_dependency(dependency, base = nil)
|
||||
@cache[base || false] ||= {}
|
||||
@cache[base || false][dependency] ||= begin
|
||||
def search_by_dependency(dependency)
|
||||
@cache[dependency] ||= begin
|
||||
specs = specs_by_name(dependency.name)
|
||||
specs += base if base
|
||||
found = specs.select do |spec|
|
||||
next true if spec.source.is_a?(Source::Gemspec)
|
||||
dependency.matches_spec?(spec)
|
||||
|
|
|
@ -19,7 +19,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def full_name
|
||||
if platform == Gem::Platform::RUBY || platform.nil?
|
||||
if platform == Gem::Platform::RUBY
|
||||
"#{@name}-#{@version}"
|
||||
else
|
||||
"#{@name}-#{@version}-#{platform}"
|
||||
|
@ -61,7 +61,7 @@ module Bundler
|
|||
def to_lock
|
||||
out = String.new
|
||||
|
||||
if platform == Gem::Platform::RUBY || platform.nil?
|
||||
if platform == Gem::Platform::RUBY
|
||||
out << " #{name} (#{version})\n"
|
||||
else
|
||||
out << " #{name} (#{version}-#{platform})\n"
|
||||
|
@ -75,7 +75,17 @@ module Bundler
|
|||
out
|
||||
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
|
||||
source.gemspec.tap {|s| s.source = source }
|
||||
else
|
||||
|
@ -84,10 +94,9 @@ module Bundler
|
|||
else
|
||||
ruby_platform_materializes_to_ruby_platform? ? self : Dependency.new(name, version)
|
||||
end
|
||||
platform_object = ruby_platform_materializes_to_ruby_platform? ? Gem::Platform.new(platform) : Gem::Platform.local
|
||||
candidates = source.specs.search(search_object)
|
||||
same_platform_candidates = candidates.select do |spec|
|
||||
MatchPlatform.platforms_match?(spec.platform, platform_object)
|
||||
MatchPlatform.platforms_match?(spec.platform, platform)
|
||||
end
|
||||
installable_candidates = same_platform_candidates.select do |spec|
|
||||
spec.is_a?(StubSpecification) ||
|
||||
|
@ -105,7 +114,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def to_s
|
||||
@__to_s ||= if platform == Gem::Platform::RUBY || platform.nil?
|
||||
@__to_s ||= if platform == Gem::Platform::RUBY
|
||||
"#{name} (#{version})"
|
||||
else
|
||||
"#{name} (#{version}-#{platform})"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\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\.
|
||||
.
|
||||
.TP
|
||||
\fBonly\fR
|
||||
A space\-separated list of groups to install only gems of the specified groups\.
|
||||
.
|
||||
.TP
|
||||
\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\.
|
||||
.
|
||||
|
@ -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\.
|
||||
.
|
||||
.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\.
|
||||
.
|
||||
.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\.
|
||||
.
|
||||
.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\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
|
@ -342,13 +352,13 @@ bundle config set \-\-global mirror\.SOURCE_URL MIRROR_URL
|
|||
.IP "" 0
|
||||
.
|
||||
.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
|
||||
.
|
||||
.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
|
||||
.
|
||||
|
|
|
@ -74,6 +74,9 @@ The options that can be configured are:
|
|||
`production` use. Please check carefully if you want to have this option
|
||||
enabled in `development` or `test` environments.
|
||||
|
||||
* `only`:
|
||||
A space-separated list of groups to install only gems of the specified groups.
|
||||
|
||||
* `path`:
|
||||
The location to install the specified gems to. This defaults to Rubygems'
|
||||
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`):
|
||||
Whether Bundler should cache all gems globally, rather than locally to the
|
||||
installing Ruby installation.
|
||||
* `ignore_funding_requests` (`BUNDLE_IGNORE_FUNDING_REQUESTS`):
|
||||
When set, no funding requests will be printed.
|
||||
* `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`):
|
||||
When set, no post install messages will be printed. To silence a single gem,
|
||||
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.
|
||||
* `no_prune` (`BUNDLE_NO_PRUNE`):
|
||||
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`):
|
||||
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
|
||||
|
@ -321,9 +328,9 @@ mirror to fetch gems.
|
|||
|
||||
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
|
||||
respond within the fallback timeout, Bundler will try to use the original
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-doctor\fR \- Checks the bundle for common problems
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\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
|
||||
|
||||
ruby \-rrubygems \-e "puts Gem\.find_files(\'rubygems_plugin\.rb\')"
|
||||
ruby \-e "puts Gem\.find_files(\'rubygems_plugin\.rb\')"
|
||||
.
|
||||
.fi
|
||||
.
|
||||
|
|
|
@ -145,7 +145,7 @@ their plugins.
|
|||
You can find a list of all the gems containing gem plugins
|
||||
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
|
||||
version of each gem plugin, and also remove all gem plugins
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-info\fR \- Show information for the given gem in your bundle
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
|
||||
|
@ -30,4 +30,7 @@ bundle inject \'rack\' \'> 0\'
|
|||
.IP "" 0
|
||||
.
|
||||
.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\.
|
||||
|
|
|
@ -19,4 +19,6 @@ Example:
|
|||
bundle inject 'rack' '> 0'
|
||||
|
||||
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.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-list\fR \- List all the gems in the bundle
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-outdated\fR \- List installed gems with newer versions available
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-platform\fR \- Displays platform compatibility information
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-remove\fR \- Removes gems from the Gemfile
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-update\fR \- Update your gems to the latest available versions
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
|
||||
|
@ -15,6 +15,9 @@
|
|||
.P
|
||||
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"
|
||||
.
|
||||
.TP
|
||||
|
|
|
@ -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).
|
||||
|
||||
`viz` command was deprecated in Bundler 2.2. Use [bundler-graph plugin](https://github.com/rubygems/bundler-graph) instead.
|
||||
|
||||
## OPTIONS
|
||||
|
||||
* `--file`, `-f`:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE" "1" "June 2022" "" ""
|
||||
.TH "BUNDLE" "1" "July 2022" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\fR \- Ruby Dependency Management
|
||||
|
@ -93,7 +93,7 @@ Open an installed gem in the editor
|
|||
Generate a lockfile for your dependencies
|
||||
.
|
||||
.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
|
||||
.
|
||||
.TP
|
||||
|
@ -130,7 +130,7 @@ These commands are obsolete and should no longer be used:
|
|||
\fBbundle cache(1)\fR
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBbundle show(1)\fR
|
||||
\fBbundle inject(1)\fR
|
||||
.
|
||||
.IP "" 0
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ We divide `bundle` subcommands into primary commands and utilities:
|
|||
* [`bundle lock(1)`](bundle-lock.1.html):
|
||||
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
|
||||
|
||||
* [`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:
|
||||
|
||||
* `bundle cache(1)`
|
||||
* `bundle show(1)`
|
||||
* `bundle inject(1)`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "GEMFILE" "5" "June 2022" "" ""
|
||||
.TH "GEMFILE" "5" "July 2022" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\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"
|
||||
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"
|
||||
At the top of the \fBGemfile\fR, add a line for the \fBRubygems\fR source that contains the gems listed in the \fBGemfile\fR\.
|
||||
.SH "GLOBAL SOURCE"
|
||||
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
|
||||
.
|
||||
|
@ -29,10 +29,16 @@ source "https://rubygems\.org"
|
|||
.IP "" 0
|
||||
.
|
||||
.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
|
||||
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"
|
||||
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
|
||||
.
|
||||
.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
|
||||
.
|
||||
|
@ -369,13 +375,13 @@ gem "some_internal_gem", source: "https://gems\.example\.com"
|
|||
.IP "" 0
|
||||
.
|
||||
.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
|
||||
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
|
||||
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
|
||||
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
|
||||
.
|
||||
.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
|
||||
|
||||
|
|
|
@ -15,23 +15,28 @@ directory as the `Rakefile`.
|
|||
A `Gemfile` is evaluated as Ruby code, in a context which makes available
|
||||
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
|
||||
the gems listed in the `Gemfile`.
|
||||
At the top of the `Gemfile`, add a single line for the `RubyGems` source that
|
||||
contains the gems listed in the `Gemfile`.
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
It is possible, but not recommended as of Bundler 1.7, to add multiple global
|
||||
`source` lines. Each of these `source`s `MUST` be a valid Rubygems repository.
|
||||
You can add only one global source. In Bundler 1.13, adding multiple global
|
||||
sources was deprecated. The `source` `MUST` be a valid RubyGems repository.
|
||||
|
||||
Sources are checked for gems following the heuristics described in
|
||||
[SOURCE PRIORITY][]. If a gem is found in more than one global source, Bundler
|
||||
To use more than one source of RubyGems, you should use [`source` block
|
||||
](#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,
|
||||
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 [`:source` option](#SOURCE) or a
|
||||
[`source` block](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS).
|
||||
this warning, by using the [`:source` option](#SOURCE) or `source` block.
|
||||
|
||||
### CREDENTIALS
|
||||
|
||||
|
@ -247,22 +252,22 @@ This can be handy (assuming the pure ruby variant works fine) when:
|
|||
|
||||
### 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.
|
||||
|
||||
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,
|
||||
it will not be installed.
|
||||
|
||||
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 [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
|
||||
gem warning described above in
|
||||
[GLOBAL SOURCES (#source)](#GLOBAL-SOURCES).
|
||||
gem warning described above in [GLOBAL SOURCE](#GLOBAL-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
|
||||
|
@ -535,5 +540,7 @@ bundler uses the following priority order:
|
|||
repository declared on the parent. This results in bundler prioritizing the
|
||||
ActiveSupport gem from the Rails git repository over ones from
|
||||
`rubygems.org`
|
||||
3. The sources specified via global `source` lines, searching each source in
|
||||
your `Gemfile` from last added to first added.
|
||||
3. 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.
|
||||
|
|
|
@ -16,7 +16,8 @@ module Bundler
|
|||
def initialize(name, version, platform, spec_fetcher)
|
||||
@name = name
|
||||
@version = Gem::Version.create version
|
||||
@platform = platform
|
||||
@original_platform = platform || Gem::Platform::RUBY
|
||||
@platform = Gem::Platform.new(platform)
|
||||
@spec_fetcher = spec_fetcher
|
||||
@dependencies = nil
|
||||
end
|
||||
|
@ -35,10 +36,10 @@ module Bundler
|
|||
end
|
||||
|
||||
def full_name
|
||||
if platform == Gem::Platform::RUBY || platform.nil?
|
||||
if @original_platform == Gem::Platform::RUBY
|
||||
"#{@name}-#{@version}"
|
||||
else
|
||||
"#{@name}-#{@version}-#{platform}"
|
||||
"#{@name}-#{@version}-#{@original_platform}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -105,7 +106,7 @@ module Bundler
|
|||
end
|
||||
|
||||
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" \
|
||||
" missing from the server! Try installing with `--full-index` as a workaround.")
|
||||
end
|
||||
|
|
|
@ -22,17 +22,16 @@ module Bundler
|
|||
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)
|
||||
result = resolver.start(requirements)
|
||||
SpecSet.new(SpecSet.new(result).for(regular_requirements))
|
||||
SpecSet.new(SpecSet.new(result).for(regular_requirements, false, platforms))
|
||||
end
|
||||
|
||||
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
|
||||
@source_requirements = source_requirements
|
||||
@metadata_requirements = metadata_requirements
|
||||
@base = base
|
||||
@resolver = Molinillo::Resolver.new(self, self)
|
||||
@search_for = {}
|
||||
@base_dg = Molinillo::DependencyGraph.new
|
||||
@base.each do |ls|
|
||||
@base = base.materialized_for_resolution do |ls|
|
||||
dep = Dependency.new(ls.name, ls.version)
|
||||
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
|
||||
end
|
||||
|
@ -111,7 +110,7 @@ module Bundler
|
|||
dependency = dependency_proxy.dep
|
||||
name = dependency.name
|
||||
@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)
|
||||
locked_requirement = vertex.payload.requirement
|
||||
|
@ -176,8 +175,8 @@ module Bundler
|
|||
@source_requirements[name] || @source_requirements[:default]
|
||||
end
|
||||
|
||||
def results_for(dependency, base)
|
||||
index_for(dependency).search(dependency, base)
|
||||
def results_for(dependency)
|
||||
index_for(dependency).search(dependency)
|
||||
end
|
||||
|
||||
def name_for(dependency)
|
||||
|
|
|
@ -25,7 +25,7 @@ module Bundler
|
|||
|
||||
extract_files
|
||||
|
||||
build_extensions
|
||||
build_extensions if spec.extensions.any?
|
||||
write_build_info_file
|
||||
run_post_build_hooks
|
||||
|
||||
|
@ -66,29 +66,29 @@ module Bundler
|
|||
|
||||
def build_extensions
|
||||
extension_cache_path = options[:bundler_extension_cache_path]
|
||||
unless extension_cache_path && extension_dir = spec.extension_dir
|
||||
require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25")
|
||||
extension_dir = spec.extension_dir
|
||||
unless extension_cache_path && extension_dir
|
||||
prepare_extension_build(extension_dir)
|
||||
return super
|
||||
end
|
||||
|
||||
extension_dir = Pathname.new(extension_dir)
|
||||
build_complete = SharedHelpers.filesystem_access(extension_cache_path.join("gem.build_complete"), :read, &:file?)
|
||||
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
|
||||
FileUtils.cp_r extension_cache_path, spec.extension_dir
|
||||
FileUtils.cp_r extension_cache_path, extension_dir
|
||||
end
|
||||
else
|
||||
require "shellwords" # compensate missing require in rubygems before version 3.2.25
|
||||
prepare_extension_build(extension_dir)
|
||||
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) do
|
||||
FileUtils.cp_r extension_dir, extension_cache_path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def spec
|
||||
if Bundler.rubygems.provides?("< 3.3.12") # RubyGems implementation rescues and re-raises errors before 3.3.12 and we don't want that
|
||||
|
@ -100,6 +100,13 @@ module Bundler
|
|||
|
||||
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)
|
||||
Bundler.rm_rf dir
|
||||
rescue Errno::ENOTEMPTY => e
|
||||
|
|
|
@ -57,6 +57,7 @@ module Bundler
|
|||
].freeze
|
||||
|
||||
ARRAY_KEYS = %w[
|
||||
only
|
||||
with
|
||||
without
|
||||
].freeze
|
||||
|
|
|
@ -11,30 +11,27 @@ module Bundler
|
|||
@specs = specs
|
||||
end
|
||||
|
||||
def for(dependencies, check = false, match_current_platform = false)
|
||||
# dep.name => [list, of, deps]
|
||||
handled = Hash.new {|h, k| h[k] = [] }
|
||||
deps = dependencies.dup
|
||||
def for(dependencies, check = false, platforms = [nil])
|
||||
handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h
|
||||
deps = dependencies.product(platforms).map {|dep, platform| [dep.name, platform && dep.force_ruby_platform ? Gem::Platform::RUBY : platform] }
|
||||
specs = []
|
||||
|
||||
loop do
|
||||
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.name] << dep
|
||||
handled[dep] = true
|
||||
|
||||
specs_for_dep = specs_for_dependency(dep, match_current_platform)
|
||||
specs_for_dep = specs_for_dependency(*dep)
|
||||
if specs_for_dep.any?
|
||||
specs.concat(specs_for_dep)
|
||||
|
||||
specs_for_dep.first.dependencies.each do |d|
|
||||
next if d.type == :development
|
||||
d = DepProxy.get_proxy(Dependency.new(d.name, d.requirement), dep.__platform) unless match_current_platform
|
||||
deps << d
|
||||
deps << [d.name, dep[1]]
|
||||
end
|
||||
elsif check
|
||||
return false
|
||||
specs << IncompleteSpecification.new(*dep)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -42,9 +39,7 @@ module Bundler
|
|||
specs << spec
|
||||
end
|
||||
|
||||
specs.uniq! unless match_current_platform
|
||||
|
||||
check ? true : specs
|
||||
specs
|
||||
end
|
||||
|
||||
def [](key)
|
||||
|
@ -71,12 +66,12 @@ module Bundler
|
|||
end
|
||||
|
||||
def materialize(deps)
|
||||
materialized = self.for(deps, false, true)
|
||||
materialized = self.for(deps, true).uniq
|
||||
|
||||
materialized.map! do |s|
|
||||
next s unless s.is_a?(LazySpecification)
|
||||
s.source.local!
|
||||
s.__materialize__ || s
|
||||
s.materialize_for_installation || s
|
||||
end
|
||||
SpecSet.new(materialized)
|
||||
end
|
||||
|
@ -89,16 +84,29 @@ module Bundler
|
|||
next s unless s.is_a?(LazySpecification)
|
||||
s.source.local!
|
||||
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
|
||||
spec
|
||||
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
|
||||
@specs.select {|s| s.is_a?(LazySpecification) }
|
||||
end
|
||||
|
||||
def incomplete_specs
|
||||
@specs.select {|s| s.is_a?(IncompleteSpecification) }
|
||||
end
|
||||
|
||||
def merge(set)
|
||||
arr = sorted.dup
|
||||
set.each do |set_spec|
|
||||
|
@ -173,12 +181,12 @@ module Bundler
|
|||
@specs.sort_by(&:name).each {|s| yield s }
|
||||
end
|
||||
|
||||
def specs_for_dependency(dep, match_current_platform)
|
||||
specs_for_name = lookup[dep.name]
|
||||
if match_current_platform
|
||||
def specs_for_dependency(name, platform)
|
||||
specs_for_name = lookup[name]
|
||||
if platform.nil?
|
||||
GemHelpers.select_best_platform_match(specs_for_name.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: false
|
||||
|
||||
module Bundler
|
||||
VERSION = "2.3.18".freeze
|
||||
VERSION = "2.3.19".freeze
|
||||
|
||||
def self.bundler_major_version
|
||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||
|
|
117
lib/rubygems.rb
117
lib/rubygems.rb
|
@ -5,18 +5,18 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require 'rbconfig'
|
||||
require "rbconfig"
|
||||
|
||||
module Gem
|
||||
VERSION = "3.3.18".freeze
|
||||
VERSION = "3.3.19".freeze
|
||||
end
|
||||
|
||||
# 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/deprecate'
|
||||
require_relative 'rubygems/errors'
|
||||
require_relative "rubygems/defaults"
|
||||
require_relative "rubygems/deprecate"
|
||||
require_relative "rubygems/errors"
|
||||
|
||||
##
|
||||
# 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.
|
||||
# This allows switching ".untaint" to ".tap(&Gem::UNTAINT)",
|
||||
# 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
|
||||
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.
|
||||
|
@ -293,14 +293,14 @@ module Gem
|
|||
# The mode needed to read a file as straight binary.
|
||||
|
||||
def self.binary_mode
|
||||
'rb'
|
||||
"rb"
|
||||
end
|
||||
|
||||
##
|
||||
# The path where gem executables are to be installed.
|
||||
|
||||
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
|
||||
Gem.default_bindir
|
||||
end
|
||||
|
@ -309,7 +309,7 @@ module Gem
|
|||
# The path were rubygems plugins are to be installed.
|
||||
|
||||
def self.plugindir(install_dir=Gem.dir)
|
||||
File.join install_dir, 'plugins'
|
||||
File.join install_dir, "plugins"
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -353,7 +353,7 @@ module Gem
|
|||
# A Zlib::Deflate.deflate wrapper
|
||||
|
||||
def self.deflate(data)
|
||||
require 'zlib'
|
||||
require "zlib"
|
||||
Zlib::Deflate.deflate data
|
||||
end
|
||||
|
||||
|
@ -375,7 +375,7 @@ module Gem
|
|||
target = {}
|
||||
env.each_pair do |k,v|
|
||||
case k
|
||||
when 'GEM_HOME', 'GEM_PATH', 'GEM_SPEC_CACHE'
|
||||
when "GEM_HOME", "GEM_PATH", "GEM_SPEC_CACHE"
|
||||
case v
|
||||
when nil, String
|
||||
target[k] = v
|
||||
|
@ -442,8 +442,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
old_umask = File.umask
|
||||
File.umask old_umask | 002
|
||||
|
||||
require 'fileutils'
|
||||
|
||||
options = {}
|
||||
|
||||
options[:mode] = mode if mode
|
||||
|
@ -451,6 +449,9 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
subdirs.each do |name|
|
||||
subdir = File.join dir, name
|
||||
next if File.exist? subdir
|
||||
|
||||
require "fileutils"
|
||||
|
||||
begin
|
||||
FileUtils.mkdir_p subdir, **options
|
||||
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.
|
||||
|
||||
def self.extension_api_version # :nodoc:
|
||||
if 'no' == RbConfig::CONFIG['ENABLE_SHARED']
|
||||
if "no" == RbConfig::CONFIG["ENABLE_SHARED"]
|
||||
"#{ruby_api_version}-static"
|
||||
else
|
||||
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)
|
||||
end
|
||||
|
||||
index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir']
|
||||
index = $LOAD_PATH.index RbConfig::CONFIG["sitelibdir"]
|
||||
|
||||
index || 0
|
||||
end
|
||||
|
@ -606,10 +607,10 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
def self.load_yaml
|
||||
return if @yaml_loaded
|
||||
|
||||
require 'psych'
|
||||
require_relative 'rubygems/psych_tree'
|
||||
require "psych"
|
||||
require_relative "rubygems/psych_tree"
|
||||
|
||||
require_relative 'rubygems/safe_yaml'
|
||||
require_relative "rubygems/safe_yaml"
|
||||
|
||||
@yaml_loaded = true
|
||||
end
|
||||
|
@ -740,9 +741,9 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
def self.prefix
|
||||
prefix = File.dirname RUBYGEMS_DIR
|
||||
|
||||
if prefix != File.expand_path(RbConfig::CONFIG['sitelibdir']) and
|
||||
prefix != File.expand_path(RbConfig::CONFIG['libdir']) and
|
||||
'lib' == File.basename(RUBYGEMS_DIR)
|
||||
if prefix != File.expand_path(RbConfig::CONFIG["sitelibdir"]) and
|
||||
prefix != File.expand_path(RbConfig::CONFIG["libdir"]) and
|
||||
"lib" == File.basename(RUBYGEMS_DIR)
|
||||
prefix
|
||||
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.
|
||||
|
||||
def self.read_binary(path)
|
||||
open_file(path, 'rb+') do |io|
|
||||
open_file(path, "rb+") do |io|
|
||||
io.read
|
||||
end
|
||||
rescue Errno::EACCES, Errno::EROFS
|
||||
open_file(path, 'rb') do |io|
|
||||
open_file(path, "rb") do |io|
|
||||
io.read
|
||||
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.
|
||||
def self.write_binary(path, data)
|
||||
open_file(path, 'wb') do |io|
|
||||
open_file(path, "wb") do |io|
|
||||
io.write data
|
||||
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
|
||||
|
||||
def self.ruby_api_version
|
||||
@ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup
|
||||
@ruby_api_version ||= RbConfig::CONFIG["ruby_version"].dup
|
||||
end
|
||||
|
||||
def self.env_requirement(gem_name)
|
||||
@env_requirements_by_name ||= {}
|
||||
@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)
|
||||
end
|
||||
end
|
||||
|
@ -844,7 +845,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
# Returns the latest release version of RubyGems.
|
||||
|
||||
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`."
|
||||
end
|
||||
|
||||
|
@ -939,8 +940,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
# Suffixes for require-able paths.
|
||||
|
||||
def self.suffixes
|
||||
@suffixes ||= ['',
|
||||
'.rb',
|
||||
@suffixes ||= ["",
|
||||
".rb",
|
||||
*%w[DLEXT DLEXT2].map do |key|
|
||||
val = RbConfig::CONFIG[key]
|
||||
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.
|
||||
|
||||
def self.ui
|
||||
require_relative 'rubygems/user_interaction'
|
||||
require_relative "rubygems/user_interaction"
|
||||
|
||||
Gem::DefaultUserInteraction.ui
|
||||
end
|
||||
|
@ -991,7 +992,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
|
||||
def self.win_platform?
|
||||
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 }
|
||||
end
|
||||
|
||||
|
@ -1017,7 +1018,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
|
||||
def self.load_plugin_files(plugins) # :nodoc:
|
||||
plugins.each do |plugin|
|
||||
|
||||
# Skip older versions of the GemCutter plugin: Its commands are in
|
||||
# RubyGems proper now.
|
||||
|
||||
|
@ -1071,7 +1071,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
def self.use_gemdeps(path = nil)
|
||||
raise_exception = path
|
||||
|
||||
path ||= ENV['RUBYGEMS_GEMDEPS']
|
||||
path ||= ENV["RUBYGEMS_GEMDEPS"]
|
||||
return unless path
|
||||
|
||||
path = path.dup
|
||||
|
@ -1096,7 +1096,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
end
|
||||
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path)
|
||||
require_relative 'rubygems/user_interaction'
|
||||
require_relative "rubygems/user_interaction"
|
||||
require "bundler"
|
||||
begin
|
||||
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
|
||||
|
||||
autoload :BundlerVersionFinder, File.expand_path('rubygems/bundler_version_finder', __dir__)
|
||||
autoload :ConfigFile, File.expand_path('rubygems/config_file', __dir__)
|
||||
autoload :Dependency, File.expand_path('rubygems/dependency', __dir__)
|
||||
autoload :DependencyList, File.expand_path('rubygems/dependency_list', __dir__)
|
||||
autoload :Installer, File.expand_path('rubygems/installer', __dir__)
|
||||
autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__)
|
||||
autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__)
|
||||
autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__)
|
||||
autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__)
|
||||
autoload :Resolver, File.expand_path('rubygems/resolver', __dir__)
|
||||
autoload :Source, File.expand_path('rubygems/source', __dir__)
|
||||
autoload :SourceList, File.expand_path('rubygems/source_list', __dir__)
|
||||
autoload :SpecFetcher, File.expand_path('rubygems/spec_fetcher', __dir__)
|
||||
autoload :SpecificationPolicy, File.expand_path('rubygems/specification_policy', __dir__)
|
||||
autoload :Util, File.expand_path('rubygems/util', __dir__)
|
||||
autoload :Version, File.expand_path('rubygems/version', __dir__)
|
||||
autoload :BundlerVersionFinder, File.expand_path("rubygems/bundler_version_finder", __dir__)
|
||||
autoload :ConfigFile, File.expand_path("rubygems/config_file", __dir__)
|
||||
autoload :Dependency, File.expand_path("rubygems/dependency", __dir__)
|
||||
autoload :DependencyList, File.expand_path("rubygems/dependency_list", __dir__)
|
||||
autoload :Installer, File.expand_path("rubygems/installer", __dir__)
|
||||
autoload :Licenses, File.expand_path("rubygems/util/licenses", __dir__)
|
||||
autoload :NameTuple, File.expand_path("rubygems/name_tuple", __dir__)
|
||||
autoload :PathSupport, File.expand_path("rubygems/path_support", __dir__)
|
||||
autoload :RequestSet, File.expand_path("rubygems/request_set", __dir__)
|
||||
autoload :Requirement, File.expand_path("rubygems/requirement", __dir__)
|
||||
autoload :Resolver, File.expand_path("rubygems/resolver", __dir__)
|
||||
autoload :Source, File.expand_path("rubygems/source", __dir__)
|
||||
autoload :SourceList, File.expand_path("rubygems/source_list", __dir__)
|
||||
autoload :SpecFetcher, File.expand_path("rubygems/spec_fetcher", __dir__)
|
||||
autoload :SpecificationPolicy, File.expand_path("rubygems/specification_policy", __dir__)
|
||||
autoload :Util, File.expand_path("rubygems/util", __dir__)
|
||||
autoload :Version, File.expand_path("rubygems/version", __dir__)
|
||||
end
|
||||
|
||||
require_relative 'rubygems/exceptions'
|
||||
require_relative 'rubygems/specification'
|
||||
require_relative "rubygems/exceptions"
|
||||
require_relative "rubygems/specification"
|
||||
|
||||
# REFACTOR: This should be pulled out into some kind of hacks file.
|
||||
begin
|
||||
##
|
||||
# Defaults the operating system (or packager) wants to provide for RubyGems.
|
||||
|
||||
require 'rubygems/defaults/operating_system'
|
||||
require "rubygems/defaults/operating_system"
|
||||
rescue LoadError
|
||||
# Ignored
|
||||
rescue StandardError => e
|
||||
|
@ -1344,6 +1345,6 @@ end
|
|||
# Loads the default specs.
|
||||
Gem::Specification.load_defaults
|
||||
|
||||
require_relative 'rubygems/core_ext/kernel_gem'
|
||||
require_relative 'rubygems/core_ext/kernel_require'
|
||||
require_relative 'rubygems/core_ext/kernel_warn'
|
||||
require_relative "rubygems/core_ext/kernel_gem"
|
||||
require_relative "rubygems/core_ext/kernel_require"
|
||||
require_relative "rubygems/core_ext/kernel_warn"
|
||||
|
|
|
@ -47,7 +47,7 @@ class Gem::BasicSpecification
|
|||
# directory.
|
||||
|
||||
def gem_build_complete_path # :nodoc:
|
||||
File.join extension_dir, 'gem.build_complete'
|
||||
File.join extension_dir, "gem.build_complete"
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -103,7 +103,7 @@ class Gem::BasicSpecification
|
|||
|
||||
def extensions_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)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require_relative 'optparse'
|
||||
require_relative 'requirement'
|
||||
require_relative 'user_interaction'
|
||||
require_relative "optparse"
|
||||
require_relative "requirement"
|
||||
require_relative "user_interaction"
|
||||
|
||||
##
|
||||
# Base class for all Gem commands. When creating a new gem command, define
|
||||
|
@ -76,7 +76,7 @@ class Gem::Command
|
|||
when Array
|
||||
@extra_args = value
|
||||
when String
|
||||
@extra_args = value.split(' ')
|
||||
@extra_args = value.split(" ")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -556,7 +556,7 @@ class Gem::Command
|
|||
def configure_options(header, option_list)
|
||||
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:"
|
||||
|
||||
option_list.each do |args, handler|
|
||||
|
@ -565,7 +565,7 @@ class Gem::Command
|
|||
end
|
||||
end
|
||||
|
||||
@parser.separator ''
|
||||
@parser.separator ""
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -578,13 +578,13 @@ class Gem::Command
|
|||
# ----------------------------------------------------------------
|
||||
# Add the options common to all commands.
|
||||
|
||||
add_common_option('-h', '--help',
|
||||
'Get help on this command') do |value, options|
|
||||
add_common_option("-h", "--help",
|
||||
"Get help on this command") do |value, options|
|
||||
options[:help] = true
|
||||
end
|
||||
|
||||
add_common_option('-V', '--[no-]verbose',
|
||||
'Set the verbose level of output') do |value, options|
|
||||
add_common_option("-V", "--[no-]verbose",
|
||||
"Set the verbose level of output") do |value, options|
|
||||
# Set us to "really verbose" so the progress meter works
|
||||
if Gem.configuration.verbose and value
|
||||
Gem.configuration.verbose = 1
|
||||
|
@ -593,7 +593,7 @@ class Gem::Command
|
|||
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
|
||||
end
|
||||
|
||||
|
@ -606,20 +606,20 @@ class Gem::Command
|
|||
# commands. Both options are actually handled before the other
|
||||
# options get parsed.
|
||||
|
||||
add_common_option('--config-file FILE',
|
||||
'Use this config file instead of default') do
|
||||
add_common_option("--config-file FILE",
|
||||
"Use this config file instead of default") do
|
||||
end
|
||||
|
||||
add_common_option('--backtrace',
|
||||
'Show stack backtrace on errors') do
|
||||
add_common_option("--backtrace",
|
||||
"Show stack backtrace on errors") do
|
||||
end
|
||||
|
||||
add_common_option('--debug',
|
||||
'Turn on Ruby debugging') do
|
||||
add_common_option("--debug",
|
||||
"Turn on Ruby debugging") do
|
||||
end
|
||||
|
||||
add_common_option('--norc',
|
||||
'Avoid loading any .gemrc file') do
|
||||
add_common_option("--norc",
|
||||
"Avoid loading any .gemrc file") do
|
||||
end
|
||||
|
||||
# :stopdoc:
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require_relative 'command'
|
||||
require_relative 'user_interaction'
|
||||
require_relative 'text'
|
||||
require_relative "command"
|
||||
require_relative "user_interaction"
|
||||
require_relative "text"
|
||||
|
||||
##
|
||||
# The command manager registers and installs all the individual sub-commands
|
||||
|
@ -73,9 +73,9 @@ class Gem::CommandManager
|
|||
].freeze
|
||||
|
||||
ALIAS_COMMANDS = {
|
||||
'i' => 'install',
|
||||
'login' => 'signin',
|
||||
'logout' => 'signout',
|
||||
"i" => "install",
|
||||
"login" => "signin",
|
||||
"logout" => "signout",
|
||||
}.freeze
|
||||
|
||||
##
|
||||
|
@ -104,7 +104,7 @@ class Gem::CommandManager
|
|||
# Register all the subcommands supported by the gem command.
|
||||
|
||||
def initialize
|
||||
require 'timeout'
|
||||
require "timeout"
|
||||
@commands = {}
|
||||
|
||||
BUILTIN_COMMANDS.each do |name|
|
||||
|
@ -169,10 +169,10 @@ class Gem::CommandManager
|
|||
end
|
||||
|
||||
case args.first
|
||||
when '-h', '--help' then
|
||||
when "-h", "--help" then
|
||||
say Gem::Command::HELP
|
||||
terminate_interaction 0
|
||||
when '-v', '--version' then
|
||||
when "-v", "--version" then
|
||||
say Gem::VERSION
|
||||
terminate_interaction 0
|
||||
when /^-/ then
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../package'
|
||||
require_relative '../version_option'
|
||||
require_relative "../command"
|
||||
require_relative "../package"
|
||||
require_relative "../version_option"
|
||||
|
||||
class Gem::Commands::BuildCommand < Gem::Command
|
||||
include Gem::VersionOption
|
||||
|
||||
def initialize
|
||||
super 'build', 'Build a gem from a gemspec'
|
||||
super "build", "Build a gem from a gemspec"
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,69 +1,69 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../security'
|
||||
require_relative "../command"
|
||||
require_relative "../security"
|
||||
|
||||
class Gem::Commands::CertCommand < Gem::Command
|
||||
def initialize
|
||||
super 'cert', 'Manage RubyGems certificates and signing settings',
|
||||
super "cert", "Manage RubyGems certificates and signing settings",
|
||||
:add => [], :remove => [], :list => [], :build => [], :sign => []
|
||||
|
||||
add_option('-a', '--add CERT',
|
||||
'Add a trusted certificate.') do |cert_file, options|
|
||||
add_option("-a", "--add CERT",
|
||||
"Add a trusted certificate.") do |cert_file, options|
|
||||
options[:add] << open_cert(cert_file)
|
||||
end
|
||||
|
||||
add_option('-l', '--list [FILTER]',
|
||||
'List trusted certificates where the',
|
||||
'subject contains FILTER') do |filter, options|
|
||||
filter ||= ''
|
||||
add_option("-l", "--list [FILTER]",
|
||||
"List trusted certificates where the",
|
||||
"subject contains FILTER") do |filter, options|
|
||||
filter ||= ""
|
||||
|
||||
options[:list] << filter
|
||||
end
|
||||
|
||||
add_option('-r', '--remove FILTER',
|
||||
'Remove trusted certificates where the',
|
||||
'subject contains FILTER') do |filter, options|
|
||||
add_option("-r", "--remove FILTER",
|
||||
"Remove trusted certificates where the",
|
||||
"subject contains FILTER") do |filter, options|
|
||||
options[:remove] << filter
|
||||
end
|
||||
|
||||
add_option('-b', '--build EMAIL_ADDR',
|
||||
'Build private key and self-signed',
|
||||
'certificate for EMAIL_ADDR') do |email_address, options|
|
||||
add_option("-b", "--build EMAIL_ADDR",
|
||||
"Build private key and self-signed",
|
||||
"certificate for EMAIL_ADDR") do |email_address, options|
|
||||
options[:build] << email_address
|
||||
end
|
||||
|
||||
add_option('-C', '--certificate CERT',
|
||||
'Signing certificate for --sign') do |cert_file, options|
|
||||
add_option("-C", "--certificate CERT",
|
||||
"Signing certificate for --sign") do |cert_file, options|
|
||||
options[:issuer_cert] = open_cert(cert_file)
|
||||
options[:issuer_cert_file] = cert_file
|
||||
end
|
||||
|
||||
add_option('-K', '--private-key KEY',
|
||||
'Key for --sign or --build') do |key_file, options|
|
||||
add_option("-K", "--private-key KEY",
|
||||
"Key for --sign or --build") do |key_file, options|
|
||||
options[:key] = open_private_key(key_file)
|
||||
end
|
||||
|
||||
add_option('-A', '--key-algorithm ALGORITHM',
|
||||
'Select which key algorithm to use for --build') do |algorithm, options|
|
||||
add_option("-A", "--key-algorithm ALGORITHM",
|
||||
"Select which key algorithm to use for --build") do |algorithm, options|
|
||||
options[:key_algorithm] = algorithm
|
||||
end
|
||||
|
||||
add_option('-s', '--sign CERT',
|
||||
'Signs CERT with the key from -K',
|
||||
'and the certificate from -C') do |cert_file, options|
|
||||
add_option("-s", "--sign CERT",
|
||||
"Signs CERT with the key from -K",
|
||||
"and the certificate from -C") do |cert_file, options|
|
||||
raise Gem::OptionParser::InvalidArgument, "#{cert_file}: does not exist" unless
|
||||
File.file? cert_file
|
||||
|
||||
options[:sign] << cert_file
|
||||
end
|
||||
|
||||
add_option('-d', '--days NUMBER_OF_DAYS',
|
||||
'Days before the certificate expires') do |days, options|
|
||||
add_option("-d", "--days NUMBER_OF_DAYS",
|
||||
"Days before the certificate expires") do |days, options|
|
||||
options[:expiration_length_days] = days.to_i
|
||||
end
|
||||
|
||||
add_option('-R', '--re-sign',
|
||||
'Re-signs the certificate from -C with the key from -K') do |resign, options|
|
||||
add_option("-R", "--re-sign",
|
||||
"Re-signs the certificate from -C with the key from -K") do |resign, options|
|
||||
options[:resign] = resign
|
||||
end
|
||||
end
|
||||
|
@ -93,7 +93,7 @@ class Gem::Commands::CertCommand < Gem::Command
|
|||
|
||||
def open_private_key(key_file)
|
||||
check_openssl
|
||||
passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
|
||||
passphrase = ENV["GEM_PRIVATE_KEY_PASSPHRASE"]
|
||||
key = OpenSSL::PKey.read File.read(key_file), passphrase
|
||||
raise Gem::OptionParser::InvalidArgument,
|
||||
"#{key_file}: private key not found" unless key.private?
|
||||
|
@ -166,10 +166,10 @@ class Gem::Commands::CertCommand < Gem::Command
|
|||
def build_key # :nodoc:
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
raise Gem::CommandLineError,
|
||||
|
@ -260,7 +260,7 @@ For further reading on signing gems see `ri Gem::Security`.
|
|||
def load_default_key
|
||||
key_file = File.join Gem.default_key_path
|
||||
key = File.read key_file
|
||||
passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
|
||||
passphrase = ENV["GEM_PRIVATE_KEY_PASSPHRASE"]
|
||||
options[:key] = OpenSSL::PKey.read key, passphrase
|
||||
|
||||
rescue Errno::ENOENT
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../version_option'
|
||||
require_relative '../validator'
|
||||
require_relative '../doctor'
|
||||
require_relative "../command"
|
||||
require_relative "../version_option"
|
||||
require_relative "../validator"
|
||||
require_relative "../doctor"
|
||||
|
||||
class Gem::Commands::CheckCommand < Gem::Command
|
||||
include Gem::VersionOption
|
||||
|
||||
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
|
||||
|
||||
add_option('-a', '--[no-]alien',
|
||||
add_option("-a", "--[no-]alien",
|
||||
'Report "unmanaged" or rogue files in the',
|
||||
'gem repository') do |value, options|
|
||||
"gem repository") do |value, options|
|
||||
options[:alien] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]doctor',
|
||||
'Clean up uninstalled gems and broken',
|
||||
'specifications') do |value, options|
|
||||
add_option("--[no-]doctor",
|
||||
"Clean up uninstalled gems and broken",
|
||||
"specifications") do |value, options|
|
||||
options[:doctor] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]dry-run',
|
||||
'Do not remove files, only report what',
|
||||
'would be removed') do |value, options|
|
||||
add_option("--[no-]dry-run",
|
||||
"Do not remove files, only report what",
|
||||
"would be removed") do |value, options|
|
||||
options[:dry_run] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]gems',
|
||||
'Check installed gems for problems') do |value, options|
|
||||
add_option("--[no-]gems",
|
||||
"Check installed gems for problems") do |value, options|
|
||||
options[:gems] = value
|
||||
end
|
||||
|
||||
add_version_option 'check'
|
||||
add_version_option "check"
|
||||
end
|
||||
|
||||
def check_gems
|
||||
say 'Checking gems...'
|
||||
say "Checking gems..."
|
||||
say
|
||||
gems = get_all_gem_names rescue []
|
||||
|
||||
|
@ -57,7 +57,7 @@ class Gem::Commands::CheckCommand < Gem::Command
|
|||
end
|
||||
|
||||
def doctor
|
||||
say 'Checking for files from uninstalled gems...'
|
||||
say "Checking for files from uninstalled gems..."
|
||||
say
|
||||
|
||||
Gem.path.each do |gem_repo|
|
||||
|
@ -72,11 +72,11 @@ class Gem::Commands::CheckCommand < Gem::Command
|
|||
end
|
||||
|
||||
def arguments # :nodoc:
|
||||
'GEMNAME name of gem to check'
|
||||
"GEMNAME name of gem to check"
|
||||
end
|
||||
|
||||
def defaults_str # :nodoc:
|
||||
'--gems --alien'
|
||||
"--gems --alien"
|
||||
end
|
||||
|
||||
def description # :nodoc:
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../dependency_list'
|
||||
require_relative '../uninstaller'
|
||||
require_relative "../command"
|
||||
require_relative "../dependency_list"
|
||||
require_relative "../uninstaller"
|
||||
|
||||
class Gem::Commands::CleanupCommand < Gem::Command
|
||||
def initialize
|
||||
super 'cleanup',
|
||||
'Clean up old versions of installed gems',
|
||||
super "cleanup",
|
||||
"Clean up old versions of installed gems",
|
||||
:force => false, :install_dir => Gem.dir,
|
||||
:check_dev => true
|
||||
|
||||
add_option('-n', '-d', '--dry-run',
|
||||
'Do not uninstall gems') do |value, options|
|
||||
add_option("-n", "-d", "--dry-run",
|
||||
"Do not uninstall gems") do |value, options|
|
||||
options[:dryrun] = true
|
||||
end
|
||||
|
||||
add_option(:Deprecated, '--dryrun',
|
||||
'Do not uninstall gems') do |value, options|
|
||||
add_option(:Deprecated, "--dryrun",
|
||||
"Do not uninstall gems") do |value, options|
|
||||
options[:dryrun] = true
|
||||
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',
|
||||
'Check development dependencies while uninstalling',
|
||||
'(default: true)') do |value, options|
|
||||
add_option("-D", "--[no-]check-development",
|
||||
"Check development dependencies while uninstalling",
|
||||
"(default: true)") do |value, options|
|
||||
options[:check_dev] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]user-install',
|
||||
'Cleanup in user\'s home directory instead',
|
||||
'of GEM_HOME.') do |value, options|
|
||||
add_option("--[no-]user-install",
|
||||
"Cleanup in user's home directory instead",
|
||||
"of GEM_HOME.") do |value, options|
|
||||
options[:user_install] = value
|
||||
end
|
||||
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../version_option'
|
||||
require_relative "../command"
|
||||
require_relative "../version_option"
|
||||
|
||||
class Gem::Commands::ContentsCommand < Gem::Command
|
||||
include Gem::VersionOption
|
||||
|
||||
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,
|
||||
:show_install_dir => false
|
||||
|
||||
add_version_option
|
||||
|
||||
add_option('--all',
|
||||
add_option("--all",
|
||||
"Contents for all gems") do |all, options|
|
||||
options[:all] = all
|
||||
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|
|
||||
options[:specdirs] = spec_dirs
|
||||
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|
|
||||
options[:lib_only] = lib_only
|
||||
end
|
||||
|
||||
add_option('--[no-]prefix',
|
||||
add_option("--[no-]prefix",
|
||||
"Don't include installed path prefix") do |prefix, options|
|
||||
options[:prefix] = prefix
|
||||
end
|
||||
|
||||
add_option('--[no-]show-install-dir',
|
||||
'Show only the gem install dir') do |show, options|
|
||||
add_option("--[no-]show-install-dir",
|
||||
"Show only the gem install dir") do |show, options|
|
||||
options[:show_install_dir] = show
|
||||
end
|
||||
|
||||
|
@ -105,11 +105,11 @@ prefix or only the files that are requireable.
|
|||
case file
|
||||
when /\A#{spec.bindir}\//
|
||||
# $' is POSTMATCH
|
||||
[RbConfig::CONFIG['bindir'], $']
|
||||
[RbConfig::CONFIG["bindir"], $']
|
||||
when /\.so\z/
|
||||
[RbConfig::CONFIG['archdir'], file]
|
||||
[RbConfig::CONFIG["archdir"], file]
|
||||
else
|
||||
[RbConfig::CONFIG['rubylibdir'], file]
|
||||
[RbConfig::CONFIG["rubylibdir"], file]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative '../version_option'
|
||||
require_relative "../command"
|
||||
require_relative "../local_remote_options"
|
||||
require_relative "../version_option"
|
||||
|
||||
class Gem::Commands::DependencyCommand < Gem::Command
|
||||
include Gem::LocalRemoteOptions
|
||||
include Gem::VersionOption
|
||||
|
||||
def initialize
|
||||
super 'dependency',
|
||||
'Show the dependencies of an installed gem',
|
||||
super "dependency",
|
||||
"Show the dependencies of an installed gem",
|
||||
:version => Gem::Requirement.default, :domain => :local
|
||||
|
||||
add_version_option
|
||||
add_platform_option
|
||||
add_prerelease_option
|
||||
|
||||
add_option('-R', '--[no-]reverse-dependencies',
|
||||
'Include reverse dependencies in the output') do
|
||||
add_option("-R", "--[no-]reverse-dependencies",
|
||||
"Include reverse dependencies in the output") do
|
||||
|value, options|
|
||||
options[:reverse_dependencies] = value
|
||||
end
|
||||
|
||||
add_option('-p', '--pipe',
|
||||
add_option("-p", "--pipe",
|
||||
"Pipe Format (name --version ver)") do |value, options|
|
||||
options[:pipe_format] = value
|
||||
end
|
||||
|
@ -134,7 +134,7 @@ use with other commands.
|
|||
|
||||
def ensure_local_only_reverse_dependencies # :nodoc:
|
||||
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
|
||||
end
|
||||
end
|
||||
|
@ -142,7 +142,7 @@ use with other commands.
|
|||
def ensure_specs(specs) # :nodoc:
|
||||
return unless specs.empty?
|
||||
|
||||
patterns = options[:args].join ','
|
||||
patterns = options[:args].join ","
|
||||
say "No gems found matching #{patterns} (#{options[:version]})" if
|
||||
Gem.configuration.verbose
|
||||
|
||||
|
@ -151,10 +151,10 @@ use with other commands.
|
|||
|
||||
def print_dependencies(spec, level = 0) # :nodoc:
|
||||
response = String.new
|
||||
response << ' ' * level + "Gem #{spec.full_name}\n"
|
||||
response << " " * level + "Gem #{spec.full_name}\n"
|
||||
unless spec.dependencies.empty?
|
||||
spec.dependencies.sort_by {|dep| dep.name }.each do |dep|
|
||||
response << ' ' * level + " #{dep}\n"
|
||||
response << " " * level + " #{dep}\n"
|
||||
end
|
||||
end
|
||||
response
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative "../command"
|
||||
|
||||
class Gem::Commands::EnvironmentCommand < Gem::Command
|
||||
def initialize
|
||||
super 'environment', 'Display information about the RubyGems environment'
|
||||
super "environment", "Display information about the RubyGems environment"
|
||||
end
|
||||
|
||||
def arguments # :nodoc:
|
||||
|
@ -16,7 +16,7 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
|
|||
platform display the supported gem platforms
|
||||
<omitted> display everything
|
||||
EOF
|
||||
return args.gsub(/^\s+/, '')
|
||||
return args.gsub(/^\s+/, "")
|
||||
end
|
||||
|
||||
def description # :nodoc:
|
||||
|
@ -141,7 +141,7 @@ lib/rubygems/defaults/operating_system.rb
|
|||
|
||||
out << " - GEM CONFIGURATION:\n"
|
||||
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"
|
||||
end
|
||||
|
||||
|
@ -152,7 +152,7 @@ lib/rubygems/defaults/operating_system.rb
|
|||
|
||||
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
|
||||
|
||||
out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative '../version_option'
|
||||
require_relative "../command"
|
||||
require_relative "../local_remote_options"
|
||||
require_relative "../version_option"
|
||||
|
||||
class Gem::Commands::FetchCommand < Gem::Command
|
||||
include Gem::LocalRemoteOptions
|
||||
|
@ -13,7 +13,7 @@ class Gem::Commands::FetchCommand < Gem::Command
|
|||
: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_proxy_option
|
||||
|
@ -24,13 +24,13 @@ class Gem::Commands::FetchCommand < Gem::Command
|
|||
add_platform_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
|
||||
end
|
||||
end
|
||||
|
||||
def arguments # :nodoc:
|
||||
'GEMNAME name of gem to download'
|
||||
"GEMNAME name of gem to download"
|
||||
end
|
||||
|
||||
def defaults_str # :nodoc:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../indexer'
|
||||
require_relative "../command"
|
||||
require_relative "../indexer"
|
||||
|
||||
##
|
||||
# Generates a index files for use as a gem server.
|
||||
|
@ -9,27 +9,27 @@ require_relative '../indexer'
|
|||
|
||||
class Gem::Commands::GenerateIndexCommand < Gem::Command
|
||||
def initialize
|
||||
super 'generate_index',
|
||||
'Generates the index files for a gem server directory',
|
||||
:directory => '.', :build_modern => true
|
||||
super "generate_index",
|
||||
"Generates the index files for a gem server directory",
|
||||
:directory => ".", :build_modern => true
|
||||
|
||||
add_option '-d', '--directory=DIRNAME',
|
||||
'repository base dir containing gems subdir' do |dir, options|
|
||||
add_option "-d", "--directory=DIRNAME",
|
||||
"repository base dir containing gems subdir" do |dir, options|
|
||||
options[:directory] = File.expand_path dir
|
||||
end
|
||||
|
||||
add_option '--[no-]modern',
|
||||
'Generate indexes for RubyGems',
|
||||
'(always true)' do |value, options|
|
||||
add_option "--[no-]modern",
|
||||
"Generate indexes for RubyGems",
|
||||
"(always true)" do |value, options|
|
||||
options[:build_modern] = value
|
||||
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('--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("--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.")
|
||||
|
||||
add_option '--update',
|
||||
'Update modern indexes with gems added',
|
||||
'since the last update' do |value, options|
|
||||
add_option "--update",
|
||||
"Update modern indexes with gems added",
|
||||
"since the last update" do |value, options|
|
||||
options[:update] = value
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative "../command"
|
||||
|
||||
class Gem::Commands::HelpCommand < Gem::Command
|
||||
# :stopdoc:
|
||||
|
@ -280,7 +280,7 @@ platform.
|
|||
# :startdoc:
|
||||
|
||||
def initialize
|
||||
super 'help', "Provide help on the 'gem' command"
|
||||
super "help", "Provide help on the 'gem' command"
|
||||
|
||||
@command_manager = Gem::CommandManager.instance
|
||||
end
|
||||
|
@ -326,7 +326,7 @@ platform.
|
|||
desc_width = @command_manager.command_names.map {|n| n.size }.max + 4
|
||||
|
||||
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"
|
||||
|
||||
@command_manager.command_names.each do |cmd_name|
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../command'
|
||||
require_relative '../query_utils'
|
||||
require_relative "../command"
|
||||
require_relative "../query_utils"
|
||||
|
||||
class Gem::Commands::InfoCommand < Gem::Command
|
||||
include Gem::QueryUtils
|
||||
|
@ -13,7 +13,7 @@ class Gem::Commands::InfoCommand < Gem::Command
|
|||
|
||||
add_query_options
|
||||
|
||||
remove_option('-d')
|
||||
remove_option("-d")
|
||||
|
||||
defaults[:details] = true
|
||||
defaults[:exact] = true
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../install_update_options'
|
||||
require_relative '../dependency_installer'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative '../validator'
|
||||
require_relative '../version_option'
|
||||
require_relative "../command"
|
||||
require_relative "../install_update_options"
|
||||
require_relative "../dependency_installer"
|
||||
require_relative "../local_remote_options"
|
||||
require_relative "../validator"
|
||||
require_relative "../version_option"
|
||||
|
||||
##
|
||||
# Gem installer command line tool
|
||||
|
@ -29,7 +29,7 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|||
|
||||
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_local_remote_options
|
||||
|
@ -157,7 +157,7 @@ You can use `i` command instead of `install`.
|
|||
|
||||
@installed_specs = []
|
||||
|
||||
ENV.delete 'GEM_PATH' if options[:install_dir].nil?
|
||||
ENV.delete "GEM_PATH" if options[:install_dir].nil?
|
||||
|
||||
check_install_dir
|
||||
check_version
|
||||
|
@ -172,7 +172,7 @@ You can use `i` command instead of `install`.
|
|||
end
|
||||
|
||||
def install_from_gemdeps # :nodoc:
|
||||
require_relative '../request_set'
|
||||
require_relative "../request_set"
|
||||
rs = Gem::RequestSet.new
|
||||
|
||||
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:
|
||||
if options[:install_as_default]
|
||||
require_relative '../install_default_message'
|
||||
require_relative "../install_default_message"
|
||||
else
|
||||
require_relative '../install_message'
|
||||
require_relative "../install_message"
|
||||
end
|
||||
require_relative '../rdoc'
|
||||
require_relative "../rdoc"
|
||||
end
|
||||
|
||||
def show_install_errors(errors) # :nodoc:
|
||||
|
@ -270,7 +270,7 @@ You can use `i` command instead of `install`.
|
|||
def show_installed # :nodoc:
|
||||
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"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../query_utils'
|
||||
require_relative "../command"
|
||||
require_relative "../query_utils"
|
||||
|
||||
##
|
||||
# Searches for gems starting with the supplied argument.
|
||||
|
@ -9,7 +9,7 @@ class Gem::Commands::ListCommand < Gem::Command
|
|||
include Gem::QueryUtils
|
||||
|
||||
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,
|
||||
:installed => nil, :version => Gem::Requirement.default
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative "../command"
|
||||
|
||||
class Gem::Commands::LockCommand < Gem::Command
|
||||
def initialize
|
||||
super 'lock', 'Generate a lockdown list of gems',
|
||||
super "lock", "Generate a lockdown list of gems",
|
||||
:strict => false
|
||||
|
||||
add_option '-s', '--[no-]strict',
|
||||
'fail if unable to satisfy a dependency' do |strict, options|
|
||||
add_option "-s", "--[no-]strict",
|
||||
"fail if unable to satisfy a dependency" do |strict, options|
|
||||
options[:strict] = strict
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative "../command"
|
||||
|
||||
unless defined? Gem::Commands::MirrorCommand
|
||||
class Gem::Commands::MirrorCommand < Gem::Command
|
||||
def initialize
|
||||
super('mirror', 'Mirror all gem files (requires rubygems-mirror)')
|
||||
super("mirror", "Mirror all gem files (requires rubygems-mirror)")
|
||||
begin
|
||||
Gem::Specification.find_by_name('rubygems-mirror').activate
|
||||
Gem::Specification.find_by_name("rubygems-mirror").activate
|
||||
rescue Gem::LoadError
|
||||
# no-op
|
||||
end
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../version_option'
|
||||
require_relative "../command"
|
||||
require_relative "../version_option"
|
||||
|
||||
class Gem::Commands::OpenCommand < Gem::Command
|
||||
include Gem::VersionOption
|
||||
|
||||
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|
|
||||
options[:editor] = command || get_env_editor
|
||||
end
|
||||
add_option('-v', '--version VERSION', String,
|
||||
add_option("-v", "--version VERSION", String,
|
||||
"Opens specific gem version") do |version|
|
||||
options[:version] = version
|
||||
end
|
||||
|
@ -40,10 +40,10 @@ class Gem::Commands::OpenCommand < Gem::Command
|
|||
end
|
||||
|
||||
def get_env_editor
|
||||
ENV['GEM_EDITOR'] ||
|
||||
ENV['VISUAL'] ||
|
||||
ENV['EDITOR'] ||
|
||||
'vi'
|
||||
ENV["GEM_EDITOR"] ||
|
||||
ENV["VISUAL"] ||
|
||||
ENV["EDITOR"] ||
|
||||
"vi"
|
||||
end
|
||||
|
||||
def execute
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative '../spec_fetcher'
|
||||
require_relative '../version_option'
|
||||
require_relative "../command"
|
||||
require_relative "../local_remote_options"
|
||||
require_relative "../spec_fetcher"
|
||||
require_relative "../version_option"
|
||||
|
||||
class Gem::Commands::OutdatedCommand < Gem::Command
|
||||
include Gem::LocalRemoteOptions
|
||||
include Gem::VersionOption
|
||||
|
||||
def initialize
|
||||
super 'outdated', 'Display all gems that need updates'
|
||||
super "outdated", "Display all gems that need updates"
|
||||
|
||||
add_local_remote_options
|
||||
add_platform_option
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative '../gemcutter_utilities'
|
||||
require_relative '../text'
|
||||
require_relative "../command"
|
||||
require_relative "../local_remote_options"
|
||||
require_relative "../gemcutter_utilities"
|
||||
require_relative "../text"
|
||||
|
||||
class Gem::Commands::OwnerCommand < Gem::Command
|
||||
include Gem::Text
|
||||
|
@ -34,23 +34,23 @@ permission to.
|
|||
end
|
||||
|
||||
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_key_option
|
||||
add_otp_option
|
||||
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
|
||||
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
|
||||
end
|
||||
|
||||
add_option '-h', '--host HOST',
|
||||
'Use another gemcutter-compatible host',
|
||||
' (e.g. https://rubygems.org)' do |value, options|
|
||||
add_option "-h", "--host HOST",
|
||||
"Use another gemcutter-compatible host",
|
||||
" (e.g. https://rubygems.org)" do |value, options|
|
||||
options[:host] = value
|
||||
end
|
||||
end
|
||||
|
@ -108,7 +108,7 @@ permission to.
|
|||
|
||||
def send_owner_request(method, name, owner)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,67 +1,67 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../package'
|
||||
require_relative '../installer'
|
||||
require_relative '../version_option'
|
||||
require_relative "../command"
|
||||
require_relative "../package"
|
||||
require_relative "../installer"
|
||||
require_relative "../version_option"
|
||||
|
||||
class Gem::Commands::PristineCommand < Gem::Command
|
||||
include Gem::VersionOption
|
||||
|
||||
def initialize
|
||||
super 'pristine',
|
||||
'Restores installed gems to pristine condition from files located in the gem cache',
|
||||
super "pristine",
|
||||
"Restores installed gems to pristine condition from files located in the gem cache",
|
||||
:version => Gem::Requirement.default,
|
||||
:extensions => true,
|
||||
:extensions_set => false,
|
||||
:all => false
|
||||
|
||||
add_option('--all',
|
||||
'Restore all installed gems to pristine',
|
||||
'condition') do |value, options|
|
||||
add_option("--all",
|
||||
"Restore all installed gems to pristine",
|
||||
"condition") do |value, options|
|
||||
options[:all] = value
|
||||
end
|
||||
|
||||
add_option('--skip=gem_name',
|
||||
'used on --all, skip if name == gem_name') do |value, options|
|
||||
add_option("--skip=gem_name",
|
||||
"used on --all, skip if name == gem_name") do |value, options|
|
||||
options[:skip] ||= []
|
||||
options[:skip] << value
|
||||
end
|
||||
|
||||
add_option('--[no-]extensions',
|
||||
'Restore gems with extensions',
|
||||
'in addition to regular gems') do |value, options|
|
||||
add_option("--[no-]extensions",
|
||||
"Restore gems with extensions",
|
||||
"in addition to regular gems") do |value, options|
|
||||
options[:extensions_set] = true
|
||||
options[:extensions] = value
|
||||
end
|
||||
|
||||
add_option('--only-executables',
|
||||
'Only restore executables') do |value, options|
|
||||
add_option("--only-executables",
|
||||
"Only restore executables") do |value, options|
|
||||
options[:only_executables] = value
|
||||
end
|
||||
|
||||
add_option('--only-plugins',
|
||||
'Only restore plugins') do |value, options|
|
||||
add_option("--only-plugins",
|
||||
"Only restore plugins") do |value, options|
|
||||
options[:only_plugins] = value
|
||||
end
|
||||
|
||||
add_option('-E', '--[no-]env-shebang',
|
||||
'Rewrite executables with a shebang',
|
||||
'of /usr/bin/env') do |value, options|
|
||||
add_option("-E", "--[no-]env-shebang",
|
||||
"Rewrite executables with a shebang",
|
||||
"of /usr/bin/env") do |value, options|
|
||||
options[:env_shebang] = value
|
||||
end
|
||||
|
||||
add_option('-i', '--install-dir DIR',
|
||||
'Gem repository to get binstubs and plugins installed') do |value, options|
|
||||
add_option("-i", "--install-dir DIR",
|
||||
"Gem repository to get binstubs and plugins installed") do |value, options|
|
||||
options[:install_dir] = File.expand_path(value)
|
||||
end
|
||||
|
||||
add_option('-n', '--bindir DIR',
|
||||
'Directory where executables are',
|
||||
'located') do |value, options|
|
||||
add_option("-n", "--bindir DIR",
|
||||
"Directory where executables are",
|
||||
"located") do |value, options|
|
||||
options[:bin_dir] = File.expand_path(value)
|
||||
end
|
||||
|
||||
add_version_option('restore to', 'pristine condition')
|
||||
add_version_option("restore to", "pristine condition")
|
||||
end
|
||||
|
||||
def arguments # :nodoc:
|
||||
|
@ -69,7 +69,7 @@ class Gem::Commands::PristineCommand < Gem::Command
|
|||
end
|
||||
|
||||
def defaults_str # :nodoc:
|
||||
'--extensions'
|
||||
"--extensions"
|
||||
end
|
||||
|
||||
def description # :nodoc:
|
||||
|
@ -143,7 +143,7 @@ extensions will be restored.
|
|||
gem = spec.cache_file
|
||||
|
||||
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..."
|
||||
|
||||
|
@ -163,8 +163,8 @@ extensions will be restored.
|
|||
if options.include? :env_shebang
|
||||
options[:env_shebang]
|
||||
else
|
||||
install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS['install']
|
||||
install_defaults.to_s['--env-shebang']
|
||||
install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS["install"]
|
||||
install_defaults.to_s["--env-shebang"]
|
||||
end
|
||||
|
||||
bin_dir = options[:bin_dir] if options[:bin_dir]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative '../gemcutter_utilities'
|
||||
require_relative '../package'
|
||||
require_relative "../command"
|
||||
require_relative "../local_remote_options"
|
||||
require_relative "../gemcutter_utilities"
|
||||
require_relative "../package"
|
||||
|
||||
class Gem::Commands::PushCommand < Gem::Command
|
||||
include Gem::LocalRemoteOptions
|
||||
|
@ -29,7 +29,7 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
|
@ -37,9 +37,9 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
|
|||
add_key_option
|
||||
add_otp_option
|
||||
|
||||
add_option('--host HOST',
|
||||
'Push to another gemcutter-compatible host',
|
||||
' (e.g. https://rubygems.org)') do |value, options|
|
||||
add_option("--host HOST",
|
||||
"Push to another gemcutter-compatible host",
|
||||
" (e.g. https://rubygems.org)") do |value, options|
|
||||
options[:host] = value
|
||||
@user_defined_host = true
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../query_utils'
|
||||
require_relative '../deprecate'
|
||||
require_relative "../command"
|
||||
require_relative "../query_utils"
|
||||
require_relative "../deprecate"
|
||||
|
||||
class Gem::Commands::QueryCommand < Gem::Command
|
||||
extend Gem::Deprecate
|
||||
|
@ -17,15 +17,15 @@ class Gem::Commands::QueryCommand < Gem::Command
|
|||
alert_warning message unless Gem::Deprecate.skip
|
||||
end
|
||||
|
||||
def initialize(name = 'query',
|
||||
summary = 'Query gem information in local or remote repositories')
|
||||
def initialize(name = "query",
|
||||
summary = "Query gem information in local or remote repositories")
|
||||
super name, summary,
|
||||
:domain => :local, :details => false, :versions => true,
|
||||
:installed => nil, :version => Gem::Requirement.default
|
||||
|
||||
add_option('-n', '--name-matches REGEXP',
|
||||
'Name of gem(s) to query on matches the',
|
||||
'provided REGEXP') do |value, options|
|
||||
add_option("-n", "--name-matches REGEXP",
|
||||
"Name of gem(s) to query on matches the",
|
||||
"provided REGEXP") do |value, options|
|
||||
options[:name] = /#{value}/i
|
||||
end
|
||||
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../version_option'
|
||||
require_relative '../rdoc'
|
||||
require 'fileutils'
|
||||
require_relative "../command"
|
||||
require_relative "../version_option"
|
||||
require_relative "../rdoc"
|
||||
require "fileutils"
|
||||
|
||||
class Gem::Commands::RdocCommand < Gem::Command
|
||||
include Gem::VersionOption
|
||||
|
||||
def initialize
|
||||
super 'rdoc', 'Generates RDoc for pre-installed gems',
|
||||
super "rdoc", "Generates RDoc for pre-installed gems",
|
||||
:version => Gem::Requirement.default,
|
||||
:include_rdoc => false, :include_ri => true, :overwrite => false
|
||||
|
||||
add_option('--all',
|
||||
'Generate RDoc/RI documentation for all',
|
||||
'installed gems') do |value, options|
|
||||
add_option("--all",
|
||||
"Generate RDoc/RI documentation for all",
|
||||
"installed gems") do |value, options|
|
||||
options[:all] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]rdoc',
|
||||
'Generate RDoc HTML') do |value, options|
|
||||
add_option("--[no-]rdoc",
|
||||
"Generate RDoc HTML") do |value, options|
|
||||
options[:include_rdoc] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]ri',
|
||||
'Generate RI data') do |value, options|
|
||||
add_option("--[no-]ri",
|
||||
"Generate RI data") do |value, options|
|
||||
options[:include_ri] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]overwrite',
|
||||
'Overwrite installed documents') do |value, options|
|
||||
add_option("--[no-]overwrite",
|
||||
"Overwrite installed documents") do |value, options|
|
||||
options[:overwrite] = value
|
||||
end
|
||||
|
||||
|
@ -69,7 +69,7 @@ Use --overwrite to force rebuilding of documentation.
|
|||
end
|
||||
|
||||
if specs.empty?
|
||||
alert_error 'No matching gems found'
|
||||
alert_error "No matching gems found"
|
||||
terminate_interaction 1
|
||||
end
|
||||
|
||||
|
@ -79,8 +79,8 @@ Use --overwrite to force rebuilding of documentation.
|
|||
doc.force = options[:overwrite]
|
||||
|
||||
if options[:overwrite]
|
||||
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, "ri")
|
||||
FileUtils.rm_rf File.join(spec.doc_dir, "rdoc")
|
||||
end
|
||||
|
||||
begin
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../query_utils'
|
||||
require_relative "../command"
|
||||
require_relative "../query_utils"
|
||||
|
||||
class Gem::Commands::SearchCommand < Gem::Command
|
||||
include Gem::QueryUtils
|
||||
|
||||
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,
|
||||
:installed => nil, :version => Gem::Requirement.default
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative "../command"
|
||||
|
||||
unless defined? Gem::Commands::ServerCommand
|
||||
class Gem::Commands::ServerCommand < Gem::Command
|
||||
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
|
||||
Gem::Specification.find_by_name('rubygems-server').activate
|
||||
Gem::Specification.find_by_name("rubygems-server").activate
|
||||
rescue Gem::LoadError
|
||||
# no-op
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative "../command"
|
||||
|
||||
##
|
||||
# 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
|
||||
|
||||
def initialize
|
||||
super 'setup', 'Install RubyGems',
|
||||
super "setup", "Install RubyGems",
|
||||
:format_executable => false, :document => %w[ri],
|
||||
:force => true,
|
||||
:site_or_vendor => 'sitelibdir',
|
||||
:destdir => '', :prefix => '', :previous_version => '',
|
||||
:site_or_vendor => "sitelibdir",
|
||||
:destdir => "", :prefix => "", :previous_version => "",
|
||||
:regenerate_binstubs => true,
|
||||
:regenerate_plugins => true
|
||||
|
||||
add_option '--previous-version=VERSION',
|
||||
'Previous version of RubyGems',
|
||||
'Used for changelog processing' do |version, options|
|
||||
add_option "--previous-version=VERSION",
|
||||
"Previous version of RubyGems",
|
||||
"Used for changelog processing" do |version, options|
|
||||
options[:previous_version] = version
|
||||
end
|
||||
|
||||
add_option '--prefix=PREFIX',
|
||||
'Prefix path for installing RubyGems',
|
||||
'Will not affect gem repository location' do |prefix, options|
|
||||
add_option "--prefix=PREFIX",
|
||||
"Prefix path for installing RubyGems",
|
||||
"Will not affect gem repository location" do |prefix, options|
|
||||
options[:prefix] = File.expand_path prefix
|
||||
end
|
||||
|
||||
add_option '--destdir=DESTDIR',
|
||||
'Root directory to install RubyGems into',
|
||||
'Mainly used for packaging RubyGems' do |destdir, options|
|
||||
add_option "--destdir=DESTDIR",
|
||||
"Root directory to install RubyGems into",
|
||||
"Mainly used for packaging RubyGems" do |destdir, options|
|
||||
options[:destdir] = File.expand_path destdir
|
||||
end
|
||||
|
||||
add_option '--[no-]vendor',
|
||||
'Install into vendorlibdir not sitelibdir' do |vendor, options|
|
||||
options[:site_or_vendor] = vendor ? 'vendorlibdir' : 'sitelibdir'
|
||||
add_option "--[no-]vendor",
|
||||
"Install into vendorlibdir not sitelibdir" do |vendor, options|
|
||||
options[:site_or_vendor] = vendor ? "vendorlibdir" : "sitelibdir"
|
||||
end
|
||||
|
||||
add_option '--[no-]format-executable',
|
||||
'Makes `gem` match ruby',
|
||||
'If Ruby is ruby18, gem will be gem18' do |value, options|
|
||||
add_option "--[no-]format-executable",
|
||||
"Makes `gem` match ruby",
|
||||
"If Ruby is ruby18, gem will be gem18" do |value, options|
|
||||
options[:format_executable] = value
|
||||
end
|
||||
|
||||
add_option '--[no-]document [TYPES]', Array,
|
||||
'Generate documentation for RubyGems',
|
||||
'List the documentation types you wish to',
|
||||
'generate. For example: rdoc,ri' do |value, options|
|
||||
add_option "--[no-]document [TYPES]", Array,
|
||||
"Generate documentation for RubyGems",
|
||||
"List the documentation types you wish to",
|
||||
"generate. For example: rdoc,ri" do |value, options|
|
||||
options[:document] = case value
|
||||
when nil then %w[rdoc ri]
|
||||
when false then []
|
||||
|
@ -60,46 +60,46 @@ class Gem::Commands::SetupCommand < Gem::Command
|
|||
end
|
||||
end
|
||||
|
||||
add_option '--[no-]rdoc',
|
||||
'Generate RDoc documentation for RubyGems' do |value, options|
|
||||
add_option "--[no-]rdoc",
|
||||
"Generate RDoc documentation for RubyGems" do |value, options|
|
||||
if value
|
||||
options[:document] << 'rdoc'
|
||||
options[:document] << "rdoc"
|
||||
else
|
||||
options[:document].delete 'rdoc'
|
||||
options[:document].delete "rdoc"
|
||||
end
|
||||
|
||||
options[:document].uniq!
|
||||
end
|
||||
|
||||
add_option '--[no-]ri',
|
||||
'Generate RI documentation for RubyGems' do |value, options|
|
||||
add_option "--[no-]ri",
|
||||
"Generate RI documentation for RubyGems" do |value, options|
|
||||
if value
|
||||
options[:document] << 'ri'
|
||||
options[:document] << "ri"
|
||||
else
|
||||
options[:document].delete 'ri'
|
||||
options[:document].delete "ri"
|
||||
end
|
||||
|
||||
options[:document].uniq!
|
||||
end
|
||||
|
||||
add_option '--[no-]regenerate-binstubs',
|
||||
'Regenerate gem binstubs' do |value, options|
|
||||
add_option "--[no-]regenerate-binstubs",
|
||||
"Regenerate gem binstubs" do |value, options|
|
||||
options[:regenerate_binstubs] = value
|
||||
end
|
||||
|
||||
add_option '--[no-]regenerate-plugins',
|
||||
'Regenerate gem plugins' do |value, options|
|
||||
add_option "--[no-]regenerate-plugins",
|
||||
"Regenerate gem plugins" do |value, options|
|
||||
options[:regenerate_plugins] = value
|
||||
end
|
||||
|
||||
add_option '-f', '--[no-]force',
|
||||
'Forcefully overwrite binstubs' do |value, options|
|
||||
add_option "-f", "--[no-]force",
|
||||
"Forcefully overwrite binstubs" do |value, options|
|
||||
options[:force] = value
|
||||
end
|
||||
|
||||
add_option('-E', '--[no-]env-shebang',
|
||||
'Rewrite executables with a shebang',
|
||||
'of /usr/bin/env') do |value, options|
|
||||
add_option("-E", "--[no-]env-shebang",
|
||||
"Rewrite executables with a shebang",
|
||||
"of /usr/bin/env") do |value, options|
|
||||
options[:env_shebang] = value
|
||||
end
|
||||
|
||||
|
@ -107,7 +107,7 @@ class Gem::Commands::SetupCommand < Gem::Command
|
|||
end
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
require 'fileutils'
|
||||
require "fileutils"
|
||||
if Gem.configuration.really_verbose
|
||||
extend FileUtils::Verbose
|
||||
else
|
||||
|
@ -194,7 +194,7 @@ By default, this RubyGems will install gem as:
|
|||
end
|
||||
|
||||
if options[:previous_version].empty?
|
||||
options[:previous_version] = Gem::VERSION.sub(/[0-9]+$/, '0')
|
||||
options[:previous_version] = Gem::VERSION.sub(/[0-9]+$/, "0")
|
||||
end
|
||||
|
||||
options[:previous_version] = Gem::Version.new(options[:previous_version])
|
||||
|
@ -216,7 +216,7 @@ By default, this RubyGems will install gem as:
|
|||
end
|
||||
|
||||
if documentation_success
|
||||
if options[:document].include? 'rdoc'
|
||||
if options[:document].include? "rdoc"
|
||||
say "Rdoc documentation was installed. You may now invoke:"
|
||||
say " gem server"
|
||||
say "and then peruse beautifully formatted documentation for your gems"
|
||||
|
@ -227,7 +227,7 @@ By default, this RubyGems will install gem as:
|
|||
say
|
||||
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 "pages for Ruby libraries. You may access it like this:"
|
||||
say " ri Classname"
|
||||
|
@ -244,14 +244,14 @@ By default, this RubyGems will install gem as:
|
|||
def install_executables(bin_dir)
|
||||
prog_mode = options[:prog_mode] || 0755
|
||||
|
||||
executables = { 'gem' => 'bin' }
|
||||
executables = { "gem" => "bin" }
|
||||
executables.each do |tool, path|
|
||||
say "Installing #{tool} executable" if @verbose
|
||||
|
||||
Dir.chdir path do
|
||||
bin_file = "gem"
|
||||
|
||||
require 'tmpdir'
|
||||
require "tmpdir"
|
||||
|
||||
dest_file = target_bin_path(bin_dir, 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[0] = shebang
|
||||
|
||||
File.open bin_tmp_file, 'w' do |fp|
|
||||
File.open bin_tmp_file, "w" do |fp|
|
||||
fp.puts bin.join
|
||||
end
|
||||
|
||||
|
@ -275,7 +275,7 @@ By default, this RubyGems will install gem as:
|
|||
begin
|
||||
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
|
||||
@ECHO OFF
|
||||
IF NOT "%~f0" == "~f0" GOTO :WinNT
|
||||
|
@ -296,7 +296,7 @@ By default, this RubyGems will install gem as:
|
|||
|
||||
def 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} #{ruby_name}\n"
|
||||
else
|
||||
|
@ -305,8 +305,8 @@ By default, this RubyGems will install gem as:
|
|||
end
|
||||
|
||||
def install_lib(lib_dir)
|
||||
libs = { 'RubyGems' => 'lib' }
|
||||
libs['Bundler'] = 'bundler/lib'
|
||||
libs = { "RubyGems" => "lib" }
|
||||
libs["Bundler"] = "bundler/lib"
|
||||
libs.each do |tool, path|
|
||||
say "Installing #{tool}" if @verbose
|
||||
|
||||
|
@ -319,7 +319,7 @@ By default, this RubyGems will install gem as:
|
|||
end
|
||||
|
||||
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_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
|
||||
File.writable? rubygems_doc_dir)
|
||||
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
|
||||
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
|
||||
File.expand_path '../../..', __dir__
|
||||
File.expand_path "../../..", __dir__
|
||||
end
|
||||
|
||||
generate_ri = options[:document].include? 'ri'
|
||||
generate_rdoc = options[:document].include? 'rdoc'
|
||||
generate_ri = options[:document].include? "ri"
|
||||
generate_rdoc = options[:document].include? "rdoc"
|
||||
|
||||
rdoc = Gem::RDoc.new fake_spec, generate_rdoc, generate_ri
|
||||
rdoc.generate
|
||||
|
@ -360,34 +360,24 @@ By default, this RubyGems will install gem as:
|
|||
end
|
||||
|
||||
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" }
|
||||
if current_default_spec
|
||||
File.delete(current_default_spec.loaded_from)
|
||||
specs_dir = if current_default_spec && default_dir == Gem.default_dir
|
||||
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
|
||||
|
||||
bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
|
||||
default_spec_path = File.join(specs_dir, "#{bundler_spec.full_name}.gemspec")
|
||||
Gem.write_binary(default_spec_path, bundler_spec.to_ruby)
|
||||
|
||||
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.
|
||||
normal_gemspec = File.join(default_dir, "specifications", "bundler-#{bundler_spec.version}.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)
|
||||
end
|
||||
|
||||
require_relative '../installer'
|
||||
require_relative "../installer"
|
||||
|
||||
Dir.chdir("bundler") do
|
||||
built_gem = Gem::Package.build(bundler_spec)
|
||||
|
@ -449,10 +439,10 @@ By default, this RubyGems will install gem as:
|
|||
prefix = options[:prefix]
|
||||
|
||||
if prefix.empty?
|
||||
man_dir = RbConfig::CONFIG['mandir']
|
||||
man_dir = RbConfig::CONFIG["mandir"]
|
||||
return unless man_dir
|
||||
else
|
||||
man_dir = File.join prefix, 'man'
|
||||
man_dir = File.join prefix, "man"
|
||||
end
|
||||
|
||||
prepend_destdir_if_present(man_dir)
|
||||
|
@ -464,10 +454,10 @@ By default, this RubyGems will install gem as:
|
|||
|
||||
if prefix.empty?
|
||||
lib_dir = RbConfig::CONFIG[site_or_vendor]
|
||||
bin_dir = RbConfig::CONFIG['bindir']
|
||||
bin_dir = RbConfig::CONFIG["bindir"]
|
||||
else
|
||||
lib_dir = File.join prefix, 'lib'
|
||||
bin_dir = File.join prefix, 'bin'
|
||||
lib_dir = File.join prefix, "lib"
|
||||
bin_dir = File.join prefix, "bin"
|
||||
end
|
||||
|
||||
[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)
|
||||
Dir.chdir dir do
|
||||
Dir.glob(File.join('**', '*'), File::FNM_DOTMATCH).
|
||||
Dir.glob(File.join("**", "*"), File::FNM_DOTMATCH).
|
||||
select {|f| !File.directory?(f) }
|
||||
end
|
||||
end
|
||||
|
||||
def remove_old_bin_files(bin_dir)
|
||||
old_bin_files = {
|
||||
'gem_mirror' => 'gem mirror',
|
||||
'gem_server' => 'gem server',
|
||||
'gemlock' => 'gem lock',
|
||||
'gemri' => 'ri',
|
||||
'gemwhich' => 'gem which',
|
||||
'index_gem_repository.rb' => 'gem generate_index',
|
||||
"gem_mirror" => "gem mirror",
|
||||
"gem_server" => "gem server",
|
||||
"gemlock" => "gem lock",
|
||||
"gemri" => "ri",
|
||||
"gemwhich" => "gem which",
|
||||
"index_gem_repository.rb" => "gem generate_index",
|
||||
}
|
||||
|
||||
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."
|
||||
|
||||
File.open old_bin_path, 'w' do |fp|
|
||||
File.open old_bin_path, "w" do |fp|
|
||||
fp.write <<-EOF
|
||||
#!#{Gem.ruby}
|
||||
|
||||
|
@ -506,15 +496,15 @@ abort "#{deprecation_message}"
|
|||
|
||||
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})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def remove_old_lib_files(lib_dir)
|
||||
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, "rubygems") => "lib/rubygems" }
|
||||
lib_dirs[File.join(lib_dir, "bundler")] = "bundler/lib/bundler"
|
||||
lib_dirs.each do |old_lib_dir, new_lib_dir|
|
||||
lib_files = files_in(new_lib_dir)
|
||||
|
||||
|
@ -522,11 +512,11 @@ abort "#{deprecation_message}"
|
|||
|
||||
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.delete_if do |file|
|
||||
file.start_with? 'defaults'
|
||||
file.start_with? "defaults"
|
||||
end
|
||||
|
||||
remove_file_list(to_remove, old_lib_dir)
|
||||
|
@ -552,7 +542,7 @@ abort "#{deprecation_message}"
|
|||
end
|
||||
|
||||
def show_release_notes
|
||||
release_notes = File.join Dir.pwd, 'CHANGELOG.md'
|
||||
release_notes = File.join Dir.pwd, "CHANGELOG.md"
|
||||
|
||||
release_notes =
|
||||
if File.exist? release_notes
|
||||
|
@ -583,10 +573,10 @@ abort "#{deprecation_message}"
|
|||
end
|
||||
|
||||
def uninstall_old_gemcutter
|
||||
require_relative '../uninstaller'
|
||||
require_relative "../uninstaller"
|
||||
|
||||
ui = Gem::Uninstaller.new('gemcutter', :all => true, :ignore => true,
|
||||
:version => '< 0.4')
|
||||
ui = Gem::Uninstaller.new("gemcutter", :all => true, :ignore => true,
|
||||
:version => "< 0.4")
|
||||
ui.uninstall
|
||||
rescue Gem::InstallError
|
||||
end
|
||||
|
@ -635,7 +625,7 @@ abort "#{deprecation_message}"
|
|||
destdir = options[:destdir]
|
||||
return path if destdir.empty?
|
||||
|
||||
File.join(options[:destdir], path.gsub(/^[a-zA-Z]:/, ''))
|
||||
File.join(options[:destdir], path.gsub(/^[a-zA-Z]:/, ""))
|
||||
end
|
||||
|
||||
def install_file_list(files, dest_dir)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../gemcutter_utilities'
|
||||
require_relative "../command"
|
||||
require_relative "../gemcutter_utilities"
|
||||
|
||||
class Gem::Commands::SigninCommand < Gem::Command
|
||||
include Gem::GemcutterUtilities
|
||||
|
||||
def initialize
|
||||
super 'signin', 'Sign in to any gemcutter-compatible host. '\
|
||||
'It defaults to https://rubygems.org'
|
||||
super "signin", "Sign in to any gemcutter-compatible host. "\
|
||||
"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
|
||||
end
|
||||
|
||||
|
@ -17,10 +17,10 @@ class Gem::Commands::SigninCommand < Gem::Command
|
|||
end
|
||||
|
||||
def description # :nodoc:
|
||||
'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'\
|
||||
' be inferred from the provided gem. Host resolution matches the resolution'\
|
||||
' strategy for the push command.'
|
||||
"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"\
|
||||
" be inferred from the provided gem. Host resolution matches the resolution"\
|
||||
" strategy for the push command."
|
||||
end
|
||||
|
||||
def usage # :nodoc:
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative "../command"
|
||||
|
||||
class Gem::Commands::SignoutCommand < Gem::Command
|
||||
def initialize
|
||||
super 'signout', 'Sign out from all the current sessions.'
|
||||
super "signout", "Sign out from all the current sessions."
|
||||
end
|
||||
|
||||
def description # :nodoc:
|
||||
'The `signout` command is used to sign out from all current sessions,'\
|
||||
' allowing you to sign in using a different set of credentials.'
|
||||
"The `signout` command is used to sign out from all current sessions,"\
|
||||
" allowing you to sign in using a different set of credentials."
|
||||
end
|
||||
|
||||
def usage # :nodoc:
|
||||
|
@ -19,13 +19,13 @@ class Gem::Commands::SignoutCommand < Gem::Command
|
|||
credentials_path = Gem.configuration.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)
|
||||
alert_error "File '#{Gem.configuration.credentials_path}' is read-only."\
|
||||
' Please make sure it is writable.'
|
||||
" Please make sure it is writable."
|
||||
else
|
||||
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
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../remote_fetcher'
|
||||
require_relative '../spec_fetcher'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative "../command"
|
||||
require_relative "../remote_fetcher"
|
||||
require_relative "../spec_fetcher"
|
||||
require_relative "../local_remote_options"
|
||||
|
||||
class Gem::Commands::SourcesCommand < Gem::Command
|
||||
include Gem::LocalRemoteOptions
|
||||
|
||||
def initialize
|
||||
require 'fileutils'
|
||||
require "fileutils"
|
||||
|
||||
super 'sources',
|
||||
'Manage the sources and cache file RubyGems uses to search for gems'
|
||||
super "sources",
|
||||
"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
|
||||
end
|
||||
|
||||
add_option '-l', '--list', 'List sources' do |value, options|
|
||||
add_option "-l", "--list", "List sources" do |value, options|
|
||||
options[:list] = value
|
||||
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
|
||||
end
|
||||
|
||||
add_option '-c', '--clear-all',
|
||||
'Remove all sources (clear the cache)' do |value, options|
|
||||
add_option "-c", "--clear-all",
|
||||
"Remove all sources (clear the cache)" do |value, options|
|
||||
options[:clear_all] = value
|
||||
end
|
||||
|
||||
add_option '-u', '--update', 'Update source cache' do |value, options|
|
||||
add_option "-u", "--update", "Update source cache" do |value, options|
|
||||
options[:update] = value
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -82,8 +82,8 @@ Do you want to add this source?
|
|||
def check_rubygems_https(source_uri) # :nodoc:
|
||||
uri = URI source_uri
|
||||
|
||||
if uri.scheme and uri.scheme.downcase == 'http' and
|
||||
uri.host.downcase == 'rubygems.org'
|
||||
if uri.scheme and uri.scheme.downcase == "http" and
|
||||
uri.host.downcase == "rubygems.org"
|
||||
question = <<-QUESTION.chomp
|
||||
https://rubygems.org is recommended for security over #{uri}
|
||||
|
||||
|
@ -112,7 +112,7 @@ Do you want to add this insecure source?
|
|||
end
|
||||
|
||||
def defaults_str # :nodoc:
|
||||
'--list'
|
||||
"--list"
|
||||
end
|
||||
|
||||
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
|
||||
its history:
|
||||
|
||||
* http://gems.rubyforge.org (RubyGems 1.3.6 and earlier)
|
||||
* https://rubygems.org/ (RubyGems 1.3.7 through 1.8.25)
|
||||
* http://gems.rubyforge.org (RubyGems 1.3.5 and earlier)
|
||||
* http://rubygems.org (RubyGems 1.3.6 through 1.8.30, and 2.0.0)
|
||||
* 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
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative '../version_option'
|
||||
require_relative '../package'
|
||||
require_relative "../command"
|
||||
require_relative "../local_remote_options"
|
||||
require_relative "../version_option"
|
||||
require_relative "../package"
|
||||
|
||||
class Gem::Commands::SpecificationCommand < Gem::Command
|
||||
include Gem::LocalRemoteOptions
|
||||
|
@ -11,28 +11,28 @@ class Gem::Commands::SpecificationCommand < Gem::Command
|
|||
def initialize
|
||||
Gem.load_yaml
|
||||
|
||||
super 'specification', 'Display gem specification (in yaml)',
|
||||
super "specification", "Display gem specification (in yaml)",
|
||||
:domain => :local, :version => Gem::Requirement.default,
|
||||
:format => :yaml
|
||||
|
||||
add_version_option('examine')
|
||||
add_version_option("examine")
|
||||
add_platform_option
|
||||
add_prerelease_option
|
||||
|
||||
add_option('--all', 'Output specifications for all versions of',
|
||||
'the gem') do |value, options|
|
||||
add_option("--all", "Output specifications for all versions of",
|
||||
"the gem") do |value, options|
|
||||
options[:all] = true
|
||||
end
|
||||
|
||||
add_option('--ruby', 'Output ruby format') do |value, options|
|
||||
add_option("--ruby", "Output ruby format") do |value, options|
|
||||
options[:format] = :ruby
|
||||
end
|
||||
|
||||
add_option('--yaml', 'Output YAML format') do |value, options|
|
||||
add_option("--yaml", "Output YAML format") do |value, options|
|
||||
options[:format] = :yaml
|
||||
end
|
||||
|
||||
add_option('--marshal', 'Output Marshal format') do |value, options|
|
||||
add_option("--marshal", "Output Marshal format") do |value, options|
|
||||
options[:format] = :marshal
|
||||
end
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative "../command"
|
||||
|
||||
class Gem::Commands::StaleCommand < Gem::Command
|
||||
def initialize
|
||||
super('stale', 'List gems along with access times')
|
||||
super("stale", "List gems along with access times")
|
||||
end
|
||||
|
||||
def description # :nodoc:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../version_option'
|
||||
require_relative '../uninstaller'
|
||||
require 'fileutils'
|
||||
require_relative "../command"
|
||||
require_relative "../version_option"
|
||||
require_relative "../uninstaller"
|
||||
require "fileutils"
|
||||
|
||||
##
|
||||
# Gem uninstaller command line tool
|
||||
|
@ -13,78 +13,78 @@ class Gem::Commands::UninstallCommand < Gem::Command
|
|||
include Gem::VersionOption
|
||||
|
||||
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,
|
||||
:check_dev => false, :vendor => false
|
||||
|
||||
add_option('-a', '--[no-]all',
|
||||
'Uninstall all matching versions'
|
||||
add_option("-a", "--[no-]all",
|
||||
"Uninstall all matching versions"
|
||||
) do |value, options|
|
||||
options[:all] = value
|
||||
end
|
||||
|
||||
add_option('-I', '--[no-]ignore-dependencies',
|
||||
'Ignore dependency requirements while',
|
||||
'uninstalling') do |value, options|
|
||||
add_option("-I", "--[no-]ignore-dependencies",
|
||||
"Ignore dependency requirements while",
|
||||
"uninstalling") do |value, options|
|
||||
options[:ignore] = value
|
||||
end
|
||||
|
||||
add_option('-D', '--[no-]check-development',
|
||||
'Check development dependencies while uninstalling',
|
||||
'(default: false)') do |value, options|
|
||||
add_option("-D", "--[no-]check-development",
|
||||
"Check development dependencies while uninstalling",
|
||||
"(default: false)") do |value, options|
|
||||
options[:check_dev] = value
|
||||
end
|
||||
|
||||
add_option('-x', '--[no-]executables',
|
||||
'Uninstall applicable executables without',
|
||||
'confirmation') do |value, options|
|
||||
add_option("-x", "--[no-]executables",
|
||||
"Uninstall applicable executables without",
|
||||
"confirmation") do |value, options|
|
||||
options[:executables] = value
|
||||
end
|
||||
|
||||
add_option('-i', '--install-dir DIR',
|
||||
'Directory to uninstall gem from') do |value, options|
|
||||
add_option("-i", "--install-dir DIR",
|
||||
"Directory to uninstall gem from") do |value, options|
|
||||
options[:install_dir] = File.expand_path(value)
|
||||
end
|
||||
|
||||
add_option('-n', '--bindir DIR',
|
||||
'Directory to remove executables from') do |value, options|
|
||||
add_option("-n", "--bindir DIR",
|
||||
"Directory to remove executables from") do |value, options|
|
||||
options[:bin_dir] = File.expand_path(value)
|
||||
end
|
||||
|
||||
add_option('--[no-]user-install',
|
||||
'Uninstall from user\'s home directory',
|
||||
'in addition to GEM_HOME.') do |value, options|
|
||||
add_option("--[no-]user-install",
|
||||
"Uninstall from user's home directory",
|
||||
"in addition to GEM_HOME.") do |value, options|
|
||||
options[:user_install] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]format-executable',
|
||||
'Assume executable names match Ruby\'s prefix and suffix.') do |value, options|
|
||||
add_option("--[no-]format-executable",
|
||||
"Assume executable names match Ruby's prefix and suffix.") do |value, options|
|
||||
options[:format_executable] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]force',
|
||||
'Uninstall all versions of the named gems',
|
||||
'ignoring dependencies') do |value, options|
|
||||
add_option("--[no-]force",
|
||||
"Uninstall all versions of the named gems",
|
||||
"ignoring dependencies") do |value, options|
|
||||
options[:force] = value
|
||||
end
|
||||
|
||||
add_option('--[no-]abort-on-dependent',
|
||||
'Prevent uninstalling gems that are',
|
||||
'depended on by other gems.') do |value, options|
|
||||
add_option("--[no-]abort-on-dependent",
|
||||
"Prevent uninstalling gems that are",
|
||||
"depended on by other gems.") do |value, options|
|
||||
options[:abort_on_dependent] = value
|
||||
end
|
||||
|
||||
add_version_option
|
||||
add_platform_option
|
||||
|
||||
add_option('--vendor',
|
||||
'Uninstall gem from the vendor directory.',
|
||||
'Only for use by gem repackagers.') do |value, options|
|
||||
add_option("--vendor",
|
||||
"Uninstall gem from the vendor directory.",
|
||||
"Only for use by gem repackagers.") do |value, options|
|
||||
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
|
||||
|
||||
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[:install_dir] = Gem.vendor_dir
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../version_option'
|
||||
require_relative '../security_option'
|
||||
require_relative '../remote_fetcher'
|
||||
require_relative '../package'
|
||||
require_relative "../command"
|
||||
require_relative "../version_option"
|
||||
require_relative "../security_option"
|
||||
require_relative "../remote_fetcher"
|
||||
require_relative "../package"
|
||||
|
||||
# forward-declare
|
||||
|
||||
|
@ -17,18 +17,18 @@ class Gem::Commands::UnpackCommand < Gem::Command
|
|||
include Gem::SecurityOption
|
||||
|
||||
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,
|
||||
:target => Dir.pwd
|
||||
|
||||
add_option('--target=DIR',
|
||||
'target directory for unpacking') do |value, options|
|
||||
add_option("--target=DIR",
|
||||
"target directory for unpacking") do |value, options|
|
||||
options[:target] = value
|
||||
end
|
||||
|
||||
add_option('--spec', 'unpack the gem specification') do |value, options|
|
||||
add_option("--spec", "unpack the gem specification") do |value, options|
|
||||
options[:spec] = true
|
||||
end
|
||||
|
||||
|
@ -103,11 +103,11 @@ command help for an example.
|
|||
end
|
||||
end
|
||||
|
||||
File.open destination, 'w' do |io|
|
||||
File.open destination, "w" do |io|
|
||||
io.write metadata
|
||||
end
|
||||
else
|
||||
basename = File.basename path, '.gem'
|
||||
basename = File.basename path, ".gem"
|
||||
target_dir = File.expand_path basename, options[:target]
|
||||
|
||||
package = Gem::Package.new path, security_policy
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../command_manager'
|
||||
require_relative '../dependency_installer'
|
||||
require_relative '../install_update_options'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative '../spec_fetcher'
|
||||
require_relative '../version_option'
|
||||
require_relative '../install_message' # must come before rdoc for messaging
|
||||
require_relative '../rdoc'
|
||||
require_relative "../command"
|
||||
require_relative "../command_manager"
|
||||
require_relative "../dependency_installer"
|
||||
require_relative "../install_update_options"
|
||||
require_relative "../local_remote_options"
|
||||
require_relative "../spec_fetcher"
|
||||
require_relative "../version_option"
|
||||
require_relative "../install_message" # must come before rdoc for messaging
|
||||
require_relative "../rdoc"
|
||||
|
||||
class Gem::Commands::UpdateCommand < Gem::Command
|
||||
include Gem::InstallUpdateOptions
|
||||
|
@ -25,7 +25,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
|
|||
|
||||
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
|
||||
|
||||
|
@ -35,8 +35,8 @@ class Gem::Commands::UpdateCommand < Gem::Command
|
|||
value
|
||||
end
|
||||
|
||||
add_option('--system [VERSION]', Gem::Version,
|
||||
'Update the RubyGems system software') do |value, options|
|
||||
add_option("--system [VERSION]", Gem::Version,
|
||||
"Update the RubyGems system software") do |value, options|
|
||||
value = true unless value
|
||||
|
||||
options[:system] = value
|
||||
|
@ -166,13 +166,8 @@ command to remove old versions.
|
|||
def highest_remote_name_tuple(spec) # :nodoc:
|
||||
spec_tuples = fetch_remote_gems spec
|
||||
|
||||
matching_gems = spec_tuples.select do |g,_|
|
||||
g.name == spec.name and g.match_platform?
|
||||
end
|
||||
|
||||
highest_remote_gem = matching_gems.max
|
||||
|
||||
highest_remote_gem ||= [Gem::NameTuple.null]
|
||||
highest_remote_gem = spec_tuples.max
|
||||
return unless highest_remote_gem
|
||||
|
||||
highest_remote_gem.first
|
||||
end
|
||||
|
@ -181,13 +176,13 @@ command to remove old versions.
|
|||
args = update_rubygems_arguments
|
||||
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
|
||||
say "Installing RubyGems #{version}" unless options[:silent]
|
||||
|
||||
installed = preparing_gem_layout_for(version) do
|
||||
system Gem.ruby, '--disable-gems', 'setup.rb', *args
|
||||
system Gem.ruby, "--disable-gems", "setup.rb", *args
|
||||
end
|
||||
|
||||
say "RubyGems system software updated" if installed unless options[:silent]
|
||||
|
@ -218,30 +213,22 @@ command to remove old versions.
|
|||
version = options[:system]
|
||||
update_latest = version == true
|
||||
|
||||
if update_latest
|
||||
version = Gem::Version.new Gem::VERSION
|
||||
requirement = Gem::Requirement.new ">= #{Gem::VERSION}"
|
||||
else
|
||||
unless update_latest
|
||||
version = Gem::Version.new version
|
||||
requirement = Gem::Requirement.new version
|
||||
|
||||
return version, requirement
|
||||
end
|
||||
|
||||
version = Gem::Version.new Gem::VERSION
|
||||
requirement = Gem::Requirement.new ">= #{Gem::VERSION}"
|
||||
|
||||
rubygems_update = Gem::Specification.new
|
||||
rubygems_update.name = 'rubygems-update'
|
||||
rubygems_update.name = "rubygems-update"
|
||||
rubygems_update.version = version
|
||||
|
||||
hig = {
|
||||
'rubygems-update' => rubygems_update,
|
||||
}
|
||||
|
||||
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
|
||||
highest_remote_tup = highest_remote_name_tuple(rubygems_update)
|
||||
target = highest_remote_tup ? highest_remote_tup.version : version
|
||||
|
||||
return target, requirement
|
||||
end
|
||||
|
@ -291,8 +278,8 @@ command to remove old versions.
|
|||
|
||||
check_oldest_rubygems version
|
||||
|
||||
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 = 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
|
||||
return if installed_gems.empty?
|
||||
|
||||
install_rubygems installed_gems.first
|
||||
|
@ -300,17 +287,17 @@ command to remove old versions.
|
|||
|
||||
def update_rubygems_arguments # :nodoc:
|
||||
args = []
|
||||
args << '--silent' if options[:silent]
|
||||
args << '--prefix' << Gem.prefix if Gem.prefix
|
||||
args << '--no-document' unless options[:document].include?('rdoc') || options[:document].include?('ri')
|
||||
args << '--no-format-executable' if options[:no_format_executable]
|
||||
args << '--previous-version' << Gem::VERSION if
|
||||
args << "--silent" if options[:silent]
|
||||
args << "--prefix" << Gem.prefix if Gem.prefix
|
||||
args << "--no-document" unless options[:document].include?("rdoc") || options[:document].include?("ri")
|
||||
args << "--no-format-executable" if options[:no_format_executable]
|
||||
args << "--previous-version" << Gem::VERSION if
|
||||
options[:system] == true or
|
||||
Gem::Version.new(options[:system]) >= Gem::Version.new(2)
|
||||
args
|
||||
end
|
||||
|
||||
def which_to_update(highest_installed_gems, gem_names, system = false)
|
||||
def which_to_update(highest_installed_gems, gem_names)
|
||||
result = []
|
||||
|
||||
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 }
|
||||
|
||||
highest_remote_tup = highest_remote_name_tuple l_spec
|
||||
highest_remote_ver = highest_remote_tup.version
|
||||
highest_installed_ver = l_spec.version
|
||||
next unless highest_remote_tup
|
||||
|
||||
if system or (highest_installed_ver < highest_remote_ver)
|
||||
result << Gem::NameTuple.new(l_spec.name, [highest_installed_ver, highest_remote_ver].max, highest_remote_tup.platform)
|
||||
end
|
||||
result << highest_remote_tup
|
||||
end
|
||||
|
||||
result
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative "../command"
|
||||
|
||||
class Gem::Commands::WhichCommand < Gem::Command
|
||||
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
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
add_option '-g', '--[no-]gems-first',
|
||||
'search gems before non-gems' do |gems_first, options|
|
||||
add_option "-g", "--[no-]gems-first",
|
||||
"search gems before non-gems" do |gems_first, options|
|
||||
options[:search_gems_first] = gems_first
|
||||
end
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ requiring to see why it does not behave as you expect.
|
|||
found = true
|
||||
|
||||
options[:args].each do |arg|
|
||||
arg = arg.sub(/#{Regexp.union(*Gem.suffixes)}$/, '')
|
||||
arg = arg.sub(/#{Regexp.union(*Gem.suffixes)}$/, "")
|
||||
dirs = $LOAD_PATH
|
||||
|
||||
spec = Gem::Specification.find_by_path arg
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../command'
|
||||
require_relative '../local_remote_options'
|
||||
require_relative '../version_option'
|
||||
require_relative '../gemcutter_utilities'
|
||||
require_relative "../command"
|
||||
require_relative "../local_remote_options"
|
||||
require_relative "../version_option"
|
||||
require_relative "../gemcutter_utilities"
|
||||
|
||||
class Gem::Commands::YankCommand < Gem::Command
|
||||
include Gem::LocalRemoteOptions
|
||||
|
@ -28,15 +28,15 @@ data you will need to change them immediately and yank your gem.
|
|||
end
|
||||
|
||||
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_platform_option("remove")
|
||||
add_otp_option
|
||||
|
||||
add_option('--host HOST',
|
||||
'Yank from another gemcutter-compatible host',
|
||||
' (e.g. https://rubygems.org)') do |value, options|
|
||||
add_option("--host HOST",
|
||||
"Yank from another gemcutter-compatible host",
|
||||
" (e.g. https://rubygems.org)") do |value, options|
|
||||
options[:host] = value
|
||||
end
|
||||
|
||||
|
@ -76,10 +76,10 @@ data you will need to change them immediately and yank your gem.
|
|||
request.add_field("Authorization", api_key)
|
||||
|
||||
data = {
|
||||
'gem_name' => name,
|
||||
'version' => version,
|
||||
"gem_name" => name,
|
||||
"version" => version,
|
||||
}
|
||||
data['platform'] = platform if platform
|
||||
data["platform"] = platform if platform
|
||||
|
||||
request.set_form_data data
|
||||
end
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require_relative 'user_interaction'
|
||||
require 'rbconfig'
|
||||
require_relative "user_interaction"
|
||||
require "rbconfig"
|
||||
|
||||
##
|
||||
# Gem::ConfigFile RubyGems options and gem command options from gemrc.
|
||||
|
@ -71,7 +71,7 @@ class Gem::ConfigFile
|
|||
|
||||
# :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.
|
||||
|
@ -182,20 +182,20 @@ class Gem::ConfigFile
|
|||
@update_sources = DEFAULT_UPDATE_SOURCES
|
||||
@concurrent_downloads = DEFAULT_CONCURRENT_DOWNLOADS
|
||||
@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)
|
||||
platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
|
||||
system_config = load_file SYSTEM_WIDE_CONFIG_FILE
|
||||
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|
|
||||
result.merge load_file file
|
||||
end
|
||||
|
||||
@hash = operating_system_config.merge platform_config
|
||||
unless args.index '--norc'
|
||||
unless args.index "--norc"
|
||||
@hash = @hash.merge system_config
|
||||
@hash = @hash.merge user_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
|
||||
|
||||
def credentials_path
|
||||
credentials = File.join Gem.user_home, '.gem', 'credentials'
|
||||
credentials = File.join Gem.user_home, ".gem", "credentials"
|
||||
if File.exist? credentials
|
||||
credentials
|
||||
else
|
||||
|
@ -320,13 +320,13 @@ if you believe they were disclosed to a third party.
|
|||
config = load_file(credentials_path).merge(host => api_key)
|
||||
|
||||
dirname = File.dirname credentials_path
|
||||
require 'fileutils'
|
||||
require "fileutils"
|
||||
FileUtils.mkdir_p(dirname)
|
||||
|
||||
Gem.load_yaml
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -389,7 +389,7 @@ if you believe they were disclosed to a third party.
|
|||
yield :backtrace, @backtrace
|
||||
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)
|
||||
end
|
||||
|
@ -405,7 +405,7 @@ if you believe they were disclosed to a third party.
|
|||
when /^--debug$/ then
|
||||
$DEBUG = true
|
||||
|
||||
warn 'NOTE: Debugging mode prints all exceptions even when rescued'
|
||||
warn "NOTE: Debugging mode prints all exceptions even when rescued"
|
||||
else
|
||||
@args << arg
|
||||
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
|
||||
|
||||
keys = yaml_hash.keys.map {|key| key.to_s }
|
||||
keys << 'debug'
|
||||
keys << "debug"
|
||||
re = Regexp.union(*keys)
|
||||
|
||||
@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.
|
||||
def write
|
||||
require 'fileutils'
|
||||
require "fileutils"
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,7 +39,7 @@ module Kernel
|
|||
# GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb
|
||||
|
||||
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
|
||||
|
||||
if gem_name.kind_of? Gem::Dependency
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require 'monitor'
|
||||
require "monitor"
|
||||
|
||||
module Kernel
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ if RUBY_VERSION >= "2.5" && !Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES
|
|||
start += 1
|
||||
|
||||
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
|
||||
uplevel -= 1
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'socket'
|
||||
require "socket"
|
||||
|
||||
module CoreExtensions
|
||||
module TCPSocketExt
|
||||
|
|
|
@ -20,10 +20,10 @@ module Gem
|
|||
# specified in the environment
|
||||
|
||||
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)
|
||||
default_spec_cache_dir = File.join Gem.data_home, 'gem', 'specs'
|
||||
default_spec_cache_dir = File.join Gem.data_home, "gem", "specs"
|
||||
end
|
||||
|
||||
default_spec_cache_dir
|
||||
|
@ -34,7 +34,7 @@ module Gem
|
|||
# specified in the environment
|
||||
|
||||
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
|
||||
|
||||
##
|
||||
|
@ -81,7 +81,7 @@ module Gem
|
|||
Dir.home.dup
|
||||
rescue
|
||||
if Gem.win_platform?
|
||||
File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/')
|
||||
File.expand_path File.join(ENV["HOMEDRIVE"] || ENV["SystemDrive"], "/")
|
||||
else
|
||||
File.expand_path "/"
|
||||
end
|
||||
|
@ -103,7 +103,7 @@ module Gem
|
|||
gem_dir = File.join(Gem.user_home, ".gem")
|
||||
gem_dir = File.join(Gem.data_home, "gem") unless File.exist?(gem_dir)
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -111,14 +111,14 @@ module Gem
|
|||
# The path to standard location of the user's configuration directory.
|
||||
|
||||
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
|
||||
|
||||
##
|
||||
# Finds the user's 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
|
||||
gemrc
|
||||
else
|
||||
|
@ -137,14 +137,14 @@ module Gem
|
|||
# The path to standard location of the user's cache directory.
|
||||
|
||||
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
|
||||
|
||||
##
|
||||
# The path to standard location of the user's data directory.
|
||||
|
||||
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
|
||||
|
||||
##
|
||||
|
@ -169,7 +169,7 @@ module Gem
|
|||
# Deduce Ruby's --program-prefix and --program-suffix from its install name
|
||||
|
||||
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/
|
||||
raise Gem::Exception,
|
||||
|
@ -183,7 +183,7 @@ module Gem
|
|||
# The default directory for binaries
|
||||
|
||||
def self.default_bindir
|
||||
RbConfig::CONFIG['bindir']
|
||||
RbConfig::CONFIG["bindir"]
|
||||
end
|
||||
|
||||
def self.ruby_engine
|
||||
|
@ -227,14 +227,14 @@ module Gem
|
|||
# Directory where vendor gems are installed.
|
||||
|
||||
def self.vendor_dir # :nodoc:
|
||||
if vendor_dir = ENV['GEM_VENDOR']
|
||||
if vendor_dir = ENV["GEM_VENDOR"]
|
||||
return vendor_dir.dup
|
||||
end
|
||||
|
||||
return nil unless RbConfig::CONFIG.key? 'vendordir'
|
||||
return nil unless RbConfig::CONFIG.key? "vendordir"
|
||||
|
||||
File.join RbConfig::CONFIG['vendordir'], 'gems',
|
||||
RbConfig::CONFIG['ruby_version']
|
||||
File.join RbConfig::CONFIG["vendordir"], "gems",
|
||||
RbConfig::CONFIG["ruby_version"]
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -97,14 +97,14 @@ class Gem::Dependency
|
|||
end
|
||||
|
||||
def pretty_print(q) # :nodoc:
|
||||
q.group 1, 'Gem::Dependency.new(', ')' do
|
||||
q.group 1, "Gem::Dependency.new(", ")" do
|
||||
q.pp name
|
||||
q.text ','
|
||||
q.text ","
|
||||
q.breakable
|
||||
|
||||
q.pp requirement
|
||||
|
||||
q.text ','
|
||||
q.text ","
|
||||
q.breakable
|
||||
|
||||
q.pp type
|
||||
|
@ -197,7 +197,7 @@ class Gem::Dependency
|
|||
reqs = other.requirement.requirements
|
||||
|
||||
return false unless reqs.length == 1
|
||||
return false unless reqs.first.first == '='
|
||||
return false unless reqs.first.first == "="
|
||||
|
||||
version = reqs.first.last
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../rubygems'
|
||||
require_relative 'dependency_list'
|
||||
require_relative 'package'
|
||||
require_relative 'installer'
|
||||
require_relative 'spec_fetcher'
|
||||
require_relative 'user_interaction'
|
||||
require_relative 'available_set'
|
||||
require_relative 'deprecate'
|
||||
require_relative "../rubygems"
|
||||
require_relative "dependency_list"
|
||||
require_relative "package"
|
||||
require_relative "installer"
|
||||
require_relative "spec_fetcher"
|
||||
require_relative "user_interaction"
|
||||
require_relative "available_set"
|
||||
require_relative "deprecate"
|
||||
|
||||
##
|
||||
# Installs a gem along with all its dependencies from local and remote gems.
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require_relative 'tsort'
|
||||
require_relative 'deprecate'
|
||||
require_relative "tsort"
|
||||
require_relative "deprecate"
|
||||
|
||||
##
|
||||
# Gem::DependencyList is used for installing and uninstalling gems in the
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative '../rubygems'
|
||||
require_relative 'user_interaction'
|
||||
require_relative "../rubygems"
|
||||
require_relative "user_interaction"
|
||||
|
||||
##
|
||||
# Cleans up after a partially-failed uninstall or for an invalid
|
||||
|
@ -19,13 +19,13 @@ class Gem::Doctor
|
|||
# subdirectory.
|
||||
|
||||
REPOSITORY_EXTENSION_MAP = [ # :nodoc:
|
||||
['specifications', '.gemspec'],
|
||||
['build_info', '.info'],
|
||||
['cache', '.gem'],
|
||||
['doc', ''],
|
||||
['extensions', ''],
|
||||
['gems', ''],
|
||||
['plugins', ''],
|
||||
["specifications", ".gemspec"],
|
||||
["build_info", ".info"],
|
||||
["cache", ".gem"],
|
||||
["doc", ""],
|
||||
["extensions", ""],
|
||||
["gems", ""],
|
||||
["plugins", ""],
|
||||
].freeze
|
||||
|
||||
missing =
|
||||
|
@ -74,8 +74,8 @@ class Gem::Doctor
|
|||
Gem.use_paths @gem_repository.to_s
|
||||
|
||||
unless gem_repository?
|
||||
say 'This directory does not appear to be a RubyGems repository, ' +
|
||||
'skipping'
|
||||
say "This directory does not appear to be a RubyGems repository, " +
|
||||
"skipping"
|
||||
say
|
||||
return
|
||||
end
|
||||
|
@ -111,16 +111,16 @@ class Gem::Doctor
|
|||
basename = File.basename(child, extension)
|
||||
next if installed_specs.include? basename
|
||||
next if /^rubygems-\d/ =~ basename
|
||||
next if 'specifications' == sub_directory and 'default' == basename
|
||||
next if 'plugins' == sub_directory and Gem.plugin_suffix_regexp =~ basename
|
||||
next if "specifications" == sub_directory and "default" == 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
|
||||
'Extra'
|
||||
"Extra"
|
||||
else
|
||||
FileUtils.rm_r(child)
|
||||
'Removed'
|
||||
"Removed"
|
||||
end
|
||||
|
||||
say "#{action} #{type} #{sub_directory}/#{File.basename(child)}"
|
||||
|
|
|
@ -136,8 +136,8 @@ module Gem
|
|||
"Found %s (%s), but was for platform%s %s" %
|
||||
[@name,
|
||||
@version,
|
||||
@platforms.size == 1 ? '' : 's',
|
||||
@platforms.join(' ,')]
|
||||
@platforms.size == 1 ? "" : "s",
|
||||
@platforms.join(" ,")]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'deprecate'
|
||||
require_relative 'unknown_command_spell_checker'
|
||||
require_relative "deprecate"
|
||||
require_relative "unknown_command_spell_checker"
|
||||
|
||||
##
|
||||
# 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)
|
||||
DidYouMean.correct_error(Gem::UnknownCommandError, Gem::UnknownCommandSpellChecker)
|
||||
else
|
||||
DidYouMean::SPELL_CHECKERS['Gem::UnknownCommandError'] =
|
||||
DidYouMean::SPELL_CHECKERS["Gem::UnknownCommandError"] =
|
||||
Gem::UnknownCommandSpellChecker
|
||||
|
||||
prepend DidYouMean::Correctable
|
||||
|
@ -154,7 +154,7 @@ class Gem::ImpossibleDependenciesError < Gem::Exception
|
|||
|
||||
def build_message # :nodoc:
|
||||
requester = @request.requester
|
||||
requester = requester ? requester.spec.full_name : 'The user'
|
||||
requester = requester ? requester.spec.full_name : "The user"
|
||||
dependency = @request.dependency
|
||||
|
||||
message = "#{requester} requires #{dependency} but it conflicted:\n".dup
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
module Gem::Ext; end
|
||||
|
||||
require_relative 'ext/build_error'
|
||||
require_relative 'ext/builder'
|
||||
require_relative 'ext/configure_builder'
|
||||
require_relative 'ext/ext_conf_builder'
|
||||
require_relative 'ext/rake_builder'
|
||||
require_relative 'ext/cmake_builder'
|
||||
require_relative 'ext/cargo_builder'
|
||||
require_relative "ext/build_error"
|
||||
require_relative "ext/builder"
|
||||
require_relative "ext/configure_builder"
|
||||
require_relative "ext/ext_conf_builder"
|
||||
require_relative "ext/rake_builder"
|
||||
require_relative "ext/cmake_builder"
|
||||
require_relative "ext/cargo_builder"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
##
|
||||
# Raised when there is an error while building extensions.
|
||||
|
||||
require_relative '../exceptions'
|
||||
require_relative "../exceptions"
|
||||
|
||||
class Gem::Ext::BuildError < Gem::InstallError
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require_relative '../user_interaction'
|
||||
require_relative "../user_interaction"
|
||||
|
||||
class Gem::Ext::Builder
|
||||
include Gem::UserInteraction
|
||||
|
@ -18,29 +18,29 @@ class Gem::Ext::Builder
|
|||
end
|
||||
|
||||
def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil)
|
||||
unless File.exist? File.join(make_dir, 'Makefile')
|
||||
raise Gem::InstallError, 'Makefile not found'
|
||||
unless File.exist? File.join(make_dir, "Makefile")
|
||||
raise Gem::InstallError, "Makefile not found"
|
||||
end
|
||||
|
||||
# try to find make program from Ruby configure arguments first
|
||||
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
|
||||
make_program_name = ENV['MAKE'] || ENV['make'] || $1
|
||||
RbConfig::CONFIG["configure_args"] =~ /with-make-prog\=(\w+)/
|
||||
make_program_name = ENV["MAKE"] || ENV["make"] || $1
|
||||
unless make_program_name
|
||||
make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
|
||||
make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? "nmake" : "make"
|
||||
end
|
||||
make_program = Shellwords.split(make_program_name)
|
||||
|
||||
# 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]
|
||||
|
||||
if sitedir
|
||||
env << 'sitearchdir=%s' % sitedir
|
||||
env << 'sitelibdir=%s' % sitedir
|
||||
env << "sitearchdir=%s" % sitedir
|
||||
env << "sitelibdir=%s" % sitedir
|
||||
end
|
||||
|
||||
['clean', '', 'install'].each do |target|
|
||||
["clean", "", "install"].each do |target|
|
||||
# Pass DESTDIR via command line to override what's in MAKEFLAGS
|
||||
cmd = [
|
||||
*make_program,
|
||||
|
@ -50,7 +50,7 @@ class Gem::Ext::Builder
|
|||
begin
|
||||
run(cmd, results, "make #{target}".rstrip, make_dir)
|
||||
rescue Gem::InstallError
|
||||
raise unless target == 'clean' # ignore clean failure
|
||||
raise unless target == "clean" # ignore clean failure
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -59,7 +59,7 @@ class Gem::Ext::Builder
|
|||
verbose = Gem.configuration.really_verbose
|
||||
|
||||
begin
|
||||
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
|
||||
rubygems_gemdeps, ENV["RUBYGEMS_GEMDEPS"] = ENV["RUBYGEMS_GEMDEPS"], nil
|
||||
if verbose
|
||||
puts("current directory: #{dir}")
|
||||
p(command)
|
||||
|
@ -70,7 +70,7 @@ class Gem::Ext::Builder
|
|||
|
||||
require "open3"
|
||||
# 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
|
||||
Open3.capture2e(build_env, *command, :chdir => dir)
|
||||
rescue => error
|
||||
|
@ -82,7 +82,7 @@ class Gem::Ext::Builder
|
|||
results << output
|
||||
end
|
||||
ensure
|
||||
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
||||
ENV["RUBYGEMS_GEMDEPS"] = rubygems_gemdeps
|
||||
end
|
||||
|
||||
unless status.success?
|
||||
|
@ -212,11 +212,11 @@ EOF
|
|||
# Writes +output+ to gem_make.out in the extension install directory.
|
||||
|
||||
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
|
||||
|
||||
File.open destination, 'wb' do |io|
|
||||
File.open destination, "wb" do |io|
|
||||
io.puts output
|
||||
end
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|||
def build_crate(dest_path, results, args, cargo_dir)
|
||||
env = build_env
|
||||
cmd = cargo_command(cargo_dir, dest_path, args)
|
||||
runner.call cmd, results, 'cargo', cargo_dir, env
|
||||
runner.call cmd, results, "cargo", cargo_dir, env
|
||||
|
||||
results
|
||||
end
|
||||
|
||||
def build_env
|
||||
build_env = rb_config_env
|
||||
build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?('RUBY_STATIC')
|
||||
build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?("RUBY_STATIC")
|
||||
build_env
|
||||
end
|
||||
|
||||
|
@ -46,7 +46,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|||
|
||||
cmd = []
|
||||
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 += ["--manifest-path", manifest]
|
||||
cmd += ["--lib"]
|
||||
|
@ -144,13 +144,13 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|||
def cargo_dylib_path(dest_path)
|
||||
prefix = so_ext == "dll" ? "" : "lib"
|
||||
path_parts = [dest_path]
|
||||
path_parts << ENV['CARGO_BUILD_TARGET'] if ENV['CARGO_BUILD_TARGET']
|
||||
path_parts << ENV["CARGO_BUILD_TARGET"] if ENV["CARGO_BUILD_TARGET"]
|
||||
path_parts += [profile_target_directory, "#{prefix}#{cargo_crate_name}.#{so_ext}"]
|
||||
File.join(*path_parts)
|
||||
end
|
||||
|
||||
def cargo_crate_name
|
||||
spec.metadata.fetch('cargo_crate_name', spec.name).tr('-', '_')
|
||||
spec.metadata.fetch("cargo_crate_name", spec.name).tr("-", "_")
|
||||
end
|
||||
|
||||
def rustc_dynamic_linker_flags(dest_dir)
|
||||
|
@ -297,8 +297,8 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|||
|
||||
def profile_target_directory
|
||||
case profile
|
||||
when :release then 'release'
|
||||
when :dev then 'debug'
|
||||
when :release then "release"
|
||||
when :dev then "debug"
|
||||
else raise "unknown target directory for profile: #{profile}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
|
||||
def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd)
|
||||
unless File.exist?(File.join(cmake_dir, 'Makefile'))
|
||||
require_relative '../command'
|
||||
unless File.exist?(File.join(cmake_dir, "Makefile"))
|
||||
require_relative "../command"
|
||||
cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args]
|
||||
|
||||
run cmd, results, class_name, cmake_dir
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
|
||||
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]
|
||||
|
||||
run cmd, results, class_name, configure_dir
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue