mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge RubyGems-3.2.17 and Bundler-2.2.17
This commit is contained in:
parent
3e2f089432
commit
dd28c03d5f
57 changed files with 983 additions and 185 deletions
|
@ -504,8 +504,8 @@ module Bundler
|
|||
By default, setting a configuration value sets it for all projects
|
||||
on the machine.
|
||||
|
||||
If a global setting is superceded by local configuration, this command
|
||||
will show the current value, as well as any superceded values and
|
||||
If a global setting is superseded by local configuration, this command
|
||||
will show the current value, as well as any superseded values and
|
||||
where they were specified.
|
||||
D
|
||||
require_relative "cli/config"
|
||||
|
|
|
@ -94,6 +94,8 @@ module Bundler
|
|||
end
|
||||
|
||||
def self.ensure_all_gems_in_lockfile!(names, locked_gems = Bundler.locked_gems)
|
||||
return unless locked_gems
|
||||
|
||||
locked_names = locked_gems.specs.map(&:name).uniq
|
||||
names.-(locked_names).each do |g|
|
||||
raise GemNotFound, gem_not_found_message(g, locked_names)
|
||||
|
|
|
@ -50,16 +50,20 @@ module Bundler
|
|||
|
||||
content = response.body
|
||||
|
||||
SharedHelpers.filesystem_access(local_temp_path) do
|
||||
etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
|
||||
correct_response = SharedHelpers.filesystem_access(local_temp_path) do
|
||||
if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
|
||||
local_temp_path.open("a") {|f| f << slice_body(content, 1..-1) }
|
||||
|
||||
etag_for(local_temp_path) == etag
|
||||
else
|
||||
local_temp_path.open("wb") {|f| f << content }
|
||||
|
||||
etag.length.zero? || etag_for(local_temp_path) == etag
|
||||
end
|
||||
end
|
||||
|
||||
etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
|
||||
if etag.length.zero? || etag_for(local_temp_path) == etag
|
||||
if correct_response
|
||||
SharedHelpers.filesystem_access(local_path) do
|
||||
FileUtils.mv(local_temp_path, local_path)
|
||||
end
|
||||
|
@ -92,11 +96,11 @@ module Bundler
|
|||
|
||||
def checksum_for_file(path)
|
||||
return nil unless path.file?
|
||||
# This must use IO.read instead of Digest.file().hexdigest
|
||||
# This must use File.read instead of Digest.file().hexdigest
|
||||
# because we need to preserve \n line endings on windows when calculating
|
||||
# the checksum
|
||||
SharedHelpers.filesystem_access(path, :read) do
|
||||
SharedHelpers.digest(:MD5).hexdigest(IO.read(path))
|
||||
SharedHelpers.digest(:MD5).hexdigest(File.read(path))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,6 +20,7 @@ module Bundler
|
|||
2.5
|
||||
2.6
|
||||
2.7
|
||||
3.0
|
||||
].freeze
|
||||
|
||||
KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
|
||||
|
|
|
@ -161,16 +161,14 @@ module Bundler
|
|||
end
|
||||
|
||||
def resolve_with_cache!
|
||||
raise "Specs already loaded" if @specs
|
||||
sources.cached!
|
||||
specs
|
||||
resolve
|
||||
end
|
||||
|
||||
def resolve_remotely!
|
||||
return if @specs
|
||||
@remote = true
|
||||
sources.remote!
|
||||
specs
|
||||
resolve
|
||||
end
|
||||
|
||||
# For given dependency list returns a SpecSet with Gemspec of all the required
|
||||
|
|
|
@ -47,7 +47,8 @@ module Bundler
|
|||
remote_uri = filter_uri(remote_uri)
|
||||
super "Authentication is required for #{remote_uri}.\n" \
|
||||
"Please supply credentials for this source. You can do this by running:\n" \
|
||||
" bundle config set --global #{remote_uri} username:password"
|
||||
"`bundle config set --global #{remote_uri} username:password`\n" \
|
||||
"or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
|
||||
end
|
||||
end
|
||||
# This error is raised if HTTP authentication is provided, but incorrect.
|
||||
|
|
|
@ -14,8 +14,10 @@ module Bundler
|
|||
def fetch(uri, headers = {}, counter = 0)
|
||||
raise HTTPError, "Too many redirects" if counter >= redirect_limit
|
||||
|
||||
filtered_uri = URICredentialsFilter.credential_filtered_uri(uri)
|
||||
|
||||
response = request(uri, headers)
|
||||
Bundler.ui.debug("HTTP #{response.code} #{response.message} #{uri}")
|
||||
Bundler.ui.debug("HTTP #{response.code} #{response.message} #{filtered_uri}")
|
||||
|
||||
case response
|
||||
when Net::HTTPSuccess, Net::HTTPNotModified
|
||||
|
@ -40,7 +42,7 @@ module Bundler
|
|||
raise BadAuthenticationError, uri.host if uri.userinfo
|
||||
raise AuthenticationRequiredError, uri.host
|
||||
when Net::HTTPNotFound
|
||||
raise FallbackError, "Net::HTTPNotFound: #{URICredentialsFilter.credential_filtered_uri(uri)}"
|
||||
raise FallbackError, "Net::HTTPNotFound: #{filtered_uri}"
|
||||
else
|
||||
raise HTTPError, "#{response.class}#{": #{response.body}" unless response.body.empty?}"
|
||||
end
|
||||
|
@ -49,7 +51,9 @@ module Bundler
|
|||
def request(uri, headers)
|
||||
validate_uri_scheme!(uri)
|
||||
|
||||
Bundler.ui.debug "HTTP GET #{uri}"
|
||||
filtered_uri = URICredentialsFilter.credential_filtered_uri(uri)
|
||||
|
||||
Bundler.ui.debug "HTTP GET #{filtered_uri}"
|
||||
req = Net::HTTP::Get.new uri.request_uri, headers
|
||||
if uri.user
|
||||
user = CGI.unescape(uri.user)
|
||||
|
@ -69,7 +73,7 @@ module Bundler
|
|||
raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
|
||||
"connection and try again."
|
||||
else
|
||||
raise HTTPError, "Network error while fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" \
|
||||
raise HTTPError, "Network error while fetching #{filtered_uri}" \
|
||||
" (#{e})"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -128,7 +128,7 @@ module Bundler
|
|||
# evaluates a gemfile to remove the specified gem
|
||||
# from it.
|
||||
def remove_deps(gemfile_path)
|
||||
initial_gemfile = IO.readlines(gemfile_path)
|
||||
initial_gemfile = File.readlines(gemfile_path)
|
||||
|
||||
Bundler.ui.info "Removing gems from #{gemfile_path}"
|
||||
|
||||
|
@ -181,7 +181,7 @@ module Bundler
|
|||
patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/
|
||||
new_gemfile = []
|
||||
multiline_removal = false
|
||||
IO.readlines(gemfile_path).each do |line|
|
||||
File.readlines(gemfile_path).each do |line|
|
||||
match_data = line.match(patterns)
|
||||
if match_data && is_not_within_comment?(line, match_data)
|
||||
multiline_removal = line.rstrip.end_with?(",")
|
||||
|
|
|
@ -52,7 +52,7 @@ def gemfile(install = false, options = {}, &gemfile)
|
|||
builder.instance_eval(&gemfile)
|
||||
builder.check_primary_source_safety
|
||||
|
||||
Bundler.settings.temporary(:frozen => false) do
|
||||
Bundler.settings.temporary(:deployment => false, :frozen => false) do
|
||||
definition = builder.to_definition(nil, true)
|
||||
def definition.lock(*); end
|
||||
definition.validate_runtime!
|
||||
|
|
|
@ -199,7 +199,7 @@ The following is a list of all configuration keys and their purpose\. You can le
|
|||
\fBfrozen\fR (\fBBUNDLE_FROZEN\fR): Disallow changes to the \fBGemfile\fR\. When the \fBGemfile\fR is changed and the lockfile has not been updated, running Bundler commands will be blocked\. Defaults to \fBtrue\fR when \fB\-\-deployment\fR is used\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBgem\.github_username\fR (\fBBUNDLE_GEM__GITHUB_USERNAME\fR): Sets a GitHub username or organization to be used in \fBREADME\fR file when you create a new gem via \fBbundle gem\fR command\. It can be overriden by passing an explicit \fB\-\-github\-username\fR flag to \fBbundle gem\fR\.
|
||||
\fBgem\.github_username\fR (\fBBUNDLE_GEM__GITHUB_USERNAME\fR): Sets a GitHub username or organization to be used in \fBREADME\fR file when you create a new gem via \fBbundle gem\fR command\. It can be overridden by passing an explicit \fB\-\-github\-username\fR flag to \fBbundle gem\fR\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBgem\.push_key\fR (\fBBUNDLE_GEM__PUSH_KEY\fR): Sets the \fB\-\-key\fR parameter for \fBgem push\fR when using the \fBrake release\fR command with a private gemstash server\.
|
||||
|
@ -470,6 +470,23 @@ export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x\-oauth\-basic
|
|||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
Note that any configured credentials will be redacted by informative commands such as \fBbundle config list\fR or \fBbundle config get\fR, unless you use the \fB\-\-parseable\fR flag\. This is to avoid unintentially leaking credentials when copy\-pasting bundler output\.
|
||||
.
|
||||
.P
|
||||
Also note that to guarantee a sane mapping between valid environment variable names and valid host names, bundler makes the following transformations:
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
Any \fB\-\fR characters in a host name are mapped to a triple dash (\fB___\fR) in the corresponding enviroment variable\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
Any \fB\.\fR characters in a host name are mapped to a double dash (\fB__\fR) in the corresponding environment variable\.
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
This means that if you have a gem server named \fBmy\.gem\-host\.com\fR, you\'ll need to use the \fBBUNDLE_MY__GEM___HOST__COM\fR variable to configure credentials for it through ENV\.
|
||||
.
|
||||
.SH "CONFIGURE BUNDLER DIRECTORIES"
|
||||
Bundler\'s home, config, cache and plugin directories are able to be configured through environment variables\. The default location for Bundler\'s home directory is \fB~/\.bundle\fR, which all directories inherit from by default\. The following outlines the available environment variables and their default values
|
||||
.
|
||||
|
|
|
@ -196,7 +196,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
|
|||
Defaults to `true` when `--deployment` is used.
|
||||
* `gem.github_username` (`BUNDLE_GEM__GITHUB_USERNAME`):
|
||||
Sets a GitHub username or organization to be used in `README` file when you
|
||||
create a new gem via `bundle gem` command. It can be overriden by passing an
|
||||
create a new gem via `bundle gem` command. It can be overridden by passing an
|
||||
explicit `--github-username` flag to `bundle gem`.
|
||||
* `gem.push_key` (`BUNDLE_GEM__PUSH_KEY`):
|
||||
Sets the `--key` parameter for `gem push` when using the `rake release`
|
||||
|
@ -376,6 +376,23 @@ where you can use personal OAuth tokens:
|
|||
|
||||
export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic
|
||||
|
||||
Note that any configured credentials will be redacted by informative commands
|
||||
such as `bundle config list` or `bundle config get`, unless you use the
|
||||
`--parseable` flag. This is to avoid unintentially leaking credentials when
|
||||
copy-pasting bundler output.
|
||||
|
||||
Also note that to guarantee a sane mapping between valid environment variable
|
||||
names and valid host names, bundler makes the following transformations:
|
||||
|
||||
* Any `-` characters in a host name are mapped to a triple dash (`___`) in the
|
||||
corresponding enviroment variable.
|
||||
|
||||
* Any `.` characters in a host name are mapped to a double dash (`__`) in the
|
||||
corresponding environment variable.
|
||||
|
||||
This means that if you have a gem server named `my.gem-host.com`, you'll need to
|
||||
use the `BUNDLE_MY__GEM___HOST__COM` variable to configure credentials for it
|
||||
through ENV.
|
||||
|
||||
## CONFIGURE BUNDLER DIRECTORIES
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ module Bundler
|
|||
end
|
||||
|
||||
# To be called from Cli class to pass the command and argument to
|
||||
# approriate plugin class
|
||||
# appropriate plugin class
|
||||
def exec_command(command, args)
|
||||
raise UndefinedCommandError, "Command `#{command}` not found" unless command? command
|
||||
|
||||
|
@ -183,7 +183,7 @@ module Bundler
|
|||
!index.source_plugin(name.to_s).nil?
|
||||
end
|
||||
|
||||
# @return [Class] that handles the source. The calss includes API::Source
|
||||
# @return [Class] that handles the source. The class includes API::Source
|
||||
def source(name)
|
||||
raise UnknownSourceError, "Source #{name} not found" unless source? name
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ module Bundler
|
|||
raise e
|
||||
end
|
||||
return true unless name
|
||||
Bundler.ui.info "" unless Bundler.ui.debug? # Add new line incase dots preceded this
|
||||
Bundler.ui.info "" unless Bundler.ui.debug? # Add new line in case dots preceded this
|
||||
Bundler.ui.warn "Retrying #{name} due to error (#{current_run.next}/#{total_runs}): #{e.class} #{e.message}", Bundler.ui.debug?
|
||||
end
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ module Bundler
|
|||
auto_install
|
||||
cache_all
|
||||
cache_all_platforms
|
||||
clean
|
||||
default_install_uses_path
|
||||
deployment
|
||||
deployment_means_frozen
|
||||
|
@ -26,11 +27,14 @@ module Bundler
|
|||
force_ruby_platform
|
||||
forget_cli_options
|
||||
frozen
|
||||
gem.changelog
|
||||
gem.coc
|
||||
gem.mit
|
||||
git.allow_insecure
|
||||
global_gem_cache
|
||||
ignore_messages
|
||||
init_gems_rb
|
||||
inline
|
||||
no_install
|
||||
no_prune
|
||||
path_relative_to_cwd
|
||||
|
@ -60,6 +64,22 @@ module Bundler
|
|||
without
|
||||
].freeze
|
||||
|
||||
STRING_KEYS = %w[
|
||||
bin
|
||||
cache_path
|
||||
console
|
||||
gem.ci
|
||||
gem.github_username
|
||||
gem.linter
|
||||
gem.rubocop
|
||||
gem.test
|
||||
gemfile
|
||||
path
|
||||
shebang
|
||||
system_bindir
|
||||
trust-policy
|
||||
].freeze
|
||||
|
||||
DEFAULT_CONFIG = {
|
||||
"BUNDLE_SILENCE_DEPRECATIONS" => false,
|
||||
"BUNDLE_DISABLE_VERSION_CHECK" => true,
|
||||
|
@ -125,8 +145,8 @@ module Bundler
|
|||
keys = @temporary.keys | @global_config.keys | @local_config.keys | @env_config.keys
|
||||
|
||||
keys.map do |key|
|
||||
key.sub(/^BUNDLE_/, "").gsub(/__/, ".").downcase
|
||||
end
|
||||
key.sub(/^BUNDLE_/, "").gsub(/___/, "-").gsub(/__/, ".").downcase
|
||||
end.sort
|
||||
end
|
||||
|
||||
def local_overrides
|
||||
|
@ -172,19 +192,19 @@ module Bundler
|
|||
locations = []
|
||||
|
||||
if value = @temporary[key]
|
||||
locations << "Set for the current command: #{converted_value(value, exposed_key).inspect}"
|
||||
locations << "Set for the current command: #{printable_value(value, exposed_key).inspect}"
|
||||
end
|
||||
|
||||
if value = @local_config[key]
|
||||
locations << "Set for your local app (#{local_config_file}): #{converted_value(value, exposed_key).inspect}"
|
||||
locations << "Set for your local app (#{local_config_file}): #{printable_value(value, exposed_key).inspect}"
|
||||
end
|
||||
|
||||
if value = @env_config[key]
|
||||
locations << "Set via #{key}: #{converted_value(value, exposed_key).inspect}"
|
||||
locations << "Set via #{key}: #{printable_value(value, exposed_key).inspect}"
|
||||
end
|
||||
|
||||
if value = @global_config[key]
|
||||
locations << "Set for the current user (#{global_config_file}): #{converted_value(value, exposed_key).inspect}"
|
||||
locations << "Set for the current user (#{global_config_file}): #{printable_value(value, exposed_key).inspect}"
|
||||
end
|
||||
|
||||
return ["You have not configured a value for `#{exposed_key}`"] if locations.empty?
|
||||
|
@ -276,9 +296,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def key_for(key)
|
||||
key = Settings.normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
|
||||
key = key.to_s.gsub(".", "__").upcase
|
||||
"BUNDLE_#{key}"
|
||||
self.class.key_for(key)
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -313,6 +331,10 @@ module Bundler
|
|||
BOOL_KEYS.include?(name.to_s) || BOOL_KEYS.include?(parent_setting_for(name.to_s))
|
||||
end
|
||||
|
||||
def is_string(name)
|
||||
STRING_KEYS.include?(name.to_s) || name.to_s.start_with?("local.") || name.to_s.start_with?("mirror.") || name.to_s.start_with?("build.")
|
||||
end
|
||||
|
||||
def to_bool(value)
|
||||
case value
|
||||
when nil, /\A(false|f|no|n|0|)\z/i, false
|
||||
|
@ -330,6 +352,14 @@ module Bundler
|
|||
ARRAY_KEYS.include?(key.to_s)
|
||||
end
|
||||
|
||||
def is_credential(key)
|
||||
key == "gem.push_key"
|
||||
end
|
||||
|
||||
def is_userinfo(value)
|
||||
value.include?(":")
|
||||
end
|
||||
|
||||
def to_array(value)
|
||||
return [] unless value
|
||||
value.split(":").map(&:to_sym)
|
||||
|
@ -376,6 +406,21 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def printable_value(value, key)
|
||||
converted = converted_value(value, key)
|
||||
return converted unless converted.is_a?(String)
|
||||
|
||||
if is_string(key)
|
||||
converted
|
||||
elsif is_credential(key)
|
||||
"[REDACTED]"
|
||||
elsif is_userinfo(converted)
|
||||
converted.gsub(/:.*$/, ":[REDACTED]")
|
||||
else
|
||||
converted
|
||||
end
|
||||
end
|
||||
|
||||
def global_config_file
|
||||
if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
|
||||
Pathname.new(ENV["BUNDLE_CONFIG"])
|
||||
|
@ -415,6 +460,12 @@ module Bundler
|
|||
\z
|
||||
/ix.freeze
|
||||
|
||||
def self.key_for(key)
|
||||
key = normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
|
||||
key = key.to_s.gsub(".", "__").gsub("-", "___").upcase
|
||||
"BUNDLE_#{key}"
|
||||
end
|
||||
|
||||
# TODO: duplicates Rubygems#normalize_uri
|
||||
# TODO: is this the correct place to validate mirror URIs?
|
||||
def self.normalize_uri(uri)
|
||||
|
|
|
@ -423,11 +423,11 @@ module Bundler
|
|||
def fetch_names(fetchers, dependency_names, index, override_dupes)
|
||||
fetchers.each do |f|
|
||||
if dependency_names
|
||||
Bundler.ui.info "Fetching gem metadata from #{f.uri}", Bundler.ui.debug?
|
||||
Bundler.ui.info "Fetching gem metadata from #{URICredentialsFilter.credential_filtered_uri(f.uri)}", Bundler.ui.debug?
|
||||
index.use f.specs_with_retry(dependency_names, self), override_dupes
|
||||
Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
|
||||
else
|
||||
Bundler.ui.info "Fetching source index from #{f.uri}"
|
||||
Bundler.ui.info "Fetching source index from #{URICredentialsFilter.credential_filtered_uri(f.uri)}"
|
||||
index.use f.specs_with_retry(nil, self), override_dupes
|
||||
end
|
||||
end
|
||||
|
|
|
@ -78,11 +78,17 @@ module Bundler
|
|||
|
||||
def materialize(deps, missing_specs = nil)
|
||||
materialized = self.for(deps, [], false, true, !missing_specs).to_a
|
||||
deps = materialized.map(&:name).uniq
|
||||
|
||||
materialized.group_by(&:source).each do |source, specs|
|
||||
next unless specs.any?{|s| s.is_a?(LazySpecification) }
|
||||
|
||||
source.local!
|
||||
names = -> { specs.map(&:name).uniq }
|
||||
source.double_check_for(names)
|
||||
end
|
||||
|
||||
materialized.map! do |s|
|
||||
next s unless s.is_a?(LazySpecification)
|
||||
s.source.dependency_names = deps if s.source.respond_to?(:dependency_names=)
|
||||
s.source.local!
|
||||
spec = s.__materialize__
|
||||
unless spec
|
||||
unless missing_specs
|
||||
|
@ -99,12 +105,17 @@ module Bundler
|
|||
# This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
|
||||
# @return [Array<Gem::Specification>]
|
||||
def materialized_for_all_platforms
|
||||
names = @specs.map(&:name).uniq
|
||||
@specs.group_by(&:source).each do |source, specs|
|
||||
next unless specs.any?{|s| s.is_a?(LazySpecification) }
|
||||
|
||||
source.local!
|
||||
source.remote!
|
||||
names = -> { specs.map(&:name).uniq }
|
||||
source.double_check_for(names)
|
||||
end
|
||||
|
||||
@specs.map do |s|
|
||||
next s unless s.is_a?(LazySpecification)
|
||||
s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
|
||||
s.source.local!
|
||||
s.source.remote!
|
||||
spec = s.__materialize__
|
||||
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
||||
spec
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
source "https://rubygems.org"
|
||||
|
||||
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
||||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
||||
|
||||
# gem "rails"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
# A sample gems.rb
|
||||
source "https://rubygems.org"
|
||||
|
||||
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
||||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
||||
|
||||
# gem "rails"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Bundler::Molinillo
|
||||
# Provides information about specifcations and dependencies to the resolver,
|
||||
# Provides information about specifications and dependencies to the resolver,
|
||||
# allowing the {Resolver} class to remain generic while still providing power
|
||||
# and flexibility.
|
||||
#
|
||||
|
|
|
@ -252,7 +252,7 @@ class Bundler::Thor
|
|||
# flag<Regexp|String>:: the regexp or string to be replaced
|
||||
# replacement<String>:: the replacement, can be also given as a block
|
||||
# config<Hash>:: give :verbose => false to not log the status, and
|
||||
# :force => true, to force the replacement regardles of runner behavior.
|
||||
# :force => true, to force the replacement regardless of runner behavior.
|
||||
#
|
||||
# ==== Example
|
||||
#
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: false
|
||||
|
||||
module Bundler
|
||||
VERSION = "2.2.16".freeze
|
||||
VERSION = "2.2.17".freeze
|
||||
|
||||
def self.bundler_major_version
|
||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
require 'rbconfig'
|
||||
|
||||
module Gem
|
||||
VERSION = "3.2.16".freeze
|
||||
VERSION = "3.2.17".freeze
|
||||
end
|
||||
|
||||
# Must be first since it unloads the prelude from 1.9.2
|
||||
|
@ -626,7 +626,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
# Try requiring the gem version *or* stdlib version of psych.
|
||||
require 'psych'
|
||||
rescue ::LoadError
|
||||
# If we can't load psych, thats fine, go on.
|
||||
# If we can't load psych, that's fine, go on.
|
||||
else
|
||||
# If 'yaml' has already been required, then we have to
|
||||
# be sure to switch it over to the newly loaded psych.
|
||||
|
@ -813,7 +813,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(path, 'wb') do |io|
|
||||
File.open(path, 'wb') do |io|
|
||||
begin
|
||||
io.flock(File::LOCK_EX)
|
||||
rescue *WRITE_BINARY_ERRORS
|
||||
|
@ -824,7 +824,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|||
if Thread.main != Thread.current
|
||||
raise
|
||||
else
|
||||
open(path, 'wb') do |io|
|
||||
File.open(path, 'wb') do |io|
|
||||
io.write data
|
||||
end
|
||||
end
|
||||
|
|
|
@ -127,7 +127,7 @@ You can use `i` command instead of `install`.
|
|||
end
|
||||
|
||||
def usage # :nodoc:
|
||||
"#{program_name} GEMNAME [GEMNAME ...] [options] -- --build-flags"
|
||||
"#{program_name} [options] GEMNAME [GEMNAME ...] -- --build-flags"
|
||||
end
|
||||
|
||||
def check_install_dir # :nodoc:
|
||||
|
|
|
@ -36,7 +36,7 @@ class Gem::Commands::OpenCommand < Gem::Command
|
|||
end
|
||||
|
||||
def usage # :nodoc:
|
||||
"#{program_name} GEMNAME [-e COMMAND]"
|
||||
"#{program_name} [-e COMMAND] GEMNAME"
|
||||
end
|
||||
|
||||
def get_env_editor
|
||||
|
|
|
@ -24,7 +24,7 @@ data you will need to change them immediately and yank your gem.
|
|||
end
|
||||
|
||||
def usage # :nodoc:
|
||||
"#{program_name} GEM -v VERSION [-p PLATFORM] [--key KEY_NAME] [--host HOST]"
|
||||
"#{program_name} -v VERSION [-p PLATFORM] [--key KEY_NAME] [--host HOST] GEM"
|
||||
end
|
||||
|
||||
def initialize
|
||||
|
|
|
@ -198,7 +198,7 @@ module Gem
|
|||
|
||||
def self.default_bindir
|
||||
if defined? RUBY_FRAMEWORK_VERSION # mac framework support
|
||||
'/usr/bin'
|
||||
'/usr/local/bin'
|
||||
else # generic install
|
||||
RbConfig::CONFIG['bindir']
|
||||
end
|
||||
|
|
|
@ -60,12 +60,13 @@ module Gem::Deprecate
|
|||
target = klass ? "#{self}." : "#{self.class}#"
|
||||
msg = [ "NOTE: #{target}#{name} is deprecated",
|
||||
repl == :none ? " with no replacement" : "; use #{repl} instead",
|
||||
". It will be removed on or after %4d-%02d-01." % [year, month],
|
||||
". It will be removed on or after %4d-%02d." % [year, month],
|
||||
"\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}",
|
||||
]
|
||||
warn "#{msg.join}." unless Gem::Deprecate.skip
|
||||
send old, *args, &block
|
||||
end
|
||||
ruby2_keywords name if respond_to?(:ruby2_keywords, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -90,6 +91,7 @@ module Gem::Deprecate
|
|||
warn "#{msg.join}." unless Gem::Deprecate.skip
|
||||
send old, *args, &block
|
||||
end
|
||||
ruby2_keywords name if respond_to?(:ruby2_keywords, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ class Gem::Indexer
|
|||
say "Generating #{name} index"
|
||||
|
||||
Gem.time "Generated #{name} index" do
|
||||
open(file, 'wb') do |io|
|
||||
File.open(file, 'wb') do |io|
|
||||
specs = index.map do |*spec|
|
||||
# We have to splat here because latest_specs is an array, while the
|
||||
# others are hashes.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Gem::Resolver::Molinillo
|
||||
# Provides information about specifcations and dependencies to the resolver,
|
||||
# Provides information about specifications and dependencies to the resolver,
|
||||
# allowing the {Resolver} class to remain generic while still providing power
|
||||
# and flexibility.
|
||||
#
|
||||
|
|
|
@ -76,7 +76,7 @@ class Gem::FakeFetcher
|
|||
|
||||
def cache_update_path(uri, path = nil, update = true)
|
||||
if data = fetch_path(uri)
|
||||
open(path, 'wb') {|io| io.write data } if path and update
|
||||
File.open(path, 'wb') {|io| io.write data } if path and update
|
||||
data
|
||||
else
|
||||
Gem.read_binary(path) if path
|
||||
|
|
|
@ -38,7 +38,6 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
|
|||
|
||||
context "when bundler doesn't have permissions on Dir.tmpdir" do
|
||||
it "Errno::EACCES is raised" do
|
||||
local_path # create local path before stubbing mktmpdir
|
||||
allow(Bundler::Dir).to receive(:mktmpdir) { raise Errno::EACCES }
|
||||
|
||||
expect do
|
||||
|
|
|
@ -112,6 +112,20 @@ RSpec.describe Bundler::Env do
|
|||
end
|
||||
end
|
||||
|
||||
context "when there's bundler config with credentials" do
|
||||
before do
|
||||
bundle "config set https://localgemserver.test/ user:pass"
|
||||
end
|
||||
|
||||
let(:output) { described_class.report(:print_gemfile => true) }
|
||||
|
||||
it "prints the config with redacted values" do
|
||||
expect(output).to include("https://localgemserver.test")
|
||||
expect(output).to include("user:[REDACTED]")
|
||||
expect(output).to_not include("user:pass")
|
||||
end
|
||||
end
|
||||
|
||||
context "when Gemfile contains a gemspec and print_gemspecs is true" do
|
||||
let(:gemspec) do
|
||||
strip_whitespace(<<-GEMSPEC)
|
||||
|
|
|
@ -83,6 +83,11 @@ RSpec.describe Bundler::Fetcher::Downloader do
|
|||
/Authentication is required for www.uri-to-fetch.com/)
|
||||
end
|
||||
|
||||
it "should raise a Bundler::Fetcher::AuthenticationRequiredError with advices" do
|
||||
expect { subject.fetch(uri, options, counter) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError,
|
||||
/`bundle config set --global www\.uri-to-fetch\.com username:password`.*`BUNDLE_WWW__URI___TO___FETCH__COM`/m)
|
||||
end
|
||||
|
||||
context "when the there are credentials provided in the request" do
|
||||
let(:uri) { Bundler::URI("http://user:password@www.uri-to-fetch.com") }
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ RSpec.describe Bundler::Plugin::DSL do
|
|||
expect(dsl.inferred_plugins).to eq(["bundler-source-news"])
|
||||
end
|
||||
|
||||
it "registers a source type plugin only once for multiple declataions" do
|
||||
it "registers a source type plugin only once for multiple declarations" do
|
||||
expect(dsl).to receive(:plugin).with("bundler-source-news").and_call_original.once
|
||||
|
||||
dsl.source("some_random_url", :type => "news") {}
|
||||
|
|
|
@ -22,7 +22,7 @@ RSpec.describe Bundler::Plugin::Index do
|
|||
expect(index.plugin_path(plugin_name)).to eq(lib_path(plugin_name))
|
||||
end
|
||||
|
||||
it "load_paths is available for retrival" do
|
||||
it "load_paths is available for retrieval" do
|
||||
expect(index.load_paths(plugin_name)).to eq([lib_path(plugin_name).join("lib").to_s])
|
||||
end
|
||||
|
||||
|
|
|
@ -255,6 +255,21 @@ RSpec.describe "bundle cache" do
|
|||
expect(the_bundle).to include_gem "rack 1.0"
|
||||
expect(the_bundle).not_to include_gems "weakling", "uninstallable"
|
||||
end
|
||||
|
||||
it "does not fail to cache gems in excluded groups when there's a lockfile but gems not previously installed" do
|
||||
bundle "config set --local without wo"
|
||||
gemfile <<-G
|
||||
source "https://my.gem.repo.1"
|
||||
gem "rack"
|
||||
group :wo do
|
||||
gem "weakling"
|
||||
end
|
||||
G
|
||||
|
||||
bundle :lock, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s }
|
||||
bundle :cache, "all-platforms" => true, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s }
|
||||
expect(bundled_app("vendor/cache/weakling-0.0.3.gem")).to exist
|
||||
end
|
||||
end
|
||||
|
||||
context "with frozen configured" do
|
||||
|
|
|
@ -408,6 +408,14 @@ E
|
|||
expect(out).to eq "spec_run=true"
|
||||
end
|
||||
|
||||
it "list with credentials" do
|
||||
bundle "config list", :env => { "BUNDLE_GEMS__MYSERVER__COM" => "user:password" }
|
||||
expect(out).to eq "Settings are listed in order of priority. The top value will be used.\ngems.myserver.com\nSet via BUNDLE_GEMS__MYSERVER__COM: \"user:[REDACTED]\"\n\nspec_run\nSet via BUNDLE_SPEC_RUN: \"true\""
|
||||
|
||||
bundle "config list", :parseable => true, :env => { "BUNDLE_GEMS__MYSERVER__COM" => "user:password" }
|
||||
expect(out).to eq "gems.myserver.com=user:password\nspec_run=true"
|
||||
end
|
||||
|
||||
it "get" do
|
||||
ENV["BUNDLE_BAR"] = "bar_val"
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ RSpec.describe "bundle gem" do
|
|||
expect(bundled_app("#{gem_name}/README.md").read).to match(%r{https://github\.com/bundleuser/#{gem_name}/blob/.*/CODE_OF_CONDUCT.md})
|
||||
end
|
||||
|
||||
it "generates the README with a section for the Code of Conduct, respecting the configured git default branch" do
|
||||
it "generates the README with a section for the Code of Conduct, respecting the configured git default branch", :git => ">= 2.28.0" do
|
||||
sys_exec("git config --global init.defaultBranch main")
|
||||
bundle "gem #{gem_name} --coc"
|
||||
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "bundle outdated" do
|
||||
before :each do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
describe "with no arguments" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
end
|
||||
|
||||
describe "with no arguments" do
|
||||
it "returns a sorted list of outdated gems" do
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "3.0"
|
||||
|
@ -102,6 +102,23 @@ RSpec.describe "bundle outdated" do
|
|||
end
|
||||
|
||||
describe "with --verbose option" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
end
|
||||
|
||||
it "shows the location of the latest version's gemspec if installed" do
|
||||
bundle "config set clean false"
|
||||
|
||||
|
@ -134,8 +151,79 @@ RSpec.describe "bundle outdated" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "with multiple, duplicated sources, with lockfile in old format", :bundler => "< 3" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_gem "dotenv", "2.7.6"
|
||||
|
||||
build_gem "oj", "3.11.3"
|
||||
build_gem "oj", "3.11.5"
|
||||
|
||||
build_gem "vcr", "6.0.0"
|
||||
end
|
||||
|
||||
build_repo gem_repo3 do
|
||||
build_gem "pkg-gem-flowbyte-with-dep", "1.0.0" do |s|
|
||||
s.add_dependency "oj"
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<~G
|
||||
source "https://gem.repo2"
|
||||
|
||||
gem "dotenv"
|
||||
|
||||
source "https://gem.repo3" do
|
||||
gem 'pkg-gem-flowbyte-with-dep'
|
||||
end
|
||||
|
||||
gem "vcr",source: "https://gem.repo2"
|
||||
G
|
||||
|
||||
lockfile <<~L
|
||||
GEM
|
||||
remote: https://gem.repo2/
|
||||
remote: https://gem.repo3/
|
||||
specs:
|
||||
dotenv (2.7.6)
|
||||
oj (3.11.3)
|
||||
pkg-gem-flowbyte-with-dep (1.0.0)
|
||||
oj
|
||||
vcr (6.0.0)
|
||||
|
||||
PLATFORMS
|
||||
#{specific_local_platform}
|
||||
|
||||
DEPENDENCIES
|
||||
dotenv
|
||||
pkg-gem-flowbyte-with-dep!
|
||||
vcr!
|
||||
|
||||
BUNDLED WITH
|
||||
#{Bundler::VERSION}
|
||||
L
|
||||
end
|
||||
|
||||
it "works" do
|
||||
bundle :install, :artifice => :compact_index
|
||||
bundle :outdated, :artifice => :compact_index, :raise_on_error => false
|
||||
|
||||
expected_output = <<~TABLE
|
||||
Gem Current Latest Requested Groups
|
||||
oj 3.11.3 3.11.5
|
||||
TABLE
|
||||
|
||||
expect(out).to include(expected_output.strip)
|
||||
end
|
||||
end
|
||||
|
||||
describe "with --group option" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
||||
|
@ -201,7 +289,10 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
describe "with --groups option and outdated transitive dependencies" do
|
||||
before do
|
||||
update_repo2 do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
|
||||
build_gem "bar", %w[2.0.0]
|
||||
|
||||
build_gem "bar_dependant", "7.0" do |s|
|
||||
|
@ -234,6 +325,11 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
describe "with --groups option" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
||||
|
@ -272,6 +368,24 @@ RSpec.describe "bundle outdated" do
|
|||
end
|
||||
|
||||
describe "with --local option" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "terranova", '8'
|
||||
group :development, :test do
|
||||
gem 'activesupport', '2.3.5'
|
||||
gem "duradura", '7.0'
|
||||
end
|
||||
G
|
||||
end
|
||||
|
||||
it "uses local cache to return a list of outdated gems" do
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "2.3.4"
|
||||
|
@ -305,10 +419,23 @@ RSpec.describe "bundle outdated" do
|
|||
shared_examples_for "a minimal output is desired" do
|
||||
context "and gems are outdated" do
|
||||
before do
|
||||
update_repo2 do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
|
||||
build_gem "activesupport", "3.0"
|
||||
build_gem "weakling", "0.2"
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
end
|
||||
|
||||
it "outputs a sorted list of outdated gems with a more minimal format" do
|
||||
|
@ -341,6 +468,21 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
describe "with specified gems" do
|
||||
it "returns list of outdated gems" do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "3.0"
|
||||
update_git "foo", :path => lib_path("foo")
|
||||
|
@ -358,6 +500,23 @@ RSpec.describe "bundle outdated" do
|
|||
end
|
||||
|
||||
describe "pre-release gems" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
end
|
||||
|
||||
context "without the --pre option" do
|
||||
it "ignores pre-release versions" do
|
||||
update_repo2 do
|
||||
|
@ -413,6 +572,23 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
filter_strict_option = Bundler.feature_flag.bundler_2_mode? ? :"filter-strict" : :strict
|
||||
describe "with --#{filter_strict_option} option" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
end
|
||||
|
||||
it "only reports gems that have a newer version that matches the specified dependency version requirements" do
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "3.0"
|
||||
|
@ -521,6 +697,23 @@ RSpec.describe "bundle outdated" do
|
|||
end
|
||||
|
||||
describe "with invalid gem name" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
end
|
||||
|
||||
it "returns could not find gem name" do
|
||||
bundle "outdated invalid_gem_name", :raise_on_error => false
|
||||
expect(err).to include("Could not find gem 'invalid_gem_name'.")
|
||||
|
@ -546,12 +739,16 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
context "after bundle install --deployment", :bundler => "< 3" do
|
||||
before do
|
||||
install_gemfile <<-G, :deployment => true, :raise_on_error => false
|
||||
build_repo2
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
||||
gem "rack"
|
||||
gem "foo"
|
||||
G
|
||||
bundle :lock
|
||||
bundle :install, :deployment => true
|
||||
end
|
||||
|
||||
it "outputs a helpful message about being in deployment mode" do
|
||||
|
@ -568,6 +765,11 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
context "after bundle config set --local deployment true" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
||||
|
@ -591,6 +793,8 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
context "update available for a gem on a different platform" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "laduradura", '= 5.15.2'
|
||||
|
@ -604,6 +808,10 @@ RSpec.describe "bundle outdated" do
|
|||
end
|
||||
|
||||
context "update available for a gem on the same platform while multiple platforms used for gem" do
|
||||
before do
|
||||
build_repo2
|
||||
end
|
||||
|
||||
it "reports that updates are available if the Ruby platform is used" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
@ -643,6 +851,21 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
shared_examples_for "major version updates are detected" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "3.3.5"
|
||||
build_gem "weakling", "0.8.0"
|
||||
|
@ -654,6 +877,21 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
context "when on a new machine" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
|
||||
simulate_new_machine
|
||||
|
||||
update_git "foo", :path => lib_path("foo")
|
||||
|
@ -669,6 +907,21 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
shared_examples_for "minor version updates are detected" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "2.7.5"
|
||||
build_gem "weakling", "2.0.1"
|
||||
|
@ -680,6 +933,21 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
shared_examples_for "patch version updates are detected" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "2.3.7"
|
||||
build_gem "weakling", "0.3.1"
|
||||
|
@ -698,6 +966,21 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
shared_examples_for "major version is ignored" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "3.3.5"
|
||||
build_gem "weakling", "1.0.1"
|
||||
|
@ -709,6 +992,21 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
shared_examples_for "minor version is ignored" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "2.4.5"
|
||||
build_gem "weakling", "0.3.1"
|
||||
|
@ -720,6 +1018,21 @@ RSpec.describe "bundle outdated" do
|
|||
|
||||
shared_examples_for "patch version is ignored" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_git "foo", :path => lib_path("foo")
|
||||
build_git "zebra", :path => lib_path("zebra")
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "zebra", :git => "#{lib_path("zebra")}"
|
||||
gem "foo", :git => "#{lib_path("foo")}"
|
||||
gem "activesupport", "2.3.5"
|
||||
gem "weakling", "~> 0.0.1"
|
||||
gem "duradura", '7.0'
|
||||
gem "terranova", '8'
|
||||
G
|
||||
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "2.3.6"
|
||||
build_gem "weakling", "0.0.4"
|
||||
|
|
|
@ -203,6 +203,16 @@ RSpec.describe "bundle pristine", :ruby_repo do
|
|||
end
|
||||
end
|
||||
|
||||
context "when BUNDLE_GEMFILE doesn't exist" do
|
||||
before do
|
||||
bundle "pristine", :env => { "BUNDLE_GEMFILE" => "does/not/exist" }, :raise_on_error => false
|
||||
end
|
||||
|
||||
it "shows a meaningful error" do
|
||||
expect(err).to eq("#{bundled_app("does/not/exist")} not found")
|
||||
end
|
||||
end
|
||||
|
||||
def find_spec(name)
|
||||
without_env_side_effects do
|
||||
Bundler.definition.specs[name].first
|
||||
|
|
|
@ -229,7 +229,7 @@ RSpec.describe "bundle remove" do
|
|||
end
|
||||
end
|
||||
|
||||
context "when the gem is present in mutiple groups" do
|
||||
context "when the gem is present in multiple groups" do
|
||||
it "removes all empty blocks" do
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
|
@ -333,7 +333,7 @@ RSpec.describe "bundle remove" do
|
|||
end
|
||||
|
||||
describe "arbitrary gemfile" do
|
||||
context "when mutiple gems are present in same line" do
|
||||
context "when multiple gems are present in same line" do
|
||||
it "shows warning for gems not removed" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "bundle update" do
|
||||
before :each do
|
||||
build_repo2
|
||||
describe "with no arguments" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
gem "rack-obama"
|
||||
gem "platform_specific"
|
||||
G
|
||||
end
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
gem "rack-obama"
|
||||
gem "platform_specific"
|
||||
G
|
||||
end
|
||||
|
||||
describe "with no arguments", :bundler => "< 3" do
|
||||
it "updates the entire bundle" do
|
||||
update_repo2 do
|
||||
build_gem "rack", "1.2" do |s|
|
||||
|
@ -39,7 +39,18 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "with --all", :bundler => "3" do
|
||||
describe "with --all" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
gem "rack-obama"
|
||||
gem "platform_specific"
|
||||
G
|
||||
end
|
||||
|
||||
it "updates the entire bundle" do
|
||||
update_repo2 do
|
||||
build_gem "rack", "1.2" do |s|
|
||||
|
@ -55,6 +66,8 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
it "doesn't delete the Gemfile.lock file if something goes wrong" do
|
||||
install_gemfile ""
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
|
@ -102,6 +115,17 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
describe "--quiet argument" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
gem "rack-obama"
|
||||
gem "platform_specific"
|
||||
G
|
||||
end
|
||||
|
||||
it "hides UI messages" do
|
||||
bundle "update --quiet"
|
||||
expect(out).not_to include("Bundle updated!")
|
||||
|
@ -109,6 +133,17 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
describe "with a top level dependency" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
gem "rack-obama"
|
||||
gem "platform_specific"
|
||||
G
|
||||
end
|
||||
|
||||
it "unlocks all child dependencies that are unrelated to other locked dependencies" do
|
||||
update_repo2 do
|
||||
build_gem "rack", "1.2" do |s|
|
||||
|
@ -124,6 +159,17 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
describe "with an unknown dependency" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
gem "rack-obama"
|
||||
gem "platform_specific"
|
||||
G
|
||||
end
|
||||
|
||||
it "should inform the user" do
|
||||
bundle "update halting-problem-solver", :raise_on_error => false
|
||||
expect(err).to include "Could not find gem 'halting-problem-solver'"
|
||||
|
@ -135,6 +181,17 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
describe "with a child dependency" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
gem "rack-obama"
|
||||
gem "platform_specific"
|
||||
G
|
||||
end
|
||||
|
||||
it "should update the child dependency" do
|
||||
update_repo2 do
|
||||
build_gem "rack", "1.2" do |s|
|
||||
|
@ -212,6 +269,17 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
describe "with --local option" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
gem "rack-obama"
|
||||
gem "platform_specific"
|
||||
G
|
||||
end
|
||||
|
||||
it "doesn't hit repo2" do
|
||||
FileUtils.rm_rf(gem_repo2)
|
||||
|
||||
|
@ -221,6 +289,10 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
describe "with --group option" do
|
||||
before do
|
||||
build_repo2
|
||||
end
|
||||
|
||||
it "should update only specified group gems" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
@ -257,7 +329,7 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
context "when there is a source with the same name as a gem in a group" do
|
||||
before :each do
|
||||
before do
|
||||
build_git "foo", :path => lib_path("activesupport")
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
@ -299,6 +371,17 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
describe "in a frozen bundle" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
gem "rack-obama"
|
||||
gem "platform_specific"
|
||||
G
|
||||
end
|
||||
|
||||
it "should fail loudly", :bundler => "< 3" do
|
||||
bundle "install --deployment"
|
||||
bundle "update", :all => true, :raise_on_error => false
|
||||
|
@ -324,6 +407,10 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
describe "with --source option" do
|
||||
before do
|
||||
build_repo2
|
||||
end
|
||||
|
||||
it "should not update gems not included in the source that happen to have the same name", :bundler => "< 3" do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
@ -449,10 +536,130 @@ RSpec.describe "bundle update" do
|
|||
expect(the_bundle).to include_gems "harry 1.0", "fred 1.0", "george 1.0"
|
||||
end
|
||||
end
|
||||
|
||||
it "shows the previous version of the gem when updated from rubygems source", :bundler => "< 3" do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
G
|
||||
|
||||
bundle "update", :all => true
|
||||
expect(out).to include("Using activesupport 2.3.5")
|
||||
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "3.0"
|
||||
end
|
||||
|
||||
bundle "update", :all => true
|
||||
expect(out).to include("Installing activesupport 3.0 (was 2.3.5)")
|
||||
end
|
||||
|
||||
context "with suppress_install_using_messages set" do
|
||||
before { bundle "config set suppress_install_using_messages true" }
|
||||
|
||||
it "only prints `Using` for versions that have changed" do
|
||||
build_repo4 do
|
||||
build_gem "bar"
|
||||
build_gem "foo"
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
gem "bar"
|
||||
gem "foo"
|
||||
G
|
||||
|
||||
bundle "update", :all => true
|
||||
expect(out).to match(/Resolving dependencies\.\.\.\.*\nBundle updated!/)
|
||||
|
||||
update_repo4 do
|
||||
build_gem "foo", "2.0"
|
||||
end
|
||||
|
||||
bundle "update", :all => true
|
||||
out.sub!("Removing foo (1.0)\n", "")
|
||||
expect(out).to match(/Resolving dependencies\.\.\.\.*\nFetching foo 2\.0 \(was 1\.0\)\nInstalling foo 2\.0 \(was 1\.0\)\nBundle updated/)
|
||||
end
|
||||
end
|
||||
|
||||
it "shows error message when Gemfile.lock is not preset and gem is specified" do
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
G
|
||||
|
||||
bundle "update nonexisting", :raise_on_error => false
|
||||
expect(err).to include("This Bundle hasn't been installed yet. Run `bundle install` to update and install the bundled gems.")
|
||||
expect(exitstatus).to eq(22)
|
||||
end
|
||||
|
||||
context "with multiple, duplicated sources, with lockfile in old format", :bundler => "< 3" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_gem "dotenv", "2.7.6"
|
||||
|
||||
build_gem "oj", "3.11.3"
|
||||
build_gem "oj", "3.11.5"
|
||||
|
||||
build_gem "vcr", "6.0.0"
|
||||
end
|
||||
|
||||
build_repo gem_repo3 do
|
||||
build_gem "pkg-gem-flowbyte-with-dep", "1.0.0" do |s|
|
||||
s.add_dependency "oj"
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<~G
|
||||
source "https://gem.repo2"
|
||||
|
||||
gem "dotenv"
|
||||
|
||||
source "https://gem.repo3" do
|
||||
gem 'pkg-gem-flowbyte-with-dep'
|
||||
end
|
||||
|
||||
gem "vcr",source: "https://gem.repo2"
|
||||
G
|
||||
|
||||
lockfile <<~L
|
||||
GEM
|
||||
remote: https://gem.repo2/
|
||||
remote: https://gem.repo3/
|
||||
specs:
|
||||
dotenv (2.7.6)
|
||||
oj (3.11.3)
|
||||
pkg-gem-flowbyte-with-dep (1.0.0)
|
||||
oj
|
||||
vcr (6.0.0)
|
||||
|
||||
PLATFORMS
|
||||
#{specific_local_platform}
|
||||
|
||||
DEPENDENCIES
|
||||
dotenv
|
||||
pkg-gem-flowbyte-with-dep!
|
||||
vcr!
|
||||
|
||||
BUNDLED WITH
|
||||
#{Bundler::VERSION}
|
||||
L
|
||||
end
|
||||
|
||||
it "works" do
|
||||
bundle :install, :artifice => :compact_index
|
||||
bundle "update oj", :artifice => :compact_index
|
||||
|
||||
expect(out).to include("Bundle updated!")
|
||||
expect(the_bundle).to include_gems "oj 3.11.5"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.describe "bundle update in more complicated situations" do
|
||||
before :each do
|
||||
before do
|
||||
build_repo2
|
||||
end
|
||||
|
||||
|
@ -640,7 +847,7 @@ RSpec.describe "bundle update without a Gemfile.lock" do
|
|||
end
|
||||
|
||||
RSpec.describe "bundle update when a gem depends on a newer version of bundler" do
|
||||
before(:each) do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_gem "rails", "3.0.1" do |s|
|
||||
s.add_dependency "bundler", Bundler::VERSION.succ
|
||||
|
@ -663,66 +870,6 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler"
|
|||
end
|
||||
end
|
||||
|
||||
RSpec.describe "bundle update" do
|
||||
it "shows the previous version of the gem when updated from rubygems source", :bundler => "< 3" do
|
||||
build_repo2
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
G
|
||||
|
||||
bundle "update", :all => true
|
||||
expect(out).to include("Using activesupport 2.3.5")
|
||||
|
||||
update_repo2 do
|
||||
build_gem "activesupport", "3.0"
|
||||
end
|
||||
|
||||
bundle "update", :all => true
|
||||
expect(out).to include("Installing activesupport 3.0 (was 2.3.5)")
|
||||
end
|
||||
|
||||
context "with suppress_install_using_messages set" do
|
||||
before { bundle "config set suppress_install_using_messages true" }
|
||||
|
||||
it "only prints `Using` for versions that have changed" do
|
||||
build_repo4 do
|
||||
build_gem "bar"
|
||||
build_gem "foo"
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
gem "bar"
|
||||
gem "foo"
|
||||
G
|
||||
|
||||
bundle "update", :all => true
|
||||
expect(out).to match(/Resolving dependencies\.\.\.\.*\nBundle updated!/)
|
||||
|
||||
update_repo4 do
|
||||
build_gem "foo", "2.0"
|
||||
end
|
||||
|
||||
bundle "update", :all => true
|
||||
out.sub!("Removing foo (1.0)\n", "")
|
||||
expect(out).to match(/Resolving dependencies\.\.\.\.*\nFetching foo 2\.0 \(was 1\.0\)\nInstalling foo 2\.0 \(was 1\.0\)\nBundle updated/)
|
||||
end
|
||||
end
|
||||
|
||||
it "shows error message when Gemfile.lock is not preset and gem is specified" do
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "activesupport"
|
||||
G
|
||||
|
||||
bundle "update nonexisting", :raise_on_error => false
|
||||
expect(err).to include("This Bundle hasn't been installed yet. Run `bundle install` to update and install the bundled gems.")
|
||||
expect(exitstatus).to eq(22)
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.describe "bundle update --ruby" do
|
||||
before do
|
||||
install_gemfile <<-G
|
||||
|
|
|
@ -90,7 +90,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
gem "thin" # comes first to test name sorting
|
||||
gem "rack"
|
||||
end
|
||||
gem "rack-obama" # shoud come from repo3!
|
||||
gem "rack-obama" # should come from repo3!
|
||||
G
|
||||
end
|
||||
|
||||
|
@ -596,7 +596,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
L
|
||||
end
|
||||
|
||||
it "it keeps the currrent lockfile format and upgrades the requested gem when running bundle update with an argument, and warns", :bundler => "< 3" do
|
||||
it "it keeps the current lockfile format and upgrades the requested gem when running bundle update with an argument, and warns", :bundler => "< 3" do
|
||||
bundle "update concurrent-ruby"
|
||||
expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.")
|
||||
|
||||
|
@ -921,7 +921,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack" # shoud come from repo1!
|
||||
gem "rack" # should come from repo1!
|
||||
G
|
||||
end
|
||||
|
||||
|
@ -974,7 +974,10 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
context "re-resolving" do
|
||||
context "when there is a mix of sources in the gemfile" do
|
||||
before do
|
||||
build_repo3
|
||||
build_repo gem_repo3 do
|
||||
build_gem "rack"
|
||||
end
|
||||
|
||||
build_lib "path1"
|
||||
build_lib "path2"
|
||||
build_git "git1"
|
||||
|
|
|
@ -614,6 +614,17 @@ The checksum of /versions does not match the checksum provided by the server! So
|
|||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "passes basic authentication details and strips out creds also in verbose mode" do
|
||||
gemfile <<-G
|
||||
source "#{basic_auth_source_uri}"
|
||||
gem "rack"
|
||||
G
|
||||
|
||||
bundle :install, :verbose => true, :artifice => "compact_index_basic_authentication"
|
||||
expect(out).not_to include("#{user}:#{password}")
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do
|
||||
gemfile <<-G
|
||||
source "#{basic_auth_source_uri}"
|
||||
|
@ -815,6 +826,28 @@ The checksum of /versions does not match the checksum provided by the server! So
|
|||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "performs full update if server endpoints serve partial content responses but don't have incremental content and provide no Etag" do
|
||||
build_repo4 do
|
||||
build_gem "rack", "0.9.1"
|
||||
end
|
||||
|
||||
install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
|
||||
source "#{source_uri}"
|
||||
gem 'rack', '0.9.1'
|
||||
G
|
||||
|
||||
update_repo4 do
|
||||
build_gem "rack", "1.0.0"
|
||||
end
|
||||
|
||||
install_gemfile <<-G, :artifice => "compact_index_partial_update_no_etag_not_incremental", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
|
||||
source "#{source_uri}"
|
||||
gem 'rack', '1.0.0'
|
||||
G
|
||||
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "performs full update of compact index info cache if range is not satisfiable" do
|
||||
gemfile <<-G
|
||||
source "#{source_uri}"
|
||||
|
|
|
@ -586,6 +586,17 @@ RSpec.describe "gemcutter's dependency API" do
|
|||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "passes basic authentication details and strips out creds also in verbose mode" do
|
||||
gemfile <<-G
|
||||
source "#{basic_auth_source_uri}"
|
||||
gem "rack"
|
||||
G
|
||||
|
||||
bundle :install, :verbose => true, :artifice => "endpoint_basic_authentication"
|
||||
expect(out).not_to include("#{user}:#{password}")
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "strips http basic authentication creds for modern index" do
|
||||
gemfile <<-G
|
||||
source "#{basic_auth_source_uri}"
|
||||
|
@ -630,6 +641,22 @@ RSpec.describe "gemcutter's dependency API" do
|
|||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
describe "with host including dashes" do
|
||||
before do
|
||||
gemfile <<-G
|
||||
source "http://local-gemserver.test"
|
||||
gem "rack"
|
||||
G
|
||||
end
|
||||
|
||||
it "reads authentication details from a valid ENV variable" do
|
||||
bundle :install, :artifice => "endpoint_strict_basic_authentication", :env => { "BUNDLE_LOCAL___GEMSERVER__TEST" => "#{user}:#{password}" }
|
||||
|
||||
expect(out).to include("Fetching gem metadata from http://local-gemserver.test")
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
end
|
||||
|
||||
describe "with authentication details in bundle config" do
|
||||
before do
|
||||
gemfile <<-G
|
||||
|
|
|
@ -33,7 +33,7 @@ RSpec.describe "bundle install" do
|
|||
end
|
||||
end
|
||||
|
||||
context "when a dependecy includes a post install message" do
|
||||
context "when a dependency includes a post install message" do
|
||||
it "should display the post install message" do
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
|
|
|
@ -13,7 +13,7 @@ RSpec.describe "bundle install" do
|
|||
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
|
||||
end
|
||||
|
||||
it "displays the correct default branch" do
|
||||
it "displays the correct default branch", :git => ">= 2.28.0" do
|
||||
build_git "foo", "1.0", :path => lib_path("foo"), :default_branch => "main"
|
||||
|
||||
install_gemfile <<-G, :verbose => true
|
||||
|
|
|
@ -38,7 +38,11 @@ RSpec.describe "bundle install" do
|
|||
|
||||
describe "when prerelease gems are not available" do
|
||||
it "still works" do
|
||||
build_repo3
|
||||
build_repo gem_repo3 do
|
||||
build_gem "rack"
|
||||
end
|
||||
FileUtils.rm_rf Dir[gem_repo3("prerelease*")]
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo3)}"
|
||||
gem "rack"
|
||||
|
|
|
@ -171,9 +171,16 @@ RSpec.describe "The library itself" do
|
|||
exemptions = %w[
|
||||
deployment_means_frozen
|
||||
forget_cli_options
|
||||
gem.changelog
|
||||
gem.ci
|
||||
gem.coc
|
||||
gem.linter
|
||||
gem.mit
|
||||
gem.rubocop
|
||||
gem.test
|
||||
git.allow_insecure
|
||||
inline
|
||||
trust-policy
|
||||
use_gem_version_promoter_for_major_updates
|
||||
]
|
||||
|
||||
|
@ -183,6 +190,7 @@ RSpec.describe "The library itself" do
|
|||
Bundler::Settings::BOOL_KEYS.each {|k| all_settings[k] << "in Bundler::Settings::BOOL_KEYS" }
|
||||
Bundler::Settings::NUMBER_KEYS.each {|k| all_settings[k] << "in Bundler::Settings::NUMBER_KEYS" }
|
||||
Bundler::Settings::ARRAY_KEYS.each {|k| all_settings[k] << "in Bundler::Settings::ARRAY_KEYS" }
|
||||
Bundler::Settings::STRING_KEYS.each {|k| all_settings[k] << "in Bundler::Settings::STRING_KEYS" }
|
||||
|
||||
key_pattern = /([a-z\._-]+)/i
|
||||
lib_tracked_files.each do |filename|
|
||||
|
|
|
@ -246,6 +246,19 @@ RSpec.describe "bundler/inline#gemfile" do
|
|||
expect(last_command.stderr).to be_empty
|
||||
end
|
||||
|
||||
it "installs inline gems when deployment is set" do
|
||||
script <<-RUBY, :env => { "BUNDLE_DEPLOYMENT" => "true" }
|
||||
gemfile do
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack"
|
||||
end
|
||||
|
||||
puts RACK
|
||||
RUBY
|
||||
|
||||
expect(last_command.stderr).to be_empty
|
||||
end
|
||||
|
||||
it "installs inline gems when BUNDLE_GEMFILE is set to an empty string" do
|
||||
ENV["BUNDLE_GEMFILE"] = ""
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class CompactIndexAPI < Endpoint
|
|||
body.byteslice(range)
|
||||
end
|
||||
|
||||
def gems(gem_repo = GEM_REPO)
|
||||
def gems(gem_repo = default_gem_repo)
|
||||
@gems ||= {}
|
||||
@gems[gem_repo] ||= begin
|
||||
specs = Bundler::Deprecate.skip_during do
|
||||
|
@ -80,7 +80,7 @@ class CompactIndexAPI < Endpoint
|
|||
CompactIndex::Dependency.new(d.name, reqs)
|
||||
end
|
||||
checksum = begin
|
||||
Digest(:SHA256).file("#{GEM_REPO}/gems/#{spec.original_name}.gem").base64digest
|
||||
Digest(:SHA256).file("#{gem_repo}/gems/#{spec.original_name}.gem").base64digest
|
||||
rescue StandardError
|
||||
nil
|
||||
end
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative "compact_index"
|
||||
|
||||
Artifice.deactivate
|
||||
|
||||
class CompactIndexPartialUpdateNoEtagNotIncremental < CompactIndexAPI
|
||||
def partial_update_no_etag
|
||||
response_body = yield
|
||||
headers "Surrogate-Control" => "max-age=2592000, stale-while-revalidate=60"
|
||||
content_type "text/plain"
|
||||
requested_range_for(response_body)
|
||||
end
|
||||
|
||||
get "/versions" do
|
||||
partial_update_no_etag do
|
||||
file = tmp("versions.list")
|
||||
FileUtils.rm_f(file)
|
||||
file = CompactIndex::VersionsFile.new(file.to_s)
|
||||
file.create(gems)
|
||||
lines = file.contents([], :calculate_info_checksums => true).split("\n")
|
||||
name, versions, checksum = lines.last.split(" ")
|
||||
|
||||
# shuffle versions so new versions are not appended to the end
|
||||
[*lines[0..-2], [name, versions.split(",").reverse.join(","), checksum].join(" ")].join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
get "/info/:name" do
|
||||
partial_update_no_etag do
|
||||
gem = gems.find {|g| g.name == params[:name] }
|
||||
lines = CompactIndex.info(gem ? gem.versions : []).split("\n")
|
||||
|
||||
# shuffle versions so new versions are not appended to the end
|
||||
[lines.first, lines.last, *lines[1..-2]].join("\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Artifice.activate_with(CompactIndexPartialUpdateNoEtagNotIncremental)
|
|
@ -26,7 +26,6 @@ class Endpoint < Sinatra::Base
|
|||
@all_requests ||= []
|
||||
end
|
||||
|
||||
GEM_REPO = Pathname.new(ENV["BUNDLER_SPEC_GEM_REPO"] || Spec::Path.gem_repo1)
|
||||
set :raise_errors, true
|
||||
set :show_exceptions, false
|
||||
|
||||
|
@ -41,7 +40,22 @@ class Endpoint < Sinatra::Base
|
|||
helpers do
|
||||
include Spec::Path
|
||||
|
||||
def dependencies_for(gem_names, gem_repo = GEM_REPO)
|
||||
def default_gem_repo
|
||||
if ENV["BUNDLER_SPEC_GEM_REPO"]
|
||||
Pathname.new(ENV["BUNDLER_SPEC_GEM_REPO"])
|
||||
else
|
||||
case request.host
|
||||
when "gem.repo2"
|
||||
Spec::Path.gem_repo2
|
||||
when "gem.repo3"
|
||||
Spec::Path.gem_repo3
|
||||
else
|
||||
Spec::Path.gem_repo1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def dependencies_for(gem_names, gem_repo = default_gem_repo)
|
||||
return [] if gem_names.nil? || gem_names.empty?
|
||||
|
||||
all_specs = %w[specs.4.8 prerelease_specs.4.8].map do |filename|
|
||||
|
@ -74,11 +88,11 @@ class Endpoint < Sinatra::Base
|
|||
end
|
||||
|
||||
get "/fetch/actual/gem/:id" do
|
||||
File.binread("#{GEM_REPO}/quick/Marshal.4.8/#{params[:id]}")
|
||||
File.binread("#{default_gem_repo}/quick/Marshal.4.8/#{params[:id]}")
|
||||
end
|
||||
|
||||
get "/gems/:id" do
|
||||
File.binread("#{GEM_REPO}/gems/#{params[:id]}")
|
||||
File.binread("#{default_gem_repo}/gems/#{params[:id]}")
|
||||
end
|
||||
|
||||
get "/api/v1/dependencies" do
|
||||
|
@ -86,11 +100,11 @@ class Endpoint < Sinatra::Base
|
|||
end
|
||||
|
||||
get "/specs.4.8.gz" do
|
||||
File.binread("#{GEM_REPO}/specs.4.8.gz")
|
||||
File.binread("#{default_gem_repo}/specs.4.8.gz")
|
||||
end
|
||||
|
||||
get "/prerelease_specs.4.8.gz" do
|
||||
File.binread("#{GEM_REPO}/prerelease_specs.4.8.gz")
|
||||
File.binread("#{default_gem_repo}/prerelease_specs.4.8.gz")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class Windows < Sinatra::Base
|
|||
set :show_exceptions, false
|
||||
|
||||
helpers do
|
||||
def gem_repo
|
||||
def default_gem_repo
|
||||
Pathname.new(ENV["BUNDLER_SPEC_GEM_REPO"] || Spec::Path.gem_repo1)
|
||||
end
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ class Windows < Sinatra::Base
|
|||
|
||||
files.each do |file|
|
||||
get "/#{file}" do
|
||||
File.binread gem_repo.join(file)
|
||||
File.binread default_gem_repo.join(file)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -192,13 +192,6 @@ module Spec
|
|||
update_repo2(&blk) if block_given?
|
||||
end
|
||||
|
||||
def build_repo3
|
||||
build_repo gem_repo3 do
|
||||
build_gem "rack"
|
||||
end
|
||||
FileUtils.rm_rf Dir[gem_repo3("prerelease*")]
|
||||
end
|
||||
|
||||
# A repo that has no pre-installed gems included. (The caller completely
|
||||
# determines the contents with the block.)
|
||||
def build_repo4(&blk)
|
||||
|
|
|
@ -77,7 +77,7 @@ module Spec
|
|||
gem_activate(gem_name)
|
||||
load Gem.bin_path(gem_name, bin_container)
|
||||
rescue Gem::LoadError => e
|
||||
abort "We couln't activate #{gem_name} (#{e.requirement}). Run `gem install #{gem_name}:'#{e.requirement}'`"
|
||||
abort "We couldn't activate #{gem_name} (#{e.requirement}). Run `gem install #{gem_name}:'#{e.requirement}'`"
|
||||
end
|
||||
|
||||
def gem_activate(gem_name)
|
||||
|
|
|
@ -49,6 +49,22 @@ class TestDeprecate < Gem::TestCase
|
|||
@message = "bar"
|
||||
end
|
||||
rubygems_deprecate :foo, :bar
|
||||
|
||||
def foo_arg(msg)
|
||||
@message = "foo" + msg
|
||||
end
|
||||
def bar_arg(msg)
|
||||
@message = "bar" + msg
|
||||
end
|
||||
rubygems_deprecate :foo_arg, :bar_arg
|
||||
|
||||
def foo_kwarg(message:)
|
||||
@message = "foo" + message
|
||||
end
|
||||
def bar_kwarg(message:)
|
||||
@message = "bar" + message
|
||||
end
|
||||
rubygems_deprecate :foo_kwarg, :bar_kwarg
|
||||
end
|
||||
|
||||
class OtherThing
|
||||
|
@ -61,6 +77,22 @@ class TestDeprecate < Gem::TestCase
|
|||
@message = "bar"
|
||||
end
|
||||
deprecate :foo, :bar, 2099, 3
|
||||
|
||||
def foo_arg(msg)
|
||||
@message = "foo" + msg
|
||||
end
|
||||
def bar_arg(msg)
|
||||
@message = "bar" + msg
|
||||
end
|
||||
deprecate :foo_arg, :bar_arg, 2099, 3
|
||||
|
||||
def foo_kwarg(message:)
|
||||
@message = "foo" + message
|
||||
end
|
||||
def bar_kwarg(message:)
|
||||
@message = "bar" + message
|
||||
end
|
||||
deprecate :foo_kwarg, :bar_kwarg, 2099, 3
|
||||
end
|
||||
|
||||
def test_deprecated_method_calls_the_old_method
|
||||
|
@ -68,6 +100,10 @@ class TestDeprecate < Gem::TestCase
|
|||
thing = Thing.new
|
||||
thing.foo
|
||||
assert_equal "foo", thing.message
|
||||
thing.foo_arg("msg")
|
||||
assert_equal "foomsg", thing.message
|
||||
thing.foo_kwarg(message: "msg")
|
||||
assert_equal "foomsg", thing.message
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -75,10 +111,14 @@ class TestDeprecate < Gem::TestCase
|
|||
out, err = capture_io do
|
||||
thing = Thing.new
|
||||
thing.foo
|
||||
thing.foo_arg("msg")
|
||||
thing.foo_kwarg(message: "msg")
|
||||
end
|
||||
|
||||
assert_equal "", out
|
||||
assert_match(/Thing#foo is deprecated; use bar instead\./, err)
|
||||
assert_match(/Thing#foo_arg is deprecated; use bar_arg instead\./, err)
|
||||
assert_match(/Thing#foo_kwarg is deprecated; use bar_kwarg instead\./, err)
|
||||
assert_match(/in Rubygems [0-9]+/, err)
|
||||
end
|
||||
|
||||
|
@ -104,10 +144,14 @@ class TestDeprecate < Gem::TestCase
|
|||
out, err = capture_io do
|
||||
thing = OtherThing.new
|
||||
thing.foo
|
||||
thing.foo_arg("msg")
|
||||
thing.foo_kwarg(message: "msg")
|
||||
end
|
||||
|
||||
assert_equal "", out
|
||||
assert_match(/Thing#foo is deprecated; use bar instead\./, err)
|
||||
assert_match(/on or after 2099-03-01/, err)
|
||||
assert_match(/OtherThing#foo is deprecated; use bar instead\./, err)
|
||||
assert_match(/OtherThing#foo_arg is deprecated; use bar_arg instead\./, err)
|
||||
assert_match(/OtherThing#foo_kwarg is deprecated; use bar_kwarg instead\./, err)
|
||||
assert_match(/on or after 2099-03/, err)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue