mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge RubyGems-3.2.18 and Bundler-2.2.18
This commit is contained in:
parent
dd28c03d5f
commit
d4b4281959
185 changed files with 2107 additions and 2052 deletions
|
@ -69,6 +69,7 @@ module Bundler
|
|||
autoload :SharedHelpers, File.expand_path("bundler/shared_helpers", __dir__)
|
||||
autoload :Source, File.expand_path("bundler/source", __dir__)
|
||||
autoload :SourceList, File.expand_path("bundler/source_list", __dir__)
|
||||
autoload :SourceMap, File.expand_path("bundler/source_map", __dir__)
|
||||
autoload :SpecSet, File.expand_path("bundler/spec_set", __dir__)
|
||||
autoload :StubSpecification, File.expand_path("bundler/stub_specification", __dir__)
|
||||
autoload :UI, File.expand_path("bundler/ui", __dir__)
|
||||
|
|
|
@ -34,13 +34,12 @@ Gem::Specification.new do |s|
|
|||
s.required_ruby_version = ">= 2.3.0"
|
||||
s.required_rubygems_version = ">= 2.5.2"
|
||||
|
||||
s.files = Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
|
||||
s.files = Dir.glob("lib/bundler{.rb,/**/*}", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
|
||||
|
||||
# Include the CHANGELOG.md, LICENSE.md, README.md manually
|
||||
s.files += %w[CHANGELOG.md LICENSE.md README.md]
|
||||
# include the gemspec itself because warbler breaks w/o it
|
||||
s.files += %w[bundler.gemspec]
|
||||
|
||||
s.extra_rdoc_files = %w[CHANGELOG.md LICENSE.md README.md]
|
||||
s.bindir = "exe"
|
||||
s.executables = %w[bundle bundler]
|
||||
s.require_paths = ["lib"]
|
||||
|
|
|
@ -308,7 +308,6 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
unless Bundler.feature_flag.bundler_3_mode?
|
||||
desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
|
||||
long_desc <<-D
|
||||
Show lists the names and versions of all gems that are required by your Gemfile.
|
||||
|
@ -319,29 +318,10 @@ module Bundler
|
|||
method_option "outdated", :type => :boolean,
|
||||
:banner => "Show verbose output including whether gems are outdated."
|
||||
def show(gem_name = nil)
|
||||
if ARGV[0] == "show"
|
||||
rest = ARGV[1..-1]
|
||||
|
||||
if flag = rest.find{|arg| ["--verbose", "--outdated"].include?(arg) }
|
||||
Bundler::SharedHelpers.major_deprecation(2, "the `#{flag}` flag to `bundle show` was undocumented and will be removed without replacement")
|
||||
else
|
||||
new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
|
||||
|
||||
new_arguments = rest.map do |arg|
|
||||
next arg if arg != "--paths"
|
||||
next "--path" if new_command == "info"
|
||||
end
|
||||
|
||||
old_argv = ARGV.join(" ")
|
||||
new_argv = [new_command, *new_arguments.compact].join(" ")
|
||||
|
||||
Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
|
||||
end
|
||||
end
|
||||
SharedHelpers.major_deprecation(2, "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement") if ARGV.include?("--outdated")
|
||||
require_relative "cli/show"
|
||||
Show.new(options, gem_name).run
|
||||
end
|
||||
end
|
||||
|
||||
desc "list", "List all gems in the bundle"
|
||||
method_option "name-only", :type => :boolean, :banner => "print only the gem names"
|
||||
|
|
|
@ -146,17 +146,14 @@ module Bundler
|
|||
end
|
||||
|
||||
def retrieve_active_spec(definition, current_spec)
|
||||
if strict
|
||||
active_spec = definition.find_resolved_spec(current_spec)
|
||||
else
|
||||
active_specs = definition.find_indexed_specs(current_spec)
|
||||
active_spec = definition.resolve.find_by_name_and_platform(current_spec.name, current_spec.platform)
|
||||
return active_spec if strict
|
||||
|
||||
active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
|
||||
if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
|
||||
active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
|
||||
end
|
||||
active_spec = active_specs.last
|
||||
end
|
||||
|
||||
active_spec
|
||||
active_specs.last
|
||||
end
|
||||
|
||||
def print_gems(gems_list)
|
||||
|
|
|
@ -219,7 +219,6 @@ module Bundler
|
|||
Bundler.ui.debug "The definition is missing #{missing.map(&:full_name)}"
|
||||
true
|
||||
rescue BundlerError => e
|
||||
@index = nil
|
||||
@resolve = nil
|
||||
@specs = nil
|
||||
@gem_version_promoter = nil
|
||||
|
@ -282,50 +281,6 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def index
|
||||
@index ||= Index.build do |idx|
|
||||
dependency_names = @dependencies.map(&:name)
|
||||
|
||||
sources.all_sources.each do |source|
|
||||
source.dependency_names = dependency_names - pinned_spec_names(source)
|
||||
idx.add_source source.specs
|
||||
dependency_names.concat(source.unmet_deps).uniq!
|
||||
end
|
||||
|
||||
double_check_for_index(idx, dependency_names)
|
||||
end
|
||||
end
|
||||
|
||||
# Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both
|
||||
# sources A and B. At this point, the API request will have found all the versions of Bar in source A,
|
||||
# but will not have found any versions of Bar from source B, which is a problem if the requested version
|
||||
# of Foo specifically depends on a version of Bar that is only found in source B. This ensures that for
|
||||
# each spec we found, we add all possible versions from all sources to the index.
|
||||
def double_check_for_index(idx, dependency_names)
|
||||
pinned_names = pinned_spec_names
|
||||
loop do
|
||||
idxcount = idx.size
|
||||
|
||||
names = :names # do this so we only have to traverse to get dependency_names from the index once
|
||||
unmet_dependency_names = lambda do
|
||||
return names unless names == :names
|
||||
new_names = sources.all_sources.map(&:dependency_names_to_double_check)
|
||||
return names = nil if new_names.compact!
|
||||
names = new_names.flatten(1).concat(dependency_names)
|
||||
names.uniq!
|
||||
names -= pinned_names
|
||||
names
|
||||
end
|
||||
|
||||
sources.all_sources.each do |source|
|
||||
source.double_check_for(unmet_dependency_names)
|
||||
end
|
||||
|
||||
break if idxcount == idx.size
|
||||
end
|
||||
end
|
||||
private :double_check_for_index
|
||||
|
||||
def has_rubygems_remotes?
|
||||
sources.rubygems_sources.any? {|s| s.remotes.any? }
|
||||
end
|
||||
|
@ -532,14 +487,6 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def find_resolved_spec(current_spec)
|
||||
specs.find_by_name_and_platform(current_spec.name, current_spec.platform)
|
||||
end
|
||||
|
||||
def find_indexed_specs(current_spec)
|
||||
index[current_spec.name].select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
|
||||
end
|
||||
|
||||
attr_reader :sources
|
||||
private :sources
|
||||
|
||||
|
@ -556,6 +503,10 @@ module Bundler
|
|||
|
||||
private
|
||||
|
||||
def precompute_source_requirements_for_indirect_dependencies?
|
||||
sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && sources.no_aggregate_global_source?
|
||||
end
|
||||
|
||||
def current_ruby_platform_locked?
|
||||
return false unless generic_local_platform == Gem::Platform::RUBY
|
||||
|
||||
|
@ -681,9 +632,9 @@ module Bundler
|
|||
changes = false
|
||||
|
||||
# If there is a RubyGems source in both
|
||||
locked_gem_sources.each do |locked_gem|
|
||||
locked_gem_sources.each do |locked_gem_source|
|
||||
# Merge the remotes from the Gemfile into the Gemfile.lock
|
||||
changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
|
||||
changes |= locked_gem_source.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
|
||||
end
|
||||
|
||||
changes
|
||||
|
@ -902,26 +853,22 @@ module Bundler
|
|||
end
|
||||
|
||||
def source_requirements
|
||||
# Load all specs from remote sources
|
||||
index
|
||||
|
||||
# Record the specs available in each gem's source, so that those
|
||||
# specs will be available later when the resolver knows where to
|
||||
# look for that gemspec (or its dependencies)
|
||||
source_requirements = { :default => sources.default_source }.merge(dependency_source_requirements)
|
||||
source_requirements = if precompute_source_requirements_for_indirect_dependencies?
|
||||
{ :default => sources.default_source }.merge(source_map.all_requirements)
|
||||
else
|
||||
{ :default => Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
|
||||
end
|
||||
metadata_dependencies.each do |dep|
|
||||
source_requirements[dep.name] = sources.metadata_source
|
||||
end
|
||||
source_requirements[:global] = index unless Bundler.feature_flag.disable_multisource?
|
||||
source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
|
||||
source_requirements[:default_bundler] = source_requirements["bundler"] || sources.default_source
|
||||
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
||||
source_requirements
|
||||
end
|
||||
|
||||
def pinned_spec_names(skip = nil)
|
||||
dependency_source_requirements.reject {|_, source| source == skip }.keys
|
||||
end
|
||||
|
||||
def requested_groups
|
||||
groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
||||
end
|
||||
|
@ -977,16 +924,8 @@ module Bundler
|
|||
Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
|
||||
end
|
||||
|
||||
def dependency_source_requirements
|
||||
@dependency_source_requirements ||= begin
|
||||
source_requirements = {}
|
||||
default = sources.default_source
|
||||
dependencies.each do |dep|
|
||||
dep_source = dep.source || default
|
||||
source_requirements[dep.name] = dep_source
|
||||
end
|
||||
source_requirements
|
||||
end
|
||||
def source_map
|
||||
@source_map ||= SourceMap.new(sources, dependencies)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,7 +32,6 @@ module Bundler
|
|||
settings_flag(:cache_all) { bundler_3_mode? }
|
||||
settings_flag(:default_install_uses_path) { bundler_3_mode? }
|
||||
settings_flag(:deployment_means_frozen) { bundler_3_mode? }
|
||||
settings_flag(:disable_multisource) { bundler_3_mode? }
|
||||
settings_flag(:forget_cli_options) { bundler_3_mode? }
|
||||
settings_flag(:global_gem_cache) { bundler_3_mode? }
|
||||
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
|
||||
|
|
|
@ -112,7 +112,7 @@ module Bundler
|
|||
#{issues_url(e)}
|
||||
|
||||
If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
|
||||
https://github.com/rubygems/rubygems/issues/new?labels=Bundler
|
||||
https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md
|
||||
EOS
|
||||
end
|
||||
|
||||
|
|
|
@ -122,10 +122,9 @@ module Bundler
|
|||
names
|
||||
end
|
||||
|
||||
# returns a list of the dependencies
|
||||
def unmet_dependency_names
|
||||
dependency_names.select do |name|
|
||||
name != "bundler" && search(name).empty?
|
||||
search(name).empty?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE\-ADD" "1" "April 2021" "" ""
|
||||
.TH "BUNDLE\-ADD" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-BINSTUBS" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-CACHE" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-CHECK" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-CLEAN" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-CONFIG" "1" "May 2021" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\-config\fR \- Set bundler configuration options
|
||||
|
@ -56,9 +56,6 @@ Executing \fBbundle config unset \-\-local <name> <value>\fR will delete the con
|
|||
.P
|
||||
Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
|
||||
.
|
||||
.P
|
||||
Executing \fBbundle config set \-\-local disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config unset disable_multisource\fR downgrades this error to a warning\.
|
||||
.
|
||||
.SH "REMEMBERING OPTIONS"
|
||||
Flags passed to \fBbundle install\fR or the Bundler runtime, such as \fB\-\-path foo\fR or \fB\-\-without production\fR, are remembered between commands and saved to your local application\'s configuration (normally, \fB\./\.bundle/config\fR)\.
|
||||
.
|
||||
|
@ -184,9 +181,6 @@ The following is a list of all configuration keys and their purpose\. You can le
|
|||
\fBdisable_local_revision_check\fR (\fBBUNDLE_DISABLE_LOCAL_REVISION_CHECK\fR): Allow Bundler to use a local git override without checking if the revision present in the lockfile is present in the repository\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBdisable_multisource\fR (\fBBUNDLE_DISABLE_MULTISOURCE\fR): When set, Gemfiles containing multiple sources will produce errors instead of warnings\. Use \fBbundle config unset disable_multisource\fR to unset\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
\fBdisable_shared_gems\fR (\fBBUNDLE_DISABLE_SHARED_GEMS\fR): Stop Bundler from accessing gems installed to RubyGems\' normal location\.
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
|
|
|
@ -47,10 +47,6 @@ configuration only from the local application.
|
|||
Executing bundle with the `BUNDLE_IGNORE_CONFIG` environment variable set will
|
||||
cause it to ignore all configuration.
|
||||
|
||||
Executing `bundle config set --local disable_multisource true` upgrades the warning about
|
||||
the Gemfile containing multiple primary sources to an error. Executing `bundle
|
||||
config unset disable_multisource` downgrades this error to a warning.
|
||||
|
||||
## REMEMBERING OPTIONS
|
||||
|
||||
Flags passed to `bundle install` or the Bundler runtime, such as `--path foo` or
|
||||
|
@ -178,10 +174,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
|
|||
* `disable_local_revision_check` (`BUNDLE_DISABLE_LOCAL_REVISION_CHECK`):
|
||||
Allow Bundler to use a local git override without checking if the revision
|
||||
present in the lockfile is present in the repository.
|
||||
* `disable_multisource` (`BUNDLE_DISABLE_MULTISOURCE`):
|
||||
When set, Gemfiles containing multiple sources will produce errors
|
||||
instead of warnings.
|
||||
Use `bundle config unset disable_multisource` to unset.
|
||||
* `disable_shared_gems` (`BUNDLE_DISABLE_SHARED_GEMS`):
|
||||
Stop Bundler from accessing gems installed to RubyGems' normal location.
|
||||
* `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE\-DOCTOR" "1" "April 2021" "" ""
|
||||
.TH "BUNDLE\-DOCTOR" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-EXEC" "1" "May 2021" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\-exec\fR \- Execute a command in the context of the bundle
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE\-GEM" "1" "April 2021" "" ""
|
||||
.TH "BUNDLE\-GEM" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-INFO" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-INIT" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-INJECT" "1" "May 2021" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE\-INSTALL" "1" "April 2021" "" ""
|
||||
.TH "BUNDLE\-INSTALL" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-LIST" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-LOCK" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-OPEN" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-OUTDATED" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-PLATFORM" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-PRISTINE" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-REMOVE" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-SHOW" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-UPDATE" "1" "May 2021" "" ""
|
||||
.
|
||||
.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" "April 2021" "" ""
|
||||
.TH "BUNDLE\-VIZ" "1" "May 2021" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE" "1" "April 2021" "" ""
|
||||
.TH "BUNDLE" "1" "May 2021" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\fR \- Ruby Dependency Management
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "GEMFILE" "5" "April 2021" "" ""
|
||||
.TH "GEMFILE" "5" "May 2021" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
|
||||
|
|
|
@ -244,6 +244,20 @@ module Bundler
|
|||
specs.unmet_dependency_names
|
||||
end
|
||||
|
||||
# Used by definition.
|
||||
#
|
||||
# Note: Do not override if you don't know what you are doing.
|
||||
def spec_names
|
||||
specs.spec_names
|
||||
end
|
||||
|
||||
# Used by definition.
|
||||
#
|
||||
# Note: Do not override if you don't know what you are doing.
|
||||
def add_dependency_names(names)
|
||||
@dependencies |= Array(names)
|
||||
end
|
||||
|
||||
# Note: Do not override if you don't know what you are doing.
|
||||
def can_lock?(spec)
|
||||
spec.source == self
|
||||
|
|
|
@ -21,17 +21,11 @@ module Bundler
|
|||
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
||||
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
||||
result = resolver.start(requirements)
|
||||
SpecSet.new(result)
|
||||
SpecSet.new(result).for(requirements.reject{|dep| dep.name.end_with?("\0") })
|
||||
end
|
||||
|
||||
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
||||
@source_requirements = source_requirements
|
||||
|
||||
@index_requirements = source_requirements.each_with_object({}) do |source_requirement, index_requirements|
|
||||
name, source = source_requirement
|
||||
index_requirements[name] = name == :global ? source : source.specs
|
||||
end
|
||||
|
||||
@base = base
|
||||
@resolver = Molinillo::Resolver.new(self, self)
|
||||
@search_for = {}
|
||||
|
@ -45,10 +39,6 @@ module Bundler
|
|||
@resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
|
||||
@gem_version_promoter = gem_version_promoter
|
||||
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
|
||||
@no_aggregate_global_source = @source_requirements[:global].nil?
|
||||
|
||||
@variant_specific_names = []
|
||||
@generic_names = ["Ruby\0", "RubyGems\0"]
|
||||
end
|
||||
|
||||
def start(requirements)
|
||||
|
@ -58,7 +48,6 @@ module Bundler
|
|||
verify_gemfile_dependencies_are_found!(requirements)
|
||||
dg = @resolver.resolve(requirements, @base_dg)
|
||||
dg.
|
||||
tap {|resolved| validate_resolved_specs!(resolved) }.
|
||||
map(&:payload).
|
||||
reject {|sg| sg.name.end_with?("\0") }.
|
||||
map(&:to_specs).
|
||||
|
@ -112,24 +101,14 @@ module Bundler
|
|||
include Molinillo::SpecificationProvider
|
||||
|
||||
def dependencies_for(specification)
|
||||
all_dependencies = specification.dependencies_for_activated_platforms
|
||||
|
||||
if @variant_specific_names.include?(specification.name)
|
||||
@variant_specific_names |= all_dependencies.map(&:name) - @generic_names
|
||||
else
|
||||
generic_names, variant_specific_names = specification.partitioned_dependency_names_for_activated_platforms
|
||||
@variant_specific_names |= variant_specific_names - @generic_names
|
||||
@generic_names |= generic_names
|
||||
end
|
||||
|
||||
all_dependencies
|
||||
specification.dependencies_for_activated_platforms
|
||||
end
|
||||
|
||||
def search_for(dependency_proxy)
|
||||
platform = dependency_proxy.__platform
|
||||
dependency = dependency_proxy.dep
|
||||
name = dependency.name
|
||||
search_result = @search_for[dependency_proxy] ||= begin
|
||||
@search_for[dependency_proxy] ||= begin
|
||||
results = results_for(dependency, @base[name])
|
||||
|
||||
if vertex = @base_dg.vertex_named(name)
|
||||
|
@ -181,35 +160,14 @@ module Bundler
|
|||
@gem_version_promoter.sort_versions(dependency, spec_groups)
|
||||
end
|
||||
end
|
||||
|
||||
unless search_result.empty?
|
||||
specific_dependency = @variant_specific_names.include?(name)
|
||||
return search_result unless specific_dependency
|
||||
|
||||
search_result.each do |sg|
|
||||
if @generic_names.include?(name)
|
||||
@variant_specific_names -= [name]
|
||||
sg.activate_all_platforms!
|
||||
else
|
||||
sg.activate_platform!(platform)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
search_result
|
||||
end
|
||||
|
||||
def index_for(dependency)
|
||||
source = @index_requirements[dependency.name]
|
||||
if source
|
||||
source
|
||||
elsif @no_aggregate_global_source
|
||||
Index.build do |idx|
|
||||
dependency.all_sources.each {|s| idx.add_source(s.specs) }
|
||||
end
|
||||
else
|
||||
@index_requirements[:global]
|
||||
source_for(dependency.name).specs
|
||||
end
|
||||
|
||||
def source_for(name)
|
||||
@source_requirements[name] || @source_requirements[:default]
|
||||
end
|
||||
|
||||
def results_for(dependency, base)
|
||||
|
@ -240,23 +198,10 @@ module Bundler
|
|||
dependencies.map(&:dep) == other_dependencies.map(&:dep)
|
||||
end
|
||||
|
||||
def relevant_sources_for_vertex(vertex)
|
||||
if vertex.root?
|
||||
[@source_requirements[vertex.name]]
|
||||
elsif @no_aggregate_global_source
|
||||
vertex.recursive_predecessors.map do |v|
|
||||
@source_requirements[v.name]
|
||||
end.compact << @source_requirements[:default]
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def sort_dependencies(dependencies, activated, conflicts)
|
||||
dependencies.sort_by do |dependency|
|
||||
name = name_for(dependency)
|
||||
vertex = activated.vertex_named(name)
|
||||
dependency.all_sources = relevant_sources_for_vertex(vertex)
|
||||
[
|
||||
@base_dg.vertex_named(name) ? 0 : 1,
|
||||
vertex.payload ? 0 : 1,
|
||||
|
@ -398,7 +343,7 @@ module Bundler
|
|||
if other_bundler_required
|
||||
o << "\n\n"
|
||||
|
||||
candidate_specs = @index_requirements[:default_bundler].search(conflict_dependency)
|
||||
candidate_specs = source_for(:default_bundler).specs.search(conflict_dependency)
|
||||
if candidate_specs.any?
|
||||
target_version = candidate_specs.last.version
|
||||
new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
|
||||
|
@ -415,11 +360,7 @@ module Bundler
|
|||
elsif !conflict.existing
|
||||
o << "\n"
|
||||
|
||||
relevant_sources = if conflict.requirement.source
|
||||
[conflict.requirement.source]
|
||||
else
|
||||
conflict.requirement.all_sources
|
||||
end.compact.map(&:to_s).uniq.sort
|
||||
relevant_source = conflict.requirement.source || source_for(name)
|
||||
|
||||
metadata_requirement = name.end_with?("\0")
|
||||
|
||||
|
@ -432,12 +373,10 @@ module Bundler
|
|||
end
|
||||
o << " "
|
||||
|
||||
o << if relevant_sources.empty?
|
||||
"in any of the sources.\n"
|
||||
elsif metadata_requirement
|
||||
"is not available in #{relevant_sources.join(" or ")}"
|
||||
o << if metadata_requirement
|
||||
"is not available in #{relevant_source}"
|
||||
else
|
||||
"in any of the relevant sources:\n #{relevant_sources * "\n "}\n"
|
||||
"in #{relevant_source}.\n"
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
@ -451,27 +390,5 @@ module Bundler
|
|||
end
|
||||
)
|
||||
end
|
||||
|
||||
def validate_resolved_specs!(resolved_specs)
|
||||
resolved_specs.each do |v|
|
||||
name = v.name
|
||||
sources = relevant_sources_for_vertex(v)
|
||||
next unless sources.any?
|
||||
if default_index = sources.index(@source_requirements[:default])
|
||||
sources.delete_at(default_index)
|
||||
end
|
||||
sources.reject! {|s| s.specs.search(name).empty? }
|
||||
sources.uniq!
|
||||
next if sources.size <= 1
|
||||
|
||||
msg = ["The gem '#{name}' was found in multiple relevant sources."]
|
||||
msg.concat sources.map {|s| " * #{s}" }.sort
|
||||
msg << "You #{@no_aggregate_global_source ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
|
||||
msg = msg.join("\n")
|
||||
|
||||
raise SecurityError, msg if @no_aggregate_global_source
|
||||
Bundler.ui.warn "Warning: #{msg}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,14 +21,10 @@ module Bundler
|
|||
@version = exemplary_spec.version
|
||||
@source = exemplary_spec.source
|
||||
|
||||
@all_platforms = relevant_platforms
|
||||
@activated_platforms = relevant_platforms
|
||||
@dependencies = Hash.new do |dependencies, platforms|
|
||||
dependencies[platforms] = dependencies_for(platforms)
|
||||
end
|
||||
@partitioned_dependency_names = Hash.new do |partitioned_dependency_names, platforms|
|
||||
partitioned_dependency_names[platforms] = partitioned_dependency_names_for(platforms)
|
||||
end
|
||||
@specs = specs
|
||||
end
|
||||
|
||||
|
@ -45,14 +41,6 @@ module Bundler
|
|||
end.flatten.compact.uniq
|
||||
end
|
||||
|
||||
def activate_platform!(platform)
|
||||
self.activated_platforms = [platform]
|
||||
end
|
||||
|
||||
def activate_all_platforms!
|
||||
self.activated_platforms = @all_platforms
|
||||
end
|
||||
|
||||
def to_s
|
||||
activated_platforms_string = sorted_activated_platforms.join(", ")
|
||||
"#{name} (#{version}) (#{activated_platforms_string})"
|
||||
|
@ -62,10 +50,6 @@ module Bundler
|
|||
@dependencies[activated_platforms]
|
||||
end
|
||||
|
||||
def partitioned_dependency_names_for_activated_platforms
|
||||
@partitioned_dependency_names[activated_platforms]
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
return unless other.is_a?(SpecGroup)
|
||||
name == other.name &&
|
||||
|
@ -100,14 +84,6 @@ module Bundler
|
|||
end.flatten
|
||||
end
|
||||
|
||||
def partitioned_dependency_names_for(platforms)
|
||||
return @dependencies[platforms].map(&:name), [] if platforms.size == 1
|
||||
|
||||
@dependencies[platforms].partition do |dep_proxy|
|
||||
@dependencies[platforms].count {|dp| dp.dep == dep_proxy.dep } == platforms.size
|
||||
end.map {|deps| deps.map(&:name) }
|
||||
end
|
||||
|
||||
def __dependencies(platform)
|
||||
dependencies = []
|
||||
@specs[platform].first.dependencies.each do |dep|
|
||||
|
|
|
@ -105,7 +105,7 @@ module Gem
|
|||
end
|
||||
|
||||
class Dependency
|
||||
attr_accessor :source, :groups, :all_sources
|
||||
attr_accessor :source, :groups
|
||||
|
||||
alias_method :eql?, :==
|
||||
|
||||
|
@ -116,7 +116,7 @@ module Gem
|
|||
end
|
||||
|
||||
def to_yaml_properties
|
||||
instance_variables.reject {|p| ["@source", "@groups", "@all_sources"].include?(p.to_s) }
|
||||
instance_variables.reject {|p| ["@source", "@groups"].include?(p.to_s) }
|
||||
end
|
||||
|
||||
def to_lock
|
||||
|
|
|
@ -21,7 +21,6 @@ module Bundler
|
|||
disable_exec_load
|
||||
disable_local_branch_check
|
||||
disable_local_revision_check
|
||||
disable_multisource
|
||||
disable_shared_gems
|
||||
disable_version_check
|
||||
force_ruby_platform
|
||||
|
|
|
@ -7,6 +7,7 @@ module Bundler
|
|||
autoload :Metadata, File.expand_path("source/metadata", __dir__)
|
||||
autoload :Path, File.expand_path("source/path", __dir__)
|
||||
autoload :Rubygems, File.expand_path("source/rubygems", __dir__)
|
||||
autoload :RubygemsAggregate, File.expand_path("source/rubygems_aggregate", __dir__)
|
||||
|
||||
attr_accessor :dependency_names
|
||||
|
||||
|
@ -39,6 +40,10 @@ module Bundler
|
|||
|
||||
def remote!; end
|
||||
|
||||
def add_dependency_names(names)
|
||||
@dependency_names = Array(dependency_names) | Array(names)
|
||||
end
|
||||
|
||||
# it's possible that gems from one source depend on gems from some
|
||||
# other source, so now we download gemspecs and iterate over those
|
||||
# dependencies, looking for gems we don't have info on yet.
|
||||
|
@ -48,6 +53,10 @@ module Bundler
|
|||
specs.dependency_names
|
||||
end
|
||||
|
||||
def spec_names
|
||||
specs.spec_names
|
||||
end
|
||||
|
||||
def include?(other)
|
||||
other == self
|
||||
end
|
||||
|
|
|
@ -259,8 +259,16 @@ module Bundler
|
|||
!equivalent
|
||||
end
|
||||
|
||||
def spec_names
|
||||
if @allow_remote && dependency_api_available?
|
||||
remote_specs.spec_names
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def unmet_deps
|
||||
if @allow_remote && api_fetchers.any?
|
||||
if @allow_remote && dependency_api_available?
|
||||
remote_specs.unmet_dependency_names
|
||||
else
|
||||
[]
|
||||
|
@ -276,7 +284,7 @@ module Bundler
|
|||
|
||||
def double_check_for(unmet_dependency_names)
|
||||
return unless @allow_remote
|
||||
return unless api_fetchers.any?
|
||||
return unless dependency_api_available?
|
||||
|
||||
unmet_dependency_names = unmet_dependency_names.call
|
||||
unless unmet_dependency_names.nil?
|
||||
|
@ -298,17 +306,20 @@ module Bundler
|
|||
remote_specs.each do |spec|
|
||||
case spec
|
||||
when EndpointSpecification, Gem::Specification, StubSpecification, LazySpecification
|
||||
names.concat(spec.runtime_dependencies)
|
||||
names.concat(spec.runtime_dependencies.map(&:name))
|
||||
when RemoteSpecification # from the full index
|
||||
return nil
|
||||
else
|
||||
raise "unhandled spec type (#{spec.inspect})"
|
||||
end
|
||||
end
|
||||
names.map!(&:name) if names
|
||||
names
|
||||
end
|
||||
|
||||
def dependency_api_available?
|
||||
api_fetchers.any?
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def credless_remotes
|
||||
|
|
64
lib/bundler/source/rubygems_aggregate.rb
Normal file
64
lib/bundler/source/rubygems_aggregate.rb
Normal file
|
@ -0,0 +1,64 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Bundler
|
||||
class Source
|
||||
class RubygemsAggregate
|
||||
attr_reader :source_map, :sources
|
||||
|
||||
def initialize(sources, source_map)
|
||||
@sources = sources
|
||||
@source_map = source_map
|
||||
|
||||
@index = build_index
|
||||
end
|
||||
|
||||
def specs
|
||||
@index
|
||||
end
|
||||
|
||||
def to_s
|
||||
"any of the sources"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def build_index
|
||||
Index.build do |idx|
|
||||
dependency_names = source_map.pinned_spec_names
|
||||
|
||||
sources.all_sources.each do |source|
|
||||
source.dependency_names = dependency_names - source_map.pinned_spec_names(source)
|
||||
idx.add_source source.specs
|
||||
dependency_names.concat(source.unmet_deps).uniq!
|
||||
end
|
||||
|
||||
double_check_for_index(idx, dependency_names)
|
||||
end
|
||||
end
|
||||
|
||||
# Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both
|
||||
# sources A and B. At this point, the API request will have found all the versions of Bar in source A,
|
||||
# but will not have found any versions of Bar from source B, which is a problem if the requested version
|
||||
# of Foo specifically depends on a version of Bar that is only found in source B. This ensures that for
|
||||
# each spec we found, we add all possible versions from all sources to the index.
|
||||
def double_check_for_index(idx, dependency_names)
|
||||
pinned_names = source_map.pinned_spec_names
|
||||
|
||||
names = :names # do this so we only have to traverse to get dependency_names from the index once
|
||||
unmet_dependency_names = lambda do
|
||||
return names unless names == :names
|
||||
new_names = sources.all_sources.map(&:dependency_names_to_double_check)
|
||||
return names = nil if new_names.compact!
|
||||
names = new_names.flatten(1).concat(dependency_names)
|
||||
names.uniq!
|
||||
names -= pinned_names
|
||||
names
|
||||
end
|
||||
|
||||
sources.all_sources.each do |source|
|
||||
source.double_check_for(unmet_dependency_names)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -21,15 +21,19 @@ module Bundler
|
|||
@rubygems_sources = []
|
||||
@metadata_source = Source::Metadata.new
|
||||
|
||||
@disable_multisource = true
|
||||
@merged_gem_lockfile_sections = false
|
||||
end
|
||||
|
||||
def disable_multisource?
|
||||
@disable_multisource
|
||||
def merged_gem_lockfile_sections?
|
||||
@merged_gem_lockfile_sections
|
||||
end
|
||||
|
||||
def merged_gem_lockfile_sections!
|
||||
@disable_multisource = false
|
||||
@merged_gem_lockfile_sections = true
|
||||
end
|
||||
|
||||
def no_aggregate_global_source?
|
||||
global_rubygems_source.remotes.size <= 1
|
||||
end
|
||||
|
||||
def add_path_source(options = {})
|
||||
|
@ -70,7 +74,11 @@ module Bundler
|
|||
end
|
||||
|
||||
def rubygems_sources
|
||||
@rubygems_sources + [global_rubygems_source]
|
||||
non_global_rubygems_sources + [global_rubygems_source]
|
||||
end
|
||||
|
||||
def non_global_rubygems_sources
|
||||
@rubygems_sources
|
||||
end
|
||||
|
||||
def rubygems_remotes
|
||||
|
@ -81,16 +89,27 @@ module Bundler
|
|||
path_sources + git_sources + plugin_sources + rubygems_sources + [metadata_source]
|
||||
end
|
||||
|
||||
def non_default_explicit_sources
|
||||
all_sources - [default_source, metadata_source]
|
||||
end
|
||||
|
||||
def get(source)
|
||||
source_list_for(source).find {|s| equal_source?(source, s) || equivalent_source?(source, s) }
|
||||
end
|
||||
|
||||
def lock_sources
|
||||
lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
|
||||
if disable_multisource?
|
||||
lock_sources + rubygems_sources.sort_by(&:to_s).uniq
|
||||
lock_other_sources + lock_rubygems_sources
|
||||
end
|
||||
|
||||
def lock_other_sources
|
||||
(path_sources + git_sources + plugin_sources).sort_by(&:to_s)
|
||||
end
|
||||
|
||||
def lock_rubygems_sources
|
||||
if merged_gem_lockfile_sections?
|
||||
[combine_rubygems_sources]
|
||||
else
|
||||
lock_sources << combine_rubygems_sources
|
||||
rubygems_sources.sort_by(&:to_s).uniq
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -104,7 +123,7 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
replacement_rubygems = !disable_multisource? &&
|
||||
replacement_rubygems = merged_gem_lockfile_sections? &&
|
||||
replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
|
||||
@global_rubygems_source = replacement_rubygems if replacement_rubygems
|
||||
|
||||
|
|
58
lib/bundler/source_map.rb
Normal file
58
lib/bundler/source_map.rb
Normal file
|
@ -0,0 +1,58 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Bundler
|
||||
class SourceMap
|
||||
attr_reader :sources, :dependencies
|
||||
|
||||
def initialize(sources, dependencies)
|
||||
@sources = sources
|
||||
@dependencies = dependencies
|
||||
end
|
||||
|
||||
def pinned_spec_names(skip = nil)
|
||||
direct_requirements.reject {|_, source| source == skip }.keys
|
||||
end
|
||||
|
||||
def all_requirements
|
||||
requirements = direct_requirements.dup
|
||||
|
||||
unmet_deps = sources.non_default_explicit_sources.map do |source|
|
||||
(source.spec_names - pinned_spec_names).each do |indirect_dependency_name|
|
||||
previous_source = requirements[indirect_dependency_name]
|
||||
if previous_source.nil?
|
||||
requirements[indirect_dependency_name] = source
|
||||
else
|
||||
no_ambiguous_sources = Bundler.feature_flag.bundler_3_mode?
|
||||
|
||||
msg = ["The gem '#{indirect_dependency_name}' was found in multiple relevant sources."]
|
||||
msg.concat [previous_source, source].map {|s| " * #{s}" }.sort
|
||||
msg << "You #{no_ambiguous_sources ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
|
||||
msg = msg.join("\n")
|
||||
|
||||
raise SecurityError, msg if no_ambiguous_sources
|
||||
Bundler.ui.warn "Warning: #{msg}"
|
||||
end
|
||||
end
|
||||
|
||||
source.unmet_deps
|
||||
end
|
||||
|
||||
sources.default_source.add_dependency_names(unmet_deps.flatten - requirements.keys)
|
||||
|
||||
requirements
|
||||
end
|
||||
|
||||
def direct_requirements
|
||||
@direct_requirements ||= begin
|
||||
requirements = {}
|
||||
default = sources.default_source
|
||||
dependencies.each do |dep|
|
||||
dep_source = dep.source || default
|
||||
dep_source.add_dependency_names(dep.name)
|
||||
requirements[dep.name] = dep_source
|
||||
end
|
||||
requirements
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|||
<%- if config[:mit] -%>
|
||||
spec.license = "MIT"
|
||||
<%- end -%>
|
||||
spec.required_ruby_version = Gem::Requirement.new(">= <%= config[:required_ruby_version] %>")
|
||||
spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
|
||||
|
||||
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: false
|
||||
|
||||
module Bundler
|
||||
VERSION = "2.2.17".freeze
|
||||
VERSION = "2.2.18".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.17".freeze
|
||||
VERSION = "3.2.18".freeze
|
||||
end
|
||||
|
||||
# Must be first since it unloads the prelude from 1.9.2
|
||||
|
|
|
@ -23,11 +23,11 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|||
# spaces do not work.
|
||||
#
|
||||
# Details: https://github.com/rubygems/rubygems/issues/977#issuecomment-171544940
|
||||
tmp_dest = get_relative_path(tmp_dest, extension_dir)
|
||||
tmp_dest_relative = get_relative_path(tmp_dest.clone, extension_dir)
|
||||
|
||||
Tempfile.open %w[siteconf .rb], extension_dir do |siteconf|
|
||||
siteconf.puts "require 'rbconfig'"
|
||||
siteconf.puts "dest_path = #{tmp_dest.dump}"
|
||||
siteconf.puts "dest_path = #{tmp_dest_relative.dump}"
|
||||
%w[sitearchdir sitelibdir].each do |dir|
|
||||
siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
|
||||
siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
|
||||
|
@ -63,8 +63,8 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|||
|
||||
make dest_path, results, extension_dir
|
||||
|
||||
if tmp_dest
|
||||
full_tmp_dest = File.join(extension_dir, tmp_dest)
|
||||
if tmp_dest_relative
|
||||
full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
|
||||
|
||||
# TODO remove in RubyGems 3
|
||||
if Gem.install_extension_in_lib and lib_dir
|
||||
|
|
|
@ -1558,7 +1558,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
def build_extensions # :nodoc:
|
||||
return if default_gem?
|
||||
return if extensions.empty?
|
||||
return if installed_by_version < Gem::Version.new('2.2.0.preview.2')
|
||||
return if File.exist? gem_build_complete_path
|
||||
return if !File.writable?(base_dir)
|
||||
return if !File.exist?(File.join(base_dir, 'extensions'))
|
||||
|
@ -2129,7 +2128,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
def missing_extensions?
|
||||
return false if default_gem?
|
||||
return false if extensions.empty?
|
||||
return false if installed_by_version < Gem::Version.new('2.2.0.preview.2')
|
||||
return false if File.exist? gem_build_complete_path
|
||||
|
||||
true
|
||||
|
|
|
@ -12,7 +12,7 @@ if File.exist?(bundler_gemspec)
|
|||
end
|
||||
|
||||
begin
|
||||
gem 'minitest', '~> 5.13'
|
||||
gem 'test-unit', '~> 3.0'
|
||||
rescue Gem::LoadError
|
||||
end
|
||||
|
||||
|
@ -32,16 +32,7 @@ else
|
|||
require 'bundler'
|
||||
end
|
||||
|
||||
# Enable server plugin needed for bisection
|
||||
if ENV["RG_BISECT_SERVER_PLUGIN"]
|
||||
require ENV["RG_BISECT_SERVER_PLUGIN"]
|
||||
|
||||
Minitest.extensions << "server"
|
||||
end
|
||||
|
||||
ENV["MT_NO_PLUGINS"] = "true"
|
||||
|
||||
require 'minitest/autorun'
|
||||
require 'test/unit'
|
||||
|
||||
ENV["JARS_SKIP"] = "true" if Gem.java_platform? # avoid unnecessary and noisy `jar-dependencies` post install hook
|
||||
|
||||
|
@ -111,7 +102,7 @@ end
|
|||
# and uninstall gems, fetch remote gems through a stub fetcher and be assured
|
||||
# your normal set of gems is not affected.
|
||||
|
||||
class Gem::TestCase < Minitest::Test
|
||||
class Gem::TestCase < Test::Unit::TestCase
|
||||
extend Gem::Deprecate
|
||||
|
||||
attr_accessor :fetcher # :nodoc:
|
||||
|
@ -140,11 +131,48 @@ class Gem::TestCase < Minitest::Test
|
|||
end
|
||||
|
||||
def assert_directory_exists(path, msg = nil)
|
||||
msg = message(msg) { "Expected path '#{path}' to be a directory" }
|
||||
assert_path_exists path
|
||||
msg = build_message(msg, "Expected path '#{path}' to be a directory")
|
||||
assert_path_exist path
|
||||
assert File.directory?(path), msg
|
||||
end
|
||||
|
||||
# https://github.com/seattlerb/minitest/blob/21d9e804b63c619f602f3f4ece6c71b48974707a/lib/minitest/assertions.rb#L188
|
||||
def _synchronize
|
||||
yield
|
||||
end
|
||||
|
||||
# https://github.com/seattlerb/minitest/blob/21d9e804b63c619f602f3f4ece6c71b48974707a/lib/minitest/assertions.rb#L546
|
||||
def capture_subprocess_io
|
||||
_synchronize do
|
||||
begin
|
||||
require "tempfile"
|
||||
|
||||
captured_stdout, captured_stderr = Tempfile.new("out"), Tempfile.new("err")
|
||||
|
||||
orig_stdout, orig_stderr = $stdout.dup, $stderr.dup
|
||||
$stdout.reopen captured_stdout
|
||||
$stderr.reopen captured_stderr
|
||||
|
||||
yield
|
||||
|
||||
$stdout.rewind
|
||||
$stderr.rewind
|
||||
|
||||
return captured_stdout.read, captured_stderr.read
|
||||
ensure
|
||||
captured_stdout.unlink
|
||||
captured_stderr.unlink
|
||||
$stdout.reopen orig_stdout
|
||||
$stderr.reopen orig_stderr
|
||||
|
||||
orig_stdout.close
|
||||
orig_stderr.close
|
||||
captured_stdout.close
|
||||
captured_stderr.close
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Sets the ENABLE_SHARED entry in RbConfig::CONFIG to +value+ and restores
|
||||
# the original value when the block ends
|
||||
|
@ -262,19 +290,19 @@ class Gem::TestCase < Minitest::Test
|
|||
|
||||
def assert_contains_make_command(target, output, msg = nil)
|
||||
if output.match(/\n/)
|
||||
msg = message(msg) do
|
||||
msg = build_message(msg,
|
||||
"Expected output containing make command \"%s\", but was \n\nBEGIN_OF_OUTPUT\n%sEND_OF_OUTPUT" % [
|
||||
('%s %s' % [make_command, target]).rstrip,
|
||||
output,
|
||||
]
|
||||
end
|
||||
)
|
||||
else
|
||||
msg = message(msg) do
|
||||
msg = build_message(msg,
|
||||
'Expected make command "%s": %s' % [
|
||||
('%s %s' % [make_command, target]).rstrip,
|
||||
output,
|
||||
]
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
assert scan_make_command_lines(output).any? {|line|
|
||||
|
@ -664,6 +692,28 @@ class Gem::TestCase < Minitest::Test
|
|||
path
|
||||
end
|
||||
|
||||
##
|
||||
# Load a YAML string, the psych 3 way
|
||||
|
||||
def load_yaml(yaml)
|
||||
if YAML.respond_to?(:unsafe_load)
|
||||
YAML.unsafe_load(yaml)
|
||||
else
|
||||
YAML.load(yaml)
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Load a YAML file, the psych 3 way
|
||||
|
||||
def load_yaml_file(file)
|
||||
if YAML.respond_to?(:unsafe_load_file)
|
||||
YAML.unsafe_load_file(file)
|
||||
else
|
||||
YAML.load_file(file)
|
||||
end
|
||||
end
|
||||
|
||||
def all_spec_names
|
||||
Gem::Specification.map(&:full_name)
|
||||
end
|
||||
|
@ -1519,4 +1569,38 @@ Also, a list:
|
|||
end if Gem::HAVE_OPENSSL
|
||||
end
|
||||
|
||||
# https://github.com/seattlerb/minitest/blob/13c48a03d84a2a87855a4de0c959f96800100357/lib/minitest/mock.rb#L192
|
||||
class Object
|
||||
def stub(name, val_or_callable, *block_args)
|
||||
new_name = "__minitest_stub__#{name}"
|
||||
|
||||
metaclass = class << self; self; end
|
||||
|
||||
if respond_to? name and not methods.map(&:to_s).include? name.to_s
|
||||
metaclass.send :define_method, name do |*args|
|
||||
super(*args)
|
||||
end
|
||||
end
|
||||
|
||||
metaclass.send :alias_method, new_name, name
|
||||
|
||||
metaclass.send :define_method, name do |*args, &blk|
|
||||
if val_or_callable.respond_to? :call
|
||||
val_or_callable.call(*args, &blk)
|
||||
else
|
||||
blk.call(*block_args) if blk
|
||||
val_or_callable
|
||||
end
|
||||
end
|
||||
|
||||
metaclass.send(:ruby2_keywords, name) if metaclass.respond_to?(:ruby2_keywords, true)
|
||||
|
||||
yield self
|
||||
ensure
|
||||
metaclass.send :undef_method, name
|
||||
metaclass.send :alias_method, name, new_name
|
||||
metaclass.send :undef_method, new_name
|
||||
end
|
||||
end
|
||||
|
||||
require 'rubygems/test_utilities'
|
||||
|
|
|
@ -268,33 +268,6 @@ RSpec.describe Bundler::Definition do
|
|||
end
|
||||
end
|
||||
|
||||
describe "find_resolved_spec" do
|
||||
it "with no platform set in SpecSet" do
|
||||
ss = Bundler::SpecSet.new([build_stub_spec("a", "1.0"), build_stub_spec("b", "1.0")])
|
||||
dfn = Bundler::Definition.new(nil, [], mock_source_list, true)
|
||||
dfn.instance_variable_set("@specs", ss)
|
||||
found = dfn.find_resolved_spec(build_spec("a", "0.9", "ruby").first)
|
||||
expect(found.name).to eq "a"
|
||||
expect(found.version.to_s).to eq "1.0"
|
||||
end
|
||||
end
|
||||
|
||||
describe "find_indexed_specs" do
|
||||
it "with no platform set in indexed specs" do
|
||||
index = Bundler::Index.new
|
||||
%w[1.0.0 1.0.1 1.1.0].each {|v| index << build_stub_spec("foo", v) }
|
||||
|
||||
dfn = Bundler::Definition.new(nil, [], mock_source_list, true)
|
||||
dfn.instance_variable_set("@index", index)
|
||||
found = dfn.find_indexed_specs(build_spec("foo", "0.9", "ruby").first)
|
||||
expect(found.length).to eq 3
|
||||
end
|
||||
end
|
||||
|
||||
def build_stub_spec(name, version)
|
||||
Bundler::StubSpecification.new(name, version, nil, nil)
|
||||
end
|
||||
|
||||
def mock_source_list
|
||||
Class.new do
|
||||
def all_sources
|
||||
|
|
|
@ -234,7 +234,7 @@ RSpec.describe "bundle cache" do
|
|||
end
|
||||
end
|
||||
|
||||
bundle "config --local without wo"
|
||||
bundle "config set --local without wo"
|
||||
install_gemfile <<-G
|
||||
source "file:#{gem_repo1}"
|
||||
gem "rack"
|
||||
|
@ -250,7 +250,7 @@ RSpec.describe "bundle cache" do
|
|||
expect(the_bundle).to include_gem "rack 1.0"
|
||||
expect(the_bundle).not_to include_gems "weakling", "uninstallable"
|
||||
|
||||
bundle "config --local without wo"
|
||||
bundle "config set --local without wo"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gem "rack 1.0"
|
||||
expect(the_bundle).not_to include_gems "weakling", "uninstallable"
|
||||
|
@ -282,7 +282,7 @@ RSpec.describe "bundle cache" do
|
|||
end
|
||||
|
||||
subject do
|
||||
bundle "config --local frozen true"
|
||||
bundle "config set --local frozen true"
|
||||
bundle :cache, :raise_on_error => false
|
||||
end
|
||||
|
||||
|
@ -332,8 +332,8 @@ RSpec.describe "bundle install with gem sources" do
|
|||
simulate_new_machine
|
||||
FileUtils.rm_rf gem_repo2
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local deployment true"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
|
|
@ -124,7 +124,7 @@ RSpec.describe "bundle check" do
|
|||
gem "rack", :group => :foo
|
||||
G
|
||||
|
||||
bundle "config --local without foo"
|
||||
bundle "config set --local without foo"
|
||||
bundle :install
|
||||
|
||||
gemfile <<-G
|
||||
|
@ -217,7 +217,7 @@ RSpec.describe "bundle check" do
|
|||
gem "foo"
|
||||
G
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle "install"
|
||||
FileUtils.rm(bundled_app_lock)
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ RSpec.describe ".bundle/config" do
|
|||
|
||||
it "can be moved with an environment variable" do
|
||||
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle "install"
|
||||
|
||||
expect(bundled_app(".bundle")).not_to exist
|
||||
|
@ -57,7 +57,7 @@ RSpec.describe ".bundle/config" do
|
|||
FileUtils.mkdir_p bundled_app("omg")
|
||||
|
||||
ENV["BUNDLE_APP_CONFIG"] = "../foo"
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle "install", :dir => bundled_app("omg")
|
||||
|
||||
expect(bundled_app(".bundle")).not_to exist
|
||||
|
|
|
@ -295,7 +295,7 @@ RSpec.describe "bundle exec" do
|
|||
end
|
||||
|
||||
it "handles gems installed with --without" do
|
||||
bundle "config --local without middleware"
|
||||
bundle "config set --local without middleware"
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack" # rack 0.9.1 and 1.0 exist
|
||||
|
|
|
@ -291,7 +291,7 @@ RSpec.describe "bundle install with gem sources" do
|
|||
end
|
||||
|
||||
it "works" do
|
||||
bundle "config --local path vendor"
|
||||
bundle "config set --local path vendor"
|
||||
bundle "install"
|
||||
expect(the_bundle).to include_gems "rack 1.0"
|
||||
end
|
||||
|
@ -614,7 +614,7 @@ RSpec.describe "bundle install with gem sources" do
|
|||
it "should display a proper message to explain the problem" do
|
||||
FileUtils.chmod(0o500, cache_path)
|
||||
|
||||
bundle "config --local path vendor"
|
||||
bundle "config set --local path vendor"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include(cache_path.to_s)
|
||||
expect(err).to include("grant write permissions")
|
||||
|
@ -627,7 +627,7 @@ RSpec.describe "bundle install with gem sources" do
|
|||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack"
|
||||
G
|
||||
bundle "config --local path bundle"
|
||||
bundle "config set --local path bundle"
|
||||
bundle "install", :standalone => true
|
||||
end
|
||||
|
||||
|
|
|
@ -533,7 +533,7 @@ RSpec.describe "bundle lock" do
|
|||
#{Bundler::VERSION}
|
||||
L
|
||||
|
||||
bundle "lock --add-platform x86_64-linux", :artifice => :compact_index, :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
|
||||
bundle "lock --add-platform x86_64-linux", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
|
||||
end
|
||||
|
||||
context "when an update is available" do
|
||||
|
|
|
@ -205,8 +205,8 @@ RSpec.describe "bundle outdated" do
|
|||
end
|
||||
|
||||
it "works" do
|
||||
bundle :install, :artifice => :compact_index
|
||||
bundle :outdated, :artifice => :compact_index, :raise_on_error => false
|
||||
bundle :install, :artifice => "compact_index"
|
||||
bundle :outdated, :artifice => "compact_index", :raise_on_error => false
|
||||
|
||||
expected_output = <<~TABLE
|
||||
Gem Current Latest Requested Groups
|
||||
|
|
|
@ -29,21 +29,21 @@ RSpec.describe "post bundle message" do
|
|||
expect(out).to include(bundle_complete_message)
|
||||
expect(out).to include(installed_gems_stats)
|
||||
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
expect(out).to include(bundle_show_message)
|
||||
expect(out).to include("Gems in the group 'emo' were not installed")
|
||||
expect(out).to include(bundle_complete_message)
|
||||
expect(out).to include(installed_gems_stats)
|
||||
|
||||
bundle "config --local without emo test"
|
||||
bundle "config set --local without emo test"
|
||||
bundle :install
|
||||
expect(out).to include(bundle_show_message)
|
||||
expect(out).to include("Gems in the groups 'emo' and 'test' were not installed")
|
||||
expect(out).to include(bundle_complete_message)
|
||||
expect(out).to include("4 Gemfile dependencies, 3 gems now installed.")
|
||||
|
||||
bundle "config --local without emo obama test"
|
||||
bundle "config set --local without emo obama test"
|
||||
bundle :install
|
||||
expect(out).to include(bundle_show_message)
|
||||
expect(out).to include("Gems in the groups 'emo', 'obama' and 'test' were not installed")
|
||||
|
@ -55,28 +55,28 @@ RSpec.describe "post bundle message" do
|
|||
let(:bundle_path) { "./vendor" }
|
||||
|
||||
it "shows proper messages according to the configured groups" do
|
||||
bundle "config --local path vendor"
|
||||
bundle "config set --local path vendor"
|
||||
bundle :install
|
||||
expect(out).to include(bundle_show_path_message)
|
||||
expect(out).to_not include("Gems in the group")
|
||||
expect(out).to include(bundle_complete_message)
|
||||
|
||||
bundle "config --local path vendor"
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local path vendor"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
expect(out).to include(bundle_show_path_message)
|
||||
expect(out).to include("Gems in the group 'emo' were not installed")
|
||||
expect(out).to include(bundle_complete_message)
|
||||
|
||||
bundle "config --local path vendor"
|
||||
bundle "config --local without emo test"
|
||||
bundle "config set --local path vendor"
|
||||
bundle "config set --local without emo test"
|
||||
bundle :install
|
||||
expect(out).to include(bundle_show_path_message)
|
||||
expect(out).to include("Gems in the groups 'emo' and 'test' were not installed")
|
||||
expect(out).to include(bundle_complete_message)
|
||||
|
||||
bundle "config --local path vendor"
|
||||
bundle "config --local without emo obama test"
|
||||
bundle "config set --local path vendor"
|
||||
bundle "config set --local without emo obama test"
|
||||
bundle :install
|
||||
expect(out).to include(bundle_show_path_message)
|
||||
expect(out).to include("Gems in the groups 'emo', 'obama' and 'test' were not installed")
|
||||
|
@ -88,7 +88,7 @@ RSpec.describe "post bundle message" do
|
|||
let(:bundle_path) { bundled_app("cache") }
|
||||
|
||||
it "shows proper messages according to the configured groups" do
|
||||
bundle "config --local path #{bundle_path}"
|
||||
bundle "config set --local path #{bundle_path}"
|
||||
bundle :install
|
||||
expect(out).to include("Bundled gems are installed into `./cache`")
|
||||
expect(out).to_not include("Gems in the group")
|
||||
|
@ -100,7 +100,7 @@ RSpec.describe "post bundle message" do
|
|||
let(:bundle_path) { tmp("not_bundled_app") }
|
||||
|
||||
it "shows proper messages according to the configured groups" do
|
||||
bundle "config --local path #{bundle_path}"
|
||||
bundle "config set --local path #{bundle_path}"
|
||||
bundle :install
|
||||
expect(out).to include("Bundled gems are installed into `#{tmp("not_bundled_app")}`")
|
||||
expect(out).to_not include("Gems in the group")
|
||||
|
@ -184,19 +184,19 @@ The source does not contain any versions of 'not-a-gem'
|
|||
expect(out).not_to include("Gems in the groups")
|
||||
expect(out).to include(bundle_updated_message)
|
||||
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
bundle :update, :all => true
|
||||
expect(out).to include("Gems in the group 'emo' were not updated")
|
||||
expect(out).to include(bundle_updated_message)
|
||||
|
||||
bundle "config --local without emo test"
|
||||
bundle "config set --local without emo test"
|
||||
bundle :install
|
||||
bundle :update, :all => true
|
||||
expect(out).to include("Gems in the groups 'emo' and 'test' were not updated")
|
||||
expect(out).to include(bundle_updated_message)
|
||||
|
||||
bundle "config --local without emo obama test"
|
||||
bundle "config set --local without emo obama test"
|
||||
bundle :install
|
||||
bundle :update, :all => true
|
||||
expect(out).to include("Gems in the groups 'emo', 'obama' and 'test' were not updated")
|
||||
|
|
|
@ -649,8 +649,8 @@ RSpec.describe "bundle update" do
|
|||
end
|
||||
|
||||
it "works" do
|
||||
bundle :install, :artifice => :compact_index
|
||||
bundle "update oj", :artifice => :compact_index
|
||||
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"
|
||||
|
|
|
@ -44,8 +44,8 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
it "still works if you are not in the app directory and specify --gemfile" do
|
||||
bundle "install"
|
||||
simulate_new_machine
|
||||
bundle "config --local deployment true"
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local deployment true"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle "install --gemfile #{tmp}/bundled_app/Gemfile", :dir => tmp
|
||||
expect(the_bundle).to include_gems "rack 1.0"
|
||||
end
|
||||
|
@ -58,8 +58,8 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
end
|
||||
G
|
||||
bundle :install
|
||||
bundle "config --local deployment true"
|
||||
bundle "config --local without test"
|
||||
bundle "config set --local deployment true"
|
||||
bundle "config set --local without test"
|
||||
bundle :install
|
||||
end
|
||||
|
||||
|
@ -67,7 +67,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
skip "doesn't find bundle" if Gem.win_platform?
|
||||
|
||||
bundle :install
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install
|
||||
bundle "exec bundle check", :env => { "PATH" => path }
|
||||
end
|
||||
|
@ -81,7 +81,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
G
|
||||
|
||||
bundle :install
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install
|
||||
end
|
||||
|
||||
|
@ -104,7 +104,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
gem "rack-obama", ">= 1.0"
|
||||
G
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :artifice => "endpoint_strict_basic_authentication"
|
||||
end
|
||||
|
||||
|
@ -115,7 +115,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
end
|
||||
G
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install
|
||||
|
||||
expect(the_bundle).to include_gems "rack 1.0"
|
||||
|
@ -123,7 +123,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
|
||||
context "when replacing a host with the same host with credentials" do
|
||||
before do
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle "install"
|
||||
gemfile <<-G
|
||||
source "http://user_name:password@localgemserver.test/"
|
||||
|
@ -227,7 +227,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
gem "rack-obama"
|
||||
G
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("deployment mode")
|
||||
expect(err).to include("You have added to the Gemfile")
|
||||
|
@ -246,9 +246,9 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
expect(the_bundle).to include_gems "path_gem 1.0"
|
||||
FileUtils.rm_r lib_path("path_gem-1.0")
|
||||
|
||||
bundle "config --local path .bundle"
|
||||
bundle "config --local without development"
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local path .bundle"
|
||||
bundle "config set --local without development"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :env => { "DEBUG" => "1" }
|
||||
run "puts :WIN"
|
||||
expect(out).to eq("WIN")
|
||||
|
@ -264,8 +264,8 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
expect(the_bundle).to include_gems "path_gem 1.0"
|
||||
FileUtils.rm_r lib_path("path_gem-1.0")
|
||||
|
||||
bundle "config --local path .bundle"
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local path .bundle"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.")
|
||||
end
|
||||
|
@ -336,7 +336,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
gem "activesupport"
|
||||
G
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("deployment mode")
|
||||
expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n")
|
||||
|
@ -350,7 +350,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
gem "rack", :git => "git://hubz.com"
|
||||
G
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("deployment mode")
|
||||
expect(err).to include("You have added to the Gemfile:\n* source: git://hubz.com")
|
||||
|
@ -370,7 +370,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
gem "rack"
|
||||
G
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("deployment mode")
|
||||
expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")}")
|
||||
|
@ -394,7 +394,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
gem "foo", :git => "#{lib_path("rack")}"
|
||||
G
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("deployment mode")
|
||||
expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")}`")
|
||||
|
|
|
@ -47,7 +47,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do
|
|||
# parsed lockfile and the evaluated gemfile.
|
||||
it "bundles with deployment mode configured" do
|
||||
bundle :install
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install
|
||||
end
|
||||
end
|
||||
|
|
|
@ -291,7 +291,7 @@ RSpec.describe "bundle install from an existing gemspec" do
|
|||
s.add_dependency "activesupport", ">= 1.0.1"
|
||||
end
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :raise_on_error => false
|
||||
|
||||
expect(err).to include("changed")
|
||||
|
@ -557,7 +557,7 @@ RSpec.describe "bundle install from an existing gemspec" do
|
|||
it "installs the ruby platform gemspec and skips dev deps with `without development` configured" do
|
||||
simulate_platform "ruby"
|
||||
|
||||
bundle "config --local without development"
|
||||
bundle "config set --local without development"
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
|
||||
|
@ -567,4 +567,57 @@ RSpec.describe "bundle install from an existing gemspec" do
|
|||
expect(the_bundle).not_to include_gem "rack"
|
||||
end
|
||||
end
|
||||
|
||||
context "with multiple platforms and resolving for more specific platforms" do
|
||||
before do
|
||||
build_lib("chef", :path => tmp.join("chef")) do |s|
|
||||
s.version = "17.1.17"
|
||||
s.write "chef-universal-mingw32.gemspec", build_spec("chef", "17.1.17", "universal-mingw32") {|sw| sw.runtime "win32-api", "~> 1.5.3" }.first.to_ruby
|
||||
end
|
||||
end
|
||||
|
||||
it "does not remove the platform specific specs from the lockfile when updating" do
|
||||
build_repo4 do
|
||||
build_gem "win32-api", "1.5.3" do |s|
|
||||
s.platform = "universal-mingw32"
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
gemspec :path => "../chef"
|
||||
G
|
||||
|
||||
initial_lockfile = <<~L
|
||||
PATH
|
||||
remote: ../chef
|
||||
specs:
|
||||
chef (17.1.17)
|
||||
chef (17.1.17-universal-mingw32)
|
||||
win32-api (~> 1.5.3)
|
||||
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo4)}/
|
||||
specs:
|
||||
win32-api (1.5.3-universal-mingw32)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x64-mingw32
|
||||
x86-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
chef!
|
||||
|
||||
BUNDLED WITH
|
||||
#{Bundler::VERSION}
|
||||
L
|
||||
|
||||
lockfile initial_lockfile
|
||||
|
||||
bundle "update"
|
||||
|
||||
expect(lockfile).to eq initial_lockfile
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -128,7 +128,7 @@ RSpec.describe "bundle install with git sources" do
|
|||
end
|
||||
|
||||
it "still works after moving the application directory" do
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle "install"
|
||||
|
||||
FileUtils.mv bundled_app, tmp("bundled_app.bck")
|
||||
|
@ -137,7 +137,7 @@ RSpec.describe "bundle install with git sources" do
|
|||
end
|
||||
|
||||
it "can still install after moving the application directory" do
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle "install"
|
||||
|
||||
FileUtils.mv bundled_app, tmp("bundled_app.bck")
|
||||
|
@ -1080,7 +1080,7 @@ RSpec.describe "bundle install with git sources" do
|
|||
|
||||
simulate_new_machine
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install
|
||||
end
|
||||
end
|
||||
|
|
|
@ -86,7 +86,7 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
|
||||
it "installs gems in the default group" do
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
|
||||
end
|
||||
|
@ -117,7 +117,7 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
|
||||
it "does not install gems from the excluded group" do
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
expect(the_bundle).not_to include_gems "activesupport 2.3.5", :groups => [:default]
|
||||
end
|
||||
|
@ -130,13 +130,13 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
|
||||
it "does not say it installed gems from the excluded group" do
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
expect(out).not_to include("activesupport")
|
||||
end
|
||||
|
||||
it "allows Bundler.setup for specific groups" do
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
run("require 'rack'; puts RACK", :default)
|
||||
expect(out).to eq("1.0.0")
|
||||
|
@ -151,7 +151,7 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
G
|
||||
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "activesupport 2.3.2", :groups => [:default]
|
||||
end
|
||||
|
@ -188,7 +188,7 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
|
||||
it "installs gems from the optional group when requested" do
|
||||
bundle "config --local with debugging"
|
||||
bundle "config set --local with debugging"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "thin 1.0"
|
||||
end
|
||||
|
@ -214,13 +214,13 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
|
||||
it "removes groups from without when passed at --with", :bundler => "< 3" do
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle "install --with emo"
|
||||
expect(the_bundle).to include_gems "activesupport 2.3.5"
|
||||
end
|
||||
|
||||
it "removes groups from with when passed at --without", :bundler => "< 3" do
|
||||
bundle "config --local with debugging"
|
||||
bundle "config set --local with debugging"
|
||||
bundle "install --without debugging", :raise_on_error => false
|
||||
expect(the_bundle).not_to include_gem "thin 1.0"
|
||||
end
|
||||
|
@ -251,13 +251,13 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
|
||||
it "has no effect when listing a not optional group in with" do
|
||||
bundle "config --local with emo"
|
||||
bundle "config set --local with emo"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "activesupport 2.3.5"
|
||||
end
|
||||
|
||||
it "has no effect when listing an optional group in without" do
|
||||
bundle "config --local without debugging"
|
||||
bundle "config set --local without debugging"
|
||||
bundle :install
|
||||
expect(the_bundle).not_to include_gems "thin 1.0"
|
||||
end
|
||||
|
@ -275,13 +275,13 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
|
||||
it "installs gems in the default group" do
|
||||
bundle "config --local without emo lolercoaster"
|
||||
bundle "config set --local without emo lolercoaster"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "installs the gem if any of its groups are installed" do
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
|
||||
end
|
||||
|
@ -303,19 +303,19 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
|
||||
it "installs the gem unless all groups are excluded" do
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "activesupport 2.3.5"
|
||||
|
||||
bundle "config --local without lolercoaster"
|
||||
bundle "config set --local without lolercoaster"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "activesupport 2.3.5"
|
||||
|
||||
bundle "config --local without emo lolercoaster"
|
||||
bundle "config set --local without emo lolercoaster"
|
||||
bundle :install
|
||||
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
|
||||
|
||||
bundle "config --local without 'emo lolercoaster'"
|
||||
bundle "config set --local without 'emo lolercoaster'"
|
||||
bundle :install
|
||||
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
|
||||
end
|
||||
|
@ -336,13 +336,13 @@ RSpec.describe "bundle install with groups" do
|
|||
end
|
||||
|
||||
it "installs gems in the default group" do
|
||||
bundle "config --local without emo lolercoaster"
|
||||
bundle "config set --local without emo lolercoaster"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "installs the gem if any of its groups are installed" do
|
||||
bundle "config --local without emo"
|
||||
bundle "config set --local without emo"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
|
||||
end
|
||||
|
@ -358,7 +358,7 @@ RSpec.describe "bundle install with groups" do
|
|||
G
|
||||
|
||||
ruby <<-R
|
||||
require "#{lib_dir}/bundler"
|
||||
require "#{entrypoint}"
|
||||
Bundler.setup :default
|
||||
Bundler.require :default
|
||||
puts RACK
|
||||
|
@ -380,7 +380,7 @@ RSpec.describe "bundle install with groups" do
|
|||
|
||||
system_gems "rack-0.9.1"
|
||||
|
||||
bundle "config --local without rack"
|
||||
bundle "config set --local without rack"
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
gem "rack"
|
||||
|
@ -404,7 +404,7 @@ RSpec.describe "bundle install with groups" do
|
|||
|
||||
it "does not hit the remote a second time" do
|
||||
FileUtils.rm_rf gem_repo2
|
||||
bundle "config --local without rack"
|
||||
bundle "config set --local without rack"
|
||||
bundle :install, :verbose => true
|
||||
expect(last_command.stdboth).not_to match(/fetching/i)
|
||||
end
|
||||
|
|
|
@ -131,7 +131,7 @@ RSpec.describe "bundle install with explicit source paths" do
|
|||
gem 'foo', :path => File.expand_path("../foo-1.0", __FILE__)
|
||||
G
|
||||
|
||||
bundle "config --local frozen true"
|
||||
bundle "config set --local frozen true"
|
||||
bundle :install
|
||||
end
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ RSpec.describe "bundle install across platforms" do
|
|||
gem "rack", "1.0.0"
|
||||
G
|
||||
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install
|
||||
|
||||
FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, "1.8"))
|
||||
|
|
|
@ -20,23 +20,23 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
before do
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo3)}"
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
source "https://gem.repo3"
|
||||
source "https://gem.repo1"
|
||||
gem "rack-obama"
|
||||
gem "rack"
|
||||
G
|
||||
end
|
||||
|
||||
it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 3" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
|
||||
expect(err).to include("Installed from: #{file_uri_for(gem_repo1)}")
|
||||
expect(err).to include("Installed from: https://gem.repo1")
|
||||
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1")
|
||||
end
|
||||
|
||||
it "fails", :bundler => "3" do
|
||||
bundle :instal, :raise_on_error => false
|
||||
bundle :instal, :artifice => "compact_index", :raise_on_error => false
|
||||
expect(err).to include("Each source after the first must include a block")
|
||||
expect(exitstatus).to eq(4)
|
||||
end
|
||||
|
@ -47,22 +47,22 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
before do
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo3)}"
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
source "https://gem.repo3"
|
||||
source "https://gem.repo1"
|
||||
gem "rack-obama"
|
||||
gem "rack", "1.0.0" # force it to install the working version in repo1
|
||||
G
|
||||
end
|
||||
|
||||
it "warns about ambiguous gems, but installs anyway", :bundler => "< 3" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
|
||||
expect(err).to include("Installed from: #{file_uri_for(gem_repo1)}")
|
||||
expect(err).to include("Installed from: https://gem.repo1")
|
||||
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1")
|
||||
end
|
||||
|
||||
it "fails", :bundler => "3" do
|
||||
bundle :install, :raise_on_error => false
|
||||
bundle :install, :artifice => "compact_index", :raise_on_error => false
|
||||
expect(err).to include("Each source after the first must include a block")
|
||||
expect(exitstatus).to eq(4)
|
||||
end
|
||||
|
@ -85,8 +85,8 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo3)}"
|
||||
source "#{file_uri_for(gem_repo1)}" do
|
||||
source "https://gem.repo3"
|
||||
source "https://gem.repo1" do
|
||||
gem "thin" # comes first to test name sorting
|
||||
gem "rack"
|
||||
end
|
||||
|
@ -95,20 +95,20 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
it "installs the gems without any warning" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(err).not_to include("Warning")
|
||||
expect(the_bundle).to include_gems("rack-obama 1.0.0")
|
||||
expect(the_bundle).to include_gems("rack 1.0.0", :source => "remote1")
|
||||
end
|
||||
|
||||
it "can cache and deploy" do
|
||||
bundle :cache
|
||||
bundle :cache, :artifice => "compact_index"
|
||||
|
||||
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
|
||||
expect(bundled_app("vendor/cache/rack-obama-1.0.gem")).to exist
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle :install
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0")
|
||||
end
|
||||
|
@ -128,10 +128,10 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo3)}"
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source "https://gem.repo3"
|
||||
gem "rack-obama" # should come from repo3!
|
||||
gem "rack", :source => "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack", :source => "https://gem.repo1"
|
||||
G
|
||||
end
|
||||
|
||||
|
@ -155,8 +155,8 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
source "https://gem.repo2"
|
||||
source "https://gem.repo3" do
|
||||
gem "depends_on_rack"
|
||||
end
|
||||
G
|
||||
|
@ -168,7 +168,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
it "installs from the same source without any warning" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(err).not_to include("Warning")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3")
|
||||
end
|
||||
|
@ -185,7 +185,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
it "installs from the same source without any warning" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3")
|
||||
|
@ -193,7 +193,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
# In https://github.com/bundler/bundler/issues/3585 this failed
|
||||
# when there is already a lock file, and the gems are missing, so try again
|
||||
system_gems []
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3")
|
||||
|
@ -218,9 +218,9 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
context "and not in any other sources" do
|
||||
before do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source "https://gem.repo2"
|
||||
source "https://gem.repo3" do
|
||||
gem "depends_on_rack"
|
||||
end
|
||||
G
|
||||
|
@ -235,23 +235,23 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
context "and in yet another source" do
|
||||
before do
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
source "https://gem.repo1"
|
||||
source "https://gem.repo2"
|
||||
source "https://gem.repo3" do
|
||||
gem "depends_on_rack"
|
||||
end
|
||||
G
|
||||
end
|
||||
|
||||
it "installs from the other source and warns about ambiguous gems", :bundler => "< 3" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
|
||||
expect(err).to include("Installed from: #{file_uri_for(gem_repo2)}")
|
||||
expect(err).to include("Installed from: https://gem.repo2")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
|
||||
end
|
||||
|
||||
it "fails", :bundler => "3" do
|
||||
bundle :install, :raise_on_error => false
|
||||
bundle :install, :artifice => "compact_index", :raise_on_error => false
|
||||
expect(err).to include("Each source after the first must include a block")
|
||||
expect(exitstatus).to eq(4)
|
||||
end
|
||||
|
@ -267,16 +267,16 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo3)}" # contains depends_on_rack
|
||||
source "#{file_uri_for(gem_repo2)}" # contains broken rack
|
||||
source "https://gem.repo3" # contains depends_on_rack
|
||||
source "https://gem.repo2" # contains broken rack
|
||||
|
||||
gem "depends_on_rack" # installed from gem_repo3
|
||||
gem "rack", :source => "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack", :source => "https://gem.repo1"
|
||||
G
|
||||
end
|
||||
|
||||
it "installs the dependency from the pinned source without warning", :bundler => "< 3" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
|
||||
|
@ -284,14 +284,14 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
# In https://github.com/rubygems/bundler/issues/3585 this failed
|
||||
# when there is already a lock file, and the gems are missing, so try again
|
||||
system_gems []
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
|
||||
end
|
||||
|
||||
it "fails", :bundler => "3" do
|
||||
bundle :install, :raise_on_error => false
|
||||
bundle :install, :artifice => "compact_index", :raise_on_error => false
|
||||
expect(err).to include("Each source after the first must include a block")
|
||||
expect(exitstatus).to eq(4)
|
||||
end
|
||||
|
@ -308,29 +308,49 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
source "https://gem.repo2"
|
||||
|
||||
gem "private_gem_1"
|
||||
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
source "https://gem.repo3" do
|
||||
gem "private_gem_2"
|
||||
end
|
||||
G
|
||||
end
|
||||
|
||||
it "fails" do
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("Could not find gem 'private_gem_1' in rubygems repository #{file_uri_for(gem_repo2)}/ or installed locally.")
|
||||
bundle :install, :artifice => "compact_index", :raise_on_error => false
|
||||
expect(err).to include("Could not find gem 'private_gem_1' in rubygems repository https://gem.repo2/ or installed locally.")
|
||||
expect(err).to include("The source does not contain any versions of 'private_gem_1'")
|
||||
end
|
||||
end
|
||||
|
||||
context "when a top-level gem has an indirect dependency" do
|
||||
context "when disable_multisource is set" do
|
||||
context "when an indirect dependency can't be found in the aggregate rubygems source", :bundler => "< 3" do
|
||||
before do
|
||||
bundle "config set disable_multisource true"
|
||||
build_repo2
|
||||
|
||||
build_repo gem_repo3 do
|
||||
build_gem "depends_on_missing", "1.0.1" do |s|
|
||||
s.add_dependency "missing"
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "https://gem.repo2"
|
||||
|
||||
source "https://gem.repo3"
|
||||
|
||||
gem "depends_on_missing"
|
||||
G
|
||||
end
|
||||
|
||||
it "fails" do
|
||||
bundle :install, :artifice => "compact_index", :raise_on_error => false
|
||||
expect(err).to include("Could not find gem 'missing', which is required by gem 'depends_on_missing', in any of the sources.")
|
||||
end
|
||||
end
|
||||
|
||||
context "when a top-level gem has an indirect dependency" do
|
||||
before do
|
||||
build_repo gem_repo2 do
|
||||
build_gem "depends_on_rack", "1.0.1" do |s|
|
||||
|
@ -343,11 +363,11 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
source "https://gem.repo2"
|
||||
|
||||
gem "depends_on_rack"
|
||||
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
source "https://gem.repo3" do
|
||||
gem "unrelated_gem"
|
||||
end
|
||||
G
|
||||
|
@ -360,10 +380,12 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
end
|
||||
|
||||
it "installs all gems without warning" do
|
||||
bundle :install
|
||||
it "installs the dependency from the top-level source without warning" do
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(err).not_to include("Warning")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote2")
|
||||
expect(the_bundle).to include_gems("unrelated_gem 1.0.0", :source => "remote3")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -377,8 +399,10 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
it "does not find the dependency" do
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("Could not find gem 'rack', which is required by gem 'depends_on_rack', in any of the relevant sources")
|
||||
bundle :install, :artifice => "compact_index", :raise_on_error => false
|
||||
expect(err).to include(
|
||||
"Could not find gem 'rack', which is required by gem 'depends_on_rack', in rubygems repository https://gem.repo2/ or installed locally."
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -396,9 +420,83 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
it "installs the dependency from the top-level source without warning" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(err).not_to include("Warning")
|
||||
expect(run("require 'rack'; puts RACK")).to eq("1.0.0")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0")
|
||||
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote2")
|
||||
expect(the_bundle).to include_gems("unrelated_gem 1.0.0", :source => "remote3")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when a scoped gem has a deeply nested indirect dependency" do
|
||||
before do
|
||||
build_repo gem_repo3 do
|
||||
build_gem "depends_on_depends_on_rack", "1.0.1" do |s|
|
||||
s.add_dependency "depends_on_rack"
|
||||
end
|
||||
|
||||
build_gem "depends_on_rack", "1.0.1" do |s|
|
||||
s.add_dependency "rack"
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "https://gem.repo2"
|
||||
|
||||
source "https://gem.repo3" do
|
||||
gem "depends_on_depends_on_rack"
|
||||
end
|
||||
G
|
||||
end
|
||||
|
||||
context "and the dependency is only in the top-level source" do
|
||||
before do
|
||||
update_repo gem_repo2 do
|
||||
build_gem "rack", "1.0.0"
|
||||
end
|
||||
end
|
||||
|
||||
it "installs the dependency from the top-level source" do
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0")
|
||||
expect(the_bundle).to include_gems("rack 1.0.0", :source => "remote2")
|
||||
expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", :source => "remote3")
|
||||
end
|
||||
end
|
||||
|
||||
context "and the dependency is only in a pinned source" do
|
||||
before do
|
||||
build_repo2
|
||||
|
||||
update_repo gem_repo3 do
|
||||
build_gem "rack", "1.0.0"
|
||||
end
|
||||
end
|
||||
|
||||
it "installs the dependency from the pinned source" do
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3")
|
||||
end
|
||||
end
|
||||
|
||||
context "and the dependency is in both the top-level and a pinned source" do
|
||||
before do
|
||||
update_repo gem_repo2 do
|
||||
build_gem "rack", "1.0.0" do |s|
|
||||
s.write "lib/rack.rb", "RACK = 'FAIL'"
|
||||
end
|
||||
end
|
||||
|
||||
update_repo gem_repo3 do
|
||||
build_gem "rack", "1.0.0"
|
||||
end
|
||||
end
|
||||
|
||||
it "installs the dependency from the pinned source without warning" do
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -463,19 +561,19 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
gemfile <<-G
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
source "https://gem.repo2"
|
||||
|
||||
gem "activesupport"
|
||||
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
source "https://gem.repo3" do
|
||||
gem "sidekiq-pro"
|
||||
end
|
||||
G
|
||||
|
||||
lockfile <<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo2)}/
|
||||
remote: #{file_uri_for(gem_repo3)}/
|
||||
remote: https://gem.repo2/
|
||||
remote: https://gem.repo3/
|
||||
specs:
|
||||
activesupport (6.0.3.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
|
@ -517,7 +615,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
it "does not install newer versions or generate lockfile changes when running bundle install, and warns", :bundler => "< 3" do
|
||||
initial_lockfile = lockfile
|
||||
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.")
|
||||
|
||||
|
@ -534,7 +632,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
it "fails when running bundle install", :bundler => "3" do
|
||||
initial_lockfile = lockfile
|
||||
|
||||
bundle :install, :raise_on_error => false
|
||||
bundle :install, :artifice => "compact_index", :raise_on_error => false
|
||||
|
||||
expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.")
|
||||
|
||||
|
@ -542,7 +640,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
it "splits sections and upgrades gems when running bundle update, and doesn't warn" do
|
||||
bundle "update --all"
|
||||
bundle "update --all", :artifice => "compact_index"
|
||||
expect(err).to be_empty
|
||||
|
||||
expect(the_bundle).not_to include_gems("activesupport 6.0.3.4")
|
||||
|
@ -554,7 +652,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
expect(lockfile).to eq <<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo2)}/
|
||||
remote: https://gem.repo2/
|
||||
specs:
|
||||
activesupport (6.1.2.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
|
@ -578,7 +676,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
zeitwerk (2.4.2)
|
||||
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo3)}/
|
||||
remote: https://gem.repo3/
|
||||
specs:
|
||||
sidekiq-pro (5.2.1)
|
||||
connection_pool (>= 2.2.3)
|
||||
|
@ -597,7 +695,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
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"
|
||||
bundle "update concurrent-ruby", :artifice => "compact_index"
|
||||
expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.")
|
||||
|
||||
expect(the_bundle).to include_gems("activesupport 6.0.3.4")
|
||||
|
@ -609,8 +707,8 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
expect(lockfile).to eq <<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo2)}/
|
||||
remote: #{file_uri_for(gem_repo3)}/
|
||||
remote: https://gem.repo2/
|
||||
remote: https://gem.repo3/
|
||||
specs:
|
||||
activesupport (6.0.3.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
|
@ -652,16 +750,15 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
it "fails when running bundle update with an argument", :bundler => "3" do
|
||||
initial_lockfile = lockfile
|
||||
|
||||
bundle "update concurrent-ruby", :raise_on_error => false
|
||||
bundle "update concurrent-ruby", :artifice => "compact_index", :raise_on_error => false
|
||||
|
||||
expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.")
|
||||
|
||||
expect(lockfile).to eq(initial_lockfile)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when a top-level gem has an indirect dependency present in the default source, but with a different version from the one resolved", :bundler => "< 3" do
|
||||
context "when a top-level gem has an indirect dependency present in the default source, but with a different version from the one resolved" do
|
||||
before do
|
||||
build_lib "activesupport", "7.0.0.alpha", :path => lib_path("rails/activesupport")
|
||||
build_lib "rails", "7.0.0.alpha", :path => lib_path("rails") do |s|
|
||||
|
@ -677,7 +774,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
source "https://gem.repo2"
|
||||
|
||||
gemspec :path => "#{lib_path("rails")}"
|
||||
|
||||
|
@ -686,7 +783,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
it "installs all gems without warning" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(err).not_to include("Warning")
|
||||
expect(the_bundle).to include_gems("activesupport 7.0.0.alpha", "rails 7.0.0.alpha")
|
||||
expect(the_bundle).to include_gems("activesupport 7.0.0.alpha", :source => "path@#{lib_path("rails/activesupport")}")
|
||||
|
@ -711,9 +808,9 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
source "https://gem.repo2"
|
||||
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
source "https://gem.repo3" do
|
||||
gem "handsoap"
|
||||
end
|
||||
|
||||
|
@ -724,14 +821,14 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
it "installs from the default source without any warnings or errors and generates a proper lockfile" do
|
||||
expected_lockfile = <<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo2)}/
|
||||
remote: https://gem.repo2/
|
||||
specs:
|
||||
nokogiri (1.11.1)
|
||||
racca (~> 1.4)
|
||||
racca (1.5.2)
|
||||
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo3)}/
|
||||
remote: https://gem.repo3/
|
||||
specs:
|
||||
handsoap (0.2.5.5)
|
||||
nokogiri (>= 1.2.3)
|
||||
|
@ -747,7 +844,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
#{Bundler::VERSION}
|
||||
L
|
||||
|
||||
bundle "install --verbose"
|
||||
bundle "install --verbose", :artifice => "compact_index"
|
||||
expect(err).not_to include("Warning")
|
||||
expect(the_bundle).to include_gems("handsoap 0.2.5.5", "nokogiri 1.11.1", "racca 1.5.2")
|
||||
expect(the_bundle).to include_gems("handsoap 0.2.5.5", :source => "remote3")
|
||||
|
@ -756,7 +853,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
# Even if the gems are already installed
|
||||
FileUtils.rm bundled_app_lock
|
||||
bundle "install --verbose"
|
||||
bundle "install --verbose", :artifice => "compact_index"
|
||||
expect(err).not_to include("Warning")
|
||||
expect(the_bundle).to include_gems("handsoap 0.2.5.5", "nokogiri 1.11.1", "racca 1.5.2")
|
||||
expect(the_bundle).to include_gems("handsoap 0.2.5.5", :source => "remote3")
|
||||
|
@ -771,9 +868,9 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
build_gem "not_in_repo1", "1.0.0"
|
||||
end
|
||||
|
||||
install_gemfile <<-G, :raise_on_error => false
|
||||
source "#{file_uri_for(gem_repo3)}"
|
||||
gem "not_in_repo1", :source => "#{file_uri_for(gem_repo1)}"
|
||||
install_gemfile <<-G, :artifice => "compact_index", :raise_on_error => false
|
||||
source "https://gem.repo3"
|
||||
gem "not_in_repo1", :source => "https://gem.repo1"
|
||||
G
|
||||
end
|
||||
|
||||
|
@ -788,11 +885,11 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
lockfile <<-L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo1)}
|
||||
remote: https://gem.repo1
|
||||
specs:
|
||||
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo3)}
|
||||
remote: https://gem.repo3
|
||||
specs:
|
||||
rack (0.9.1)
|
||||
|
||||
|
@ -804,8 +901,8 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
L
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
source "https://gem.repo1"
|
||||
source "https://gem.repo3" do
|
||||
gem 'rack'
|
||||
end
|
||||
G
|
||||
|
@ -821,8 +918,8 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
let(:aggregate_gem_section_lockfile) do
|
||||
<<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo1)}/
|
||||
remote: #{file_uri_for(gem_repo3)}/
|
||||
remote: https://gem.repo1/
|
||||
remote: https://gem.repo3/
|
||||
specs:
|
||||
rack (0.9.1)
|
||||
|
||||
|
@ -840,11 +937,11 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
let(:split_gem_section_lockfile) do
|
||||
<<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo1)}/
|
||||
remote: https://gem.repo1/
|
||||
specs:
|
||||
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo3)}/
|
||||
remote: https://gem.repo3/
|
||||
specs:
|
||||
rack (0.9.1)
|
||||
|
||||
|
@ -865,8 +962,8 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
source "https://gem.repo1"
|
||||
source "https://gem.repo3" do
|
||||
gem 'rack'
|
||||
end
|
||||
G
|
||||
|
@ -877,7 +974,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
it "installs the existing lockfile but prints a warning", :bundler => "< 3" do
|
||||
bundle "config set --local deployment true"
|
||||
|
||||
bundle "install"
|
||||
bundle "install", :artifice => "compact_index"
|
||||
|
||||
expect(lockfile).to eq(aggregate_gem_section_lockfile)
|
||||
expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.")
|
||||
|
@ -887,7 +984,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
it "refuses to install the existing lockfile and prints an error", :bundler => "3" do
|
||||
bundle "config set --local deployment true"
|
||||
|
||||
bundle "install", :raise_on_error =>false
|
||||
bundle "install", :artifice => "compact_index", :raise_on_error =>false
|
||||
|
||||
expect(lockfile).to eq(aggregate_gem_section_lockfile)
|
||||
expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.")
|
||||
|
@ -900,13 +997,13 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
build_lib "foo"
|
||||
|
||||
gemfile <<-G
|
||||
gem "rack", :source => "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack", :source => "https://gem.repo1"
|
||||
gem "foo", :path => "#{lib_path("foo-1.0")}"
|
||||
G
|
||||
end
|
||||
|
||||
it "does not unlock the non-path gem after install" do
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
bundle %(exec ruby -e 'puts "OK"')
|
||||
|
||||
|
@ -919,8 +1016,8 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
before do
|
||||
system_gems "rack-0.9.1"
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source "https://gem.repo1"
|
||||
gem "rack" # should come from repo1!
|
||||
G
|
||||
end
|
||||
|
@ -941,14 +1038,14 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
# Installing this gemfile...
|
||||
gemfile <<-G
|
||||
source '#{file_uri_for(gem_repo1)}'
|
||||
source 'https://gem.repo1'
|
||||
gem 'rack'
|
||||
gem 'foo', '~> 0.1', :source => '#{file_uri_for(gem_repo4)}'
|
||||
gem 'bar', '~> 0.1', :source => '#{file_uri_for(gem_repo4)}'
|
||||
gem 'foo', '~> 0.1', :source => 'https://gem.repo4'
|
||||
gem 'bar', '~> 0.1', :source => 'https://gem.repo4'
|
||||
G
|
||||
|
||||
bundle "config --local path ../gems/system"
|
||||
bundle :install
|
||||
bundle "config set --local path ../gems/system"
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
# And then we add some new versions...
|
||||
update_repo4 do
|
||||
|
@ -959,11 +1056,11 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
it "allows them to be unlocked separately" do
|
||||
# And install this gemfile, updating only foo.
|
||||
install_gemfile <<-G
|
||||
source '#{file_uri_for(gem_repo1)}'
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source 'https://gem.repo1'
|
||||
gem 'rack'
|
||||
gem 'foo', '~> 0.2', :source => '#{file_uri_for(gem_repo4)}'
|
||||
gem 'bar', '~> 0.1', :source => '#{file_uri_for(gem_repo4)}'
|
||||
gem 'foo', '~> 0.2', :source => 'https://gem.repo4'
|
||||
gem 'bar', '~> 0.1', :source => 'https://gem.repo4'
|
||||
G
|
||||
|
||||
# It should update foo to 0.2, but not the (locked) bar 0.1
|
||||
|
@ -983,11 +1080,11 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
build_git "git1"
|
||||
build_git "git2"
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source "https://gem.repo1"
|
||||
gem "rails"
|
||||
|
||||
source "#{file_uri_for(gem_repo3)}" do
|
||||
source "https://gem.repo3" do
|
||||
gem "rack"
|
||||
end
|
||||
|
||||
|
@ -999,7 +1096,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
end
|
||||
|
||||
it "does not re-resolve" do
|
||||
bundle :install, :verbose => true
|
||||
bundle :install, :artifice => "compact_index", :verbose => true
|
||||
expect(out).to include("using resolution from the lockfile")
|
||||
expect(out).not_to include("re-resolving dependencies")
|
||||
end
|
||||
|
@ -1008,27 +1105,24 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
context "when a gem is installed to system gems" do
|
||||
before do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source "https://gem.repo1"
|
||||
gem "rack"
|
||||
G
|
||||
end
|
||||
|
||||
context "and the gemfile changes" do
|
||||
it "is still able to find that gem from remote sources" do
|
||||
source_uri = file_uri_for(gem_repo1)
|
||||
second_uri = file_uri_for(gem_repo4)
|
||||
|
||||
build_repo4 do
|
||||
build_gem "rack", "2.0.1.1.forked"
|
||||
build_gem "thor", "0.19.1.1.forked"
|
||||
end
|
||||
|
||||
# When this gemfile is installed...
|
||||
install_gemfile <<-G
|
||||
source "#{source_uri}"
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source "https://gem.repo1"
|
||||
|
||||
source "#{second_uri}" do
|
||||
source "https://gem.repo4" do
|
||||
gem "rack", "2.0.1.1.forked"
|
||||
gem "thor"
|
||||
end
|
||||
|
@ -1037,9 +1131,9 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
# Then we change the Gemfile by adding a version to thor
|
||||
gemfile <<-G
|
||||
source "#{source_uri}"
|
||||
source "https://gem.repo1"
|
||||
|
||||
source "#{second_uri}" do
|
||||
source "https://gem.repo4" do
|
||||
gem "rack", "2.0.1.1.forked"
|
||||
gem "thor", "0.19.1.1.forked"
|
||||
end
|
||||
|
@ -1047,15 +1141,15 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
G
|
||||
|
||||
# But we should still be able to find rack 2.0.1.1.forked and install it
|
||||
bundle :install
|
||||
bundle :install, :artifice => "compact_index"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "source changed to one containing a higher version of a dependency" do
|
||||
before do
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source "https://gem.repo1"
|
||||
|
||||
gem "rack"
|
||||
G
|
||||
|
@ -1072,8 +1166,8 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
s.add_dependency "bar", "=1.0.0"
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source "https://gem.repo2"
|
||||
gem "rack"
|
||||
gemspec :path => "#{tmp.join("gemspec_test")}"
|
||||
G
|
||||
|
@ -1093,10 +1187,10 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
build_gem "example", "1.0.2"
|
||||
end
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
install_gemfile <<-G, :artifice => "compact_index"
|
||||
source "https://gem.repo4"
|
||||
|
||||
gem "example", :source => "#{file_uri_for(gem_repo2)}"
|
||||
gem "example", :source => "https://gem.repo2"
|
||||
G
|
||||
|
||||
bundle "info example"
|
||||
|
@ -1104,12 +1198,41 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
|
||||
system_gems "example-1.0.2", :path => default_bundle_path, :gem_repo => gem_repo4
|
||||
|
||||
bundle "update example --verbose"
|
||||
bundle "update example --verbose", :artifice => "compact_index"
|
||||
expect(out).not_to include("Using example 1.0.2")
|
||||
expect(out).to include("Using example 0.1.0")
|
||||
end
|
||||
|
||||
context "when a gem is available from multiple ambiguous sources", :bundler => "3" do
|
||||
context "when an indirect dependency is available from multiple ambiguous sources", :bundler => "< 3" do
|
||||
it "succeeds but warns, suggesting a source block" do
|
||||
build_repo4 do
|
||||
build_gem "depends_on_rack" do |s|
|
||||
s.add_dependency "rack"
|
||||
end
|
||||
build_gem "rack"
|
||||
end
|
||||
|
||||
install_gemfile <<-G, :artifice => "compact_index", :raise_on_error => false
|
||||
source "https://gem.repo4" do
|
||||
gem "depends_on_rack"
|
||||
end
|
||||
|
||||
source "https://gem.repo1" do
|
||||
gem "thin"
|
||||
end
|
||||
G
|
||||
expect(err).to eq strip_whitespace(<<-EOS).strip
|
||||
Warning: The gem 'rack' was found in multiple relevant sources.
|
||||
* rubygems repository https://gem.repo1/ or installed locally
|
||||
* rubygems repository https://gem.repo4/ or installed locally
|
||||
You should add this gem to the source block for the source you wish it to be installed from.
|
||||
EOS
|
||||
expect(last_command).to be_success
|
||||
expect(the_bundle).to be_locked
|
||||
end
|
||||
end
|
||||
|
||||
context "when an indirect dependency is available from multiple ambiguous sources", :bundler => "3" do
|
||||
it "raises, suggesting a source block" do
|
||||
build_repo4 do
|
||||
build_gem "depends_on_rack" do |s|
|
||||
|
@ -1118,18 +1241,19 @@ RSpec.describe "bundle install with gems on multiple sources" do
|
|||
build_gem "rack"
|
||||
end
|
||||
|
||||
install_gemfile <<-G, :raise_on_error => false
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
source "#{file_uri_for(gem_repo1)}" do
|
||||
install_gemfile <<-G, :artifice => "compact_index", :raise_on_error => false
|
||||
source "https://gem.repo4" do
|
||||
gem "depends_on_rack"
|
||||
end
|
||||
source "https://gem.repo1" do
|
||||
gem "thin"
|
||||
end
|
||||
gem "depends_on_rack"
|
||||
G
|
||||
expect(last_command).to be_failure
|
||||
expect(err).to eq strip_whitespace(<<-EOS).strip
|
||||
The gem 'rack' was found in multiple relevant sources.
|
||||
* rubygems repository #{file_uri_for(gem_repo1)}/ or installed locally
|
||||
* rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally
|
||||
* rubygems repository https://gem.repo1/ or installed locally
|
||||
* rubygems repository https://gem.repo4/ or installed locally
|
||||
You must add this gem to the source block for the source you wish it to be installed from.
|
||||
EOS
|
||||
expect(the_bundle).not_to be_locked
|
||||
|
|
|
@ -141,10 +141,10 @@ RSpec.describe "bundle install with specific platforms" do
|
|||
2.1.4
|
||||
L
|
||||
|
||||
bundle "install --verbose", :artifice => :compact_index, :env => { "BUNDLER_VERSION" => "2.1.4", "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
|
||||
bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_VERSION" => "2.1.4", "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
|
||||
expect(out).to include("Installing libv8 8.4.255.0 (universal-darwin)")
|
||||
|
||||
bundle "add mini_racer --verbose", :artifice => :compact_index, :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
|
||||
bundle "add mini_racer --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
|
||||
expect(out).to include("Using libv8 8.4.255.0 (universal-darwin)")
|
||||
end
|
||||
|
||||
|
|
|
@ -80,8 +80,8 @@ RSpec.describe "compact index api" do
|
|||
G
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local deployment true"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install, :artifice => "compact_index"
|
||||
expect(out).to include("Fetching gem metadata from #{source_uri}")
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
|
@ -118,7 +118,7 @@ RSpec.describe "compact index api" do
|
|||
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
expect(the_bundle).to include_gems("rails 2.3.2")
|
||||
|
@ -132,7 +132,7 @@ RSpec.describe "compact index api" do
|
|||
G
|
||||
|
||||
bundle "install", :artifice => "compact_index"
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :artifice => "compact_index"
|
||||
|
||||
expect(the_bundle).to include_gems("foo 1.0")
|
||||
|
@ -366,31 +366,6 @@ The checksum of /versions does not match the checksum provided by the server! So
|
|||
expect(the_bundle).to include_gems "activesupport 1.2.3"
|
||||
end
|
||||
|
||||
it "considers all possible versions of dependencies from all api gem sources when using blocks", :bundler => "< 3" do
|
||||
# In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that
|
||||
# exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0
|
||||
# of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other
|
||||
# repo and installs it.
|
||||
build_repo4 do
|
||||
build_gem "activesupport", "1.2.0"
|
||||
build_gem "somegem", "1.0.0" do |s|
|
||||
s.add_dependency "activesupport", "1.2.3" # This version exists only in repo1
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{source_uri}"
|
||||
source "#{source_uri}/extra" do
|
||||
gem 'somegem', '1.0.0'
|
||||
end
|
||||
G
|
||||
|
||||
bundle :install, :artifice => "compact_index_extra_api"
|
||||
|
||||
expect(the_bundle).to include_gems "somegem 1.0.0"
|
||||
expect(the_bundle).to include_gems "activesupport 1.2.3"
|
||||
end
|
||||
|
||||
it "prints API output properly with back deps" do
|
||||
build_repo2 do
|
||||
build_gem "back_deps" do |s|
|
||||
|
@ -467,7 +442,7 @@ The checksum of /versions does not match the checksum provided by the server! So
|
|||
expect(the_bundle).to include_gems "foo 1.0"
|
||||
end
|
||||
|
||||
it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do
|
||||
it "fetches again when more dependencies are found in subsequent sources using deployment mode", :bundler => "< 3" do
|
||||
build_repo2 do
|
||||
build_gem "back_deps" do |s|
|
||||
s.add_dependency "foo"
|
||||
|
@ -482,8 +457,8 @@ The checksum of /versions does not match the checksum provided by the server! So
|
|||
G
|
||||
|
||||
bundle :install, :artifice => "compact_index_extra"
|
||||
|
||||
bundle "install --deployment", :artifice => "compact_index_extra"
|
||||
bundle "config --set local deployment true"
|
||||
bundle :install, :artifice => "compact_index_extra"
|
||||
expect(the_bundle).to include_gems "back_deps 1.0"
|
||||
end
|
||||
|
||||
|
@ -503,7 +478,7 @@ The checksum of /versions does not match the checksum provided by the server! So
|
|||
G
|
||||
|
||||
bundle :install, :artifice => "compact_index_extra"
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :artifice => "compact_index_extra"
|
||||
expect(the_bundle).to include_gems "back_deps 1.0"
|
||||
end
|
||||
|
|
|
@ -60,8 +60,8 @@ RSpec.describe "gemcutter's dependency API" do
|
|||
G
|
||||
bundle :install, :artifice => "endpoint"
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local deployment true"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install, :artifice => "endpoint"
|
||||
expect(out).to include("Fetching gem metadata from #{source_uri}")
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
|
@ -98,7 +98,7 @@ RSpec.describe "gemcutter's dependency API" do
|
|||
|
||||
bundle :install, :artifice => "endpoint"
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :artifice => "endpoint"
|
||||
|
||||
expect(the_bundle).to include_gems("rails 2.3.2")
|
||||
|
@ -112,7 +112,7 @@ RSpec.describe "gemcutter's dependency API" do
|
|||
G
|
||||
|
||||
bundle "install", :artifice => "endpoint"
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :artifice => "endpoint"
|
||||
|
||||
expect(the_bundle).to include_gems("foo 1.0")
|
||||
|
@ -338,31 +338,6 @@ RSpec.describe "gemcutter's dependency API" do
|
|||
expect(the_bundle).to include_gems "activesupport 1.2.3"
|
||||
end
|
||||
|
||||
it "considers all possible versions of dependencies from all api gem sources using blocks" do
|
||||
# In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that
|
||||
# exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0
|
||||
# of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other
|
||||
# repo and installs it.
|
||||
build_repo4 do
|
||||
build_gem "activesupport", "1.2.0"
|
||||
build_gem "somegem", "1.0.0" do |s|
|
||||
s.add_dependency "activesupport", "1.2.3" # This version exists only in repo1
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<-G
|
||||
source "#{source_uri}"
|
||||
source "#{source_uri}/extra" do
|
||||
gem 'somegem', '1.0.0'
|
||||
end
|
||||
G
|
||||
|
||||
bundle :install, :artifice => "endpoint_extra_api"
|
||||
|
||||
expect(the_bundle).to include_gems "somegem 1.0.0"
|
||||
expect(the_bundle).to include_gems "activesupport 1.2.3"
|
||||
end
|
||||
|
||||
it "prints API output properly with back deps" do
|
||||
build_repo2 do
|
||||
build_gem "back_deps" do |s|
|
||||
|
@ -438,7 +413,7 @@ RSpec.describe "gemcutter's dependency API" do
|
|||
expect(the_bundle).to include_gems "foo 1.0"
|
||||
end
|
||||
|
||||
it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do
|
||||
it "fetches again when more dependencies are found in subsequent sources using deployment mode", :bundler => "< 3" do
|
||||
build_repo2 do
|
||||
build_gem "back_deps" do |s|
|
||||
s.add_dependency "foo"
|
||||
|
@ -453,8 +428,8 @@ RSpec.describe "gemcutter's dependency API" do
|
|||
G
|
||||
|
||||
bundle :install, :artifice => "endpoint_extra"
|
||||
|
||||
bundle "install --deployment", :artifice => "endpoint_extra"
|
||||
bundle "config set --local deployment true"
|
||||
bundle :install, :artifice => "endpoint_extra"
|
||||
expect(the_bundle).to include_gems "back_deps 1.0"
|
||||
end
|
||||
|
||||
|
@ -474,8 +449,7 @@ RSpec.describe "gemcutter's dependency API" do
|
|||
G
|
||||
|
||||
bundle :install, :artifice => "endpoint_extra"
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
bundle "install", :artifice => "endpoint_extra"
|
||||
expect(the_bundle).to include_gems "back_deps 1.0"
|
||||
end
|
||||
|
|
|
@ -94,7 +94,7 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rails"
|
||||
G
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
bundle :install, :standalone => true, :dir => cwd
|
||||
end
|
||||
|
||||
|
@ -110,7 +110,7 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
|
||||
describe "with gems with native extension", :ruby_repo do
|
||||
before do
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
install_gemfile <<-G, :standalone => true, :dir => cwd
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "very_simple_binary"
|
||||
|
@ -144,7 +144,7 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
end
|
||||
G
|
||||
end
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
install_gemfile <<-G, :standalone => true, :dir => cwd, :raise_on_error => false
|
||||
gem "bar", :git => "#{lib_path("bar-1.0")}"
|
||||
G
|
||||
|
@ -165,7 +165,7 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
gem "rails"
|
||||
gem "devise", :git => "#{lib_path("devise-1.0")}"
|
||||
G
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
bundle :install, :standalone => true, :dir => cwd
|
||||
end
|
||||
|
||||
|
@ -193,7 +193,7 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
gem "rack-test"
|
||||
end
|
||||
G
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
bundle :install, :standalone => true, :dir => cwd
|
||||
end
|
||||
|
||||
|
@ -207,7 +207,7 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
include_examples "common functionality"
|
||||
|
||||
it "allows creating a standalone file with limited groups" do
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
bundle :install, :standalone => "default", :dir => cwd
|
||||
|
||||
load_error_ruby <<-RUBY, "spec"
|
||||
|
@ -224,8 +224,8 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
end
|
||||
|
||||
it "allows `without` configuration to limit the groups used in a standalone" do
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config --local without test"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local without test"
|
||||
bundle :install, :standalone => true, :dir => cwd
|
||||
|
||||
load_error_ruby <<-RUBY, "spec"
|
||||
|
@ -242,7 +242,7 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
end
|
||||
|
||||
it "allows `path` configuration to change the location of the standalone bundle" do
|
||||
bundle "config --local path path/to/bundle"
|
||||
bundle "config set --local path path/to/bundle"
|
||||
bundle "install", :standalone => true, :dir => cwd
|
||||
|
||||
ruby <<-RUBY
|
||||
|
@ -257,9 +257,9 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
end
|
||||
|
||||
it "allows `without` to limit the groups used in a standalone" do
|
||||
bundle "config --local without test"
|
||||
bundle "config set --local without test"
|
||||
bundle :install, :dir => cwd
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
bundle :install, :standalone => true, :dir => cwd
|
||||
|
||||
load_error_ruby <<-RUBY, "spec"
|
||||
|
@ -285,7 +285,7 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
source "#{source_uri}"
|
||||
gem "rails"
|
||||
G
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
bundle :install, :standalone => true, :artifice => "endpoint", :dir => cwd
|
||||
end
|
||||
|
||||
|
@ -306,7 +306,7 @@ RSpec.shared_examples "bundle install --standalone" do
|
|||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rails"
|
||||
G
|
||||
bundle "config --local path #{bundled_app("bundle")}"
|
||||
bundle "config set --local path #{bundled_app("bundle")}"
|
||||
bundle :install, :standalone => true, :binstubs => true, :dir => cwd
|
||||
end
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@ RSpec.describe "bundle install" do
|
|||
foo!
|
||||
L
|
||||
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config --local without development"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle "config set --local without development"
|
||||
bundle :install
|
||||
|
||||
expect(out).to include("Bundle complete!")
|
||||
|
|
|
@ -14,14 +14,14 @@ RSpec.describe "bundle install" do
|
|||
end
|
||||
|
||||
it "does not use available system gems with `vendor/bundle" do
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "uses system gems with `path.system` configured with more priority than `path`" do
|
||||
bundle "config --local path.system true"
|
||||
bundle "config --global path vendor/bundle"
|
||||
bundle "config set --local path.system true"
|
||||
bundle "config set --global path vendor/bundle"
|
||||
bundle :install
|
||||
run "require 'rack'", :raise_on_error => false
|
||||
expect(out).to include("FAIL")
|
||||
|
@ -31,7 +31,7 @@ RSpec.describe "bundle install" do
|
|||
dir = bundled_app("bun++dle")
|
||||
dir.mkpath
|
||||
|
||||
bundle "config --local path #{dir.join("vendor/bundle")}"
|
||||
bundle "config set --local path #{dir.join("vendor/bundle")}"
|
||||
bundle :install, :dir => dir
|
||||
expect(out).to include("installed into `./vendor/bundle`")
|
||||
|
||||
|
@ -39,7 +39,7 @@ RSpec.describe "bundle install" do
|
|||
end
|
||||
|
||||
it "prints a message to let the user know where gems where installed" do
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install
|
||||
expect(out).to include("gems are installed into `./vendor/bundle`")
|
||||
end
|
||||
|
@ -109,7 +109,7 @@ RSpec.describe "bundle install" do
|
|||
context "when set via #{type}" do
|
||||
it "installs gems to a path if one is specified" do
|
||||
set_bundle_path(type, bundled_app("vendor2").to_s)
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install
|
||||
|
||||
expect(vendored_gems("gems/rack-1.0.0")).to be_directory
|
||||
|
@ -159,7 +159,7 @@ RSpec.describe "bundle install" do
|
|||
end
|
||||
|
||||
it "sets BUNDLE_PATH as the first argument to bundle install" do
|
||||
bundle "config --local path ./vendor/bundle"
|
||||
bundle "config set --local path ./vendor/bundle"
|
||||
bundle :install
|
||||
|
||||
expect(vendored_gems("gems/rack-1.0.0")).to be_directory
|
||||
|
@ -169,7 +169,7 @@ RSpec.describe "bundle install" do
|
|||
it "disables system gems when passing a path to install" do
|
||||
# This is so that vendored gems can be distributed to others
|
||||
build_gem "rack", "1.1.0", :to_system => true
|
||||
bundle "config --local path ./vendor/bundle"
|
||||
bundle "config set --local path ./vendor/bundle"
|
||||
bundle :install
|
||||
|
||||
expect(vendored_gems("gems/rack-1.0.0")).to be_directory
|
||||
|
@ -186,7 +186,7 @@ RSpec.describe "bundle install" do
|
|||
gem "very_simple_binary"
|
||||
G
|
||||
|
||||
bundle "config --local path ./vendor/bundle"
|
||||
bundle "config set --local path ./vendor/bundle"
|
||||
bundle :install
|
||||
|
||||
expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory
|
||||
|
@ -198,7 +198,7 @@ RSpec.describe "bundle install" do
|
|||
run "require 'very_simple_binary_c'", :raise_on_error => false
|
||||
expect(err).to include("Bundler::GemNotFound")
|
||||
|
||||
bundle "config --local path ./vendor/bundle"
|
||||
bundle "config set --local path ./vendor/bundle"
|
||||
bundle :install
|
||||
|
||||
expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory
|
||||
|
@ -218,7 +218,7 @@ RSpec.describe "bundle install" do
|
|||
gem "rack"
|
||||
G
|
||||
|
||||
bundle "config --local path bundle"
|
||||
bundle "config set --local path bundle"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("file already exists")
|
||||
end
|
||||
|
|
|
@ -1193,7 +1193,7 @@ RSpec.describe "the lockfile format" do
|
|||
gem "omg", :git => "#{lib_path("omg")}", :branch => 'master'
|
||||
G
|
||||
|
||||
bundle "config --local path vendor"
|
||||
bundle "config set --local path vendor"
|
||||
bundle :install
|
||||
expect(the_bundle).to include_gems "omg 1.0"
|
||||
|
||||
|
@ -1347,7 +1347,7 @@ RSpec.describe "the lockfile format" do
|
|||
|
||||
expect do
|
||||
ruby <<-RUBY
|
||||
require '#{lib_dir}/bundler'
|
||||
require '#{entrypoint}'
|
||||
Bundler.setup
|
||||
RUBY
|
||||
end.not_to change { File.mtime(bundled_app_lock) }
|
||||
|
|
|
@ -439,7 +439,7 @@ RSpec.describe "major deprecations" do
|
|||
G
|
||||
|
||||
ruby <<-RUBY
|
||||
require '#{lib_dir}/bundler'
|
||||
require '#{entrypoint}'
|
||||
|
||||
Bundler.setup
|
||||
Bundler.setup
|
||||
|
@ -547,18 +547,6 @@ The :gist git source is deprecated, and will be removed in the future. Add this
|
|||
G
|
||||
end
|
||||
|
||||
context "without flags" do
|
||||
before do
|
||||
bundle :show
|
||||
end
|
||||
|
||||
it "prints a deprecation warning recommending `bundle list`", :bundler => "< 3" do
|
||||
expect(deprecations).to include("use `bundle list` instead of `bundle show`")
|
||||
end
|
||||
|
||||
pending "fails with a helpful message", :bundler => "3"
|
||||
end
|
||||
|
||||
context "with --outdated flag" do
|
||||
before do
|
||||
bundle "show --outdated"
|
||||
|
@ -570,54 +558,6 @@ The :gist git source is deprecated, and will be removed in the future. Add this
|
|||
|
||||
pending "fails with a helpful message", :bundler => "3"
|
||||
end
|
||||
|
||||
context "with --verbose flag" do
|
||||
before do
|
||||
bundle "show --verbose"
|
||||
end
|
||||
|
||||
it "prints a deprecation warning informing about its removal", :bundler => "< 3" do
|
||||
expect(deprecations).to include("the `--verbose` flag to `bundle show` was undocumented and will be removed without replacement")
|
||||
end
|
||||
|
||||
pending "fails with a helpful message", :bundler => "3"
|
||||
end
|
||||
|
||||
context "with a gem argument" do
|
||||
before do
|
||||
bundle "show rack"
|
||||
end
|
||||
|
||||
it "prints a deprecation warning recommending `bundle info`", :bundler => "< 3" do
|
||||
expect(deprecations).to include("use `bundle info rack` instead of `bundle show rack`")
|
||||
end
|
||||
|
||||
pending "fails with a helpful message", :bundler => "3"
|
||||
end
|
||||
|
||||
context "with the --paths option" do
|
||||
before do
|
||||
bundle "show --paths"
|
||||
end
|
||||
|
||||
it "prints a deprecation warning recommending `bundle list`", :bundler => "< 3" do
|
||||
expect(deprecations).to include("use `bundle list` instead of `bundle show --paths`")
|
||||
end
|
||||
|
||||
pending "fails with a helpful message", :bundler => "3"
|
||||
end
|
||||
|
||||
context "with a gem argument and the --paths option" do
|
||||
before do
|
||||
bundle "show rack --paths"
|
||||
end
|
||||
|
||||
it "prints deprecation warning recommending `bundle info`", :bundler => "< 3" do
|
||||
expect(deprecations).to include("use `bundle info rack --path` instead of `bundle show rack --paths`")
|
||||
end
|
||||
|
||||
pending "fails with a helpful message", :bundler => "3"
|
||||
end
|
||||
end
|
||||
|
||||
context "bundle console" do
|
||||
|
|
|
@ -228,7 +228,7 @@ RSpec.describe "bundler plugin install" do
|
|||
gem 'rack', "1.0.0"
|
||||
G
|
||||
|
||||
bundle "config --local deployment true"
|
||||
bundle "config set --local deployment true"
|
||||
install_gemfile <<-G
|
||||
source '#{file_uri_for(gem_repo2)}'
|
||||
plugin 'foo'
|
||||
|
|
|
@ -132,7 +132,7 @@ RSpec.describe "real source plugins" do
|
|||
end
|
||||
|
||||
it "copies repository to vendor cache and uses it even when installed with `path` configured" do
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install
|
||||
bundle "config set cache_all true"
|
||||
bundle :cache
|
||||
|
@ -144,7 +144,7 @@ RSpec.describe "real source plugins" do
|
|||
end
|
||||
|
||||
it "bundler package copies repository to vendor cache" do
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install
|
||||
bundle "config set cache_all true"
|
||||
bundle :cache
|
||||
|
|
|
@ -224,7 +224,7 @@ RSpec.describe "The library itself" do
|
|||
end
|
||||
|
||||
it "ships the correct set of files" do
|
||||
git_list = git_ls_files(ruby_core? ? "lib/bundler lib/bundler.rb man/bundle* man/gemfile* libexec/bundle*" : "lib man exe CHANGELOG.md LICENSE.md README.md bundler.gemspec")
|
||||
git_list = git_ls_files(ruby_core? ? "lib/bundler lib/bundler.rb libexec/bundle*" : "lib exe CHANGELOG.md LICENSE.md README.md bundler.gemspec")
|
||||
|
||||
gem_list = loaded_gemspec.files
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ RSpec.describe "double checking sources", :realworld => true do
|
|||
RUBY
|
||||
|
||||
cmd = <<-RUBY
|
||||
require "#{lib_dir}/bundler"
|
||||
require "#{entrypoint}"
|
||||
require "#{spec_dir}/support/artifice/vcr"
|
||||
require "#{lib_dir}/bundler/inline"
|
||||
require "#{entrypoint}/inline"
|
||||
gemfile(true) do
|
||||
source "https://rubygems.org"
|
||||
gem "rails", path: "."
|
||||
|
|
|
@ -4,9 +4,9 @@ RSpec.describe "real world edgecases", :realworld => true do
|
|||
def rubygems_version(name, requirement)
|
||||
ruby <<-RUBY
|
||||
require "#{spec_dir}/support/artifice/vcr"
|
||||
require "#{lib_dir}/bundler"
|
||||
require "#{lib_dir}/bundler/source/rubygems/remote"
|
||||
require "#{lib_dir}/bundler/fetcher"
|
||||
require "#{entrypoint}"
|
||||
require "#{entrypoint}/source/rubygems/remote"
|
||||
require "#{entrypoint}/fetcher"
|
||||
rubygem = Bundler.ui.silence do
|
||||
source = Bundler::Source::Rubygems::Remote.new(Bundler::URI("https://rubygems.org"))
|
||||
fetcher = Bundler::Fetcher.new(source)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
RSpec.describe "bundler/inline#gemfile" do
|
||||
def script(code, options = {})
|
||||
requires = ["#{lib_dir}/bundler/inline"]
|
||||
requires = ["#{entrypoint}/inline"]
|
||||
requires.unshift "#{spec_dir}/support/artifice/" + options.delete(:artifice) if options.key?(:artifice)
|
||||
requires = requires.map {|r| "require '#{r}'" }.join("\n")
|
||||
ruby("#{requires}\n\n" + code, options)
|
||||
|
@ -93,7 +93,7 @@ RSpec.describe "bundler/inline#gemfile" do
|
|||
|
||||
it "lets me use my own ui object" do
|
||||
script <<-RUBY, :artifice => "endpoint"
|
||||
require '#{lib_dir}/bundler'
|
||||
require '#{entrypoint}'
|
||||
class MyBundlerUI < Bundler::UI::Silent
|
||||
def confirm(msg, newline = nil)
|
||||
puts "CONFIRMED!"
|
||||
|
@ -110,7 +110,7 @@ RSpec.describe "bundler/inline#gemfile" do
|
|||
|
||||
it "has an option for quiet installation" do
|
||||
script <<-RUBY, :artifice => "endpoint"
|
||||
require '#{lib_dir}/bundler/inline'
|
||||
require '#{entrypoint}/inline'
|
||||
|
||||
gemfile(true, :quiet => true) do
|
||||
source "https://notaserver.com"
|
||||
|
@ -136,7 +136,7 @@ RSpec.describe "bundler/inline#gemfile" do
|
|||
|
||||
it "does not mutate the option argument" do
|
||||
script <<-RUBY
|
||||
require '#{lib_dir}/bundler'
|
||||
require '#{entrypoint}'
|
||||
options = { :ui => Bundler::UI::Shell.new }
|
||||
gemfile(false, options) do
|
||||
path "#{lib_path}" do
|
||||
|
@ -218,7 +218,7 @@ RSpec.describe "bundler/inline#gemfile" do
|
|||
rake
|
||||
|
||||
BUNDLED WITH
|
||||
1.13.6
|
||||
#{Bundler::VERSION}
|
||||
G
|
||||
|
||||
script <<-RUBY
|
||||
|
|
|
@ -82,7 +82,7 @@ RSpec.describe "Bundler.load" do
|
|||
G
|
||||
|
||||
ruby <<-RUBY
|
||||
require "#{lib_dir}/bundler"
|
||||
require "#{entrypoint}"
|
||||
Bundler.setup :default
|
||||
Bundler.require :default
|
||||
puts RACK
|
||||
|
|
|
@ -22,7 +22,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
|
|||
|
||||
ruby <<-R
|
||||
begin
|
||||
require '#{lib_dir}/bundler'
|
||||
require '#{entrypoint}'
|
||||
Bundler.ui.silence { Bundler.setup }
|
||||
rescue Bundler::GemNotFound => e
|
||||
puts "WIN"
|
||||
|
|
|
@ -192,7 +192,7 @@ RSpec.describe "Bundler.require" do
|
|||
G
|
||||
|
||||
cmd = <<-RUBY
|
||||
require '#{lib_dir}/bundler'
|
||||
require '#{entrypoint}'
|
||||
Bundler.require
|
||||
RUBY
|
||||
ruby(cmd)
|
||||
|
|
|
@ -108,8 +108,8 @@ RSpec.describe "Bundler.setup" do
|
|||
context "load order" do
|
||||
def clean_load_path(lp)
|
||||
without_bundler_load_path = ruby("puts $LOAD_PATH").split("\n")
|
||||
lp -= without_bundler_load_path
|
||||
lp.map! {|p| p.sub(/^#{Regexp.union system_gem_path.to_s, default_bundle_path.to_s, lib_dir.to_s}/i, "") }
|
||||
lp -= [*without_bundler_load_path, lib_dir.to_s]
|
||||
lp.map! {|p| p.sub(system_gem_path.to_s, "") }
|
||||
end
|
||||
|
||||
it "puts loaded gems after -I and RUBYLIB", :ruby_repo do
|
||||
|
@ -143,12 +143,8 @@ RSpec.describe "Bundler.setup" do
|
|||
gem "rails"
|
||||
G
|
||||
|
||||
# We require an absolute path because relying on the $LOAD_PATH behaves
|
||||
# inconsistently depending on whether we're in a ruby-core setup (and
|
||||
# bundler's lib is in RUBYLIB) or not.
|
||||
|
||||
ruby <<-RUBY
|
||||
require '#{lib_dir}/bundler'
|
||||
require 'bundler'
|
||||
Bundler.setup
|
||||
puts $LOAD_PATH
|
||||
RUBY
|
||||
|
@ -157,7 +153,6 @@ RSpec.describe "Bundler.setup" do
|
|||
|
||||
expect(load_path).to start_with(
|
||||
"/gems/rails-2.3.2/lib",
|
||||
"/gems/bundler-#{Bundler::VERSION}/lib",
|
||||
"/gems/activeresource-2.3.2/lib",
|
||||
"/gems/activerecord-2.3.2/lib",
|
||||
"/gems/actionpack-2.3.2/lib",
|
||||
|
@ -168,6 +163,8 @@ RSpec.describe "Bundler.setup" do
|
|||
end
|
||||
|
||||
it "falls back to order the load path alphabetically for backwards compatibility" do
|
||||
bundle "config set path.system true"
|
||||
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "weakling"
|
||||
|
@ -175,12 +172,8 @@ RSpec.describe "Bundler.setup" do
|
|||
gem "terranova"
|
||||
G
|
||||
|
||||
# We require an absolute path because relying on the $LOAD_PATH behaves
|
||||
# inconsistently depending on whether we're in a ruby-core setup (and
|
||||
# bundler's lib is in RUBYLIB) or not.
|
||||
|
||||
ruby <<-RUBY
|
||||
require '#{lib_dir}/bundler/setup'
|
||||
require 'bundler/setup'
|
||||
puts $LOAD_PATH
|
||||
RUBY
|
||||
|
||||
|
@ -200,8 +193,6 @@ RSpec.describe "Bundler.setup" do
|
|||
gem "rack"
|
||||
G
|
||||
|
||||
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler" : "bundler"
|
||||
|
||||
ruby <<-R
|
||||
require '#{entrypoint}'
|
||||
|
||||
|
@ -474,8 +465,6 @@ RSpec.describe "Bundler.setup" do
|
|||
|
||||
break_git!
|
||||
|
||||
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler" : "bundler"
|
||||
|
||||
ruby <<-R
|
||||
require "#{entrypoint}"
|
||||
|
||||
|
@ -493,14 +482,14 @@ RSpec.describe "Bundler.setup" do
|
|||
end
|
||||
|
||||
it "works even when the cache directory has been deleted" do
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install
|
||||
FileUtils.rm_rf vendored_gems("cache")
|
||||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do
|
||||
bundle "config --local path vendor/bundle"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :install
|
||||
|
||||
with_read_only("#{bundled_app}/**/*") do
|
||||
|
@ -604,7 +593,7 @@ RSpec.describe "Bundler.setup" do
|
|||
|
||||
describe "when excluding groups" do
|
||||
it "doesn't change the resolve if --without is used" do
|
||||
bundle "config --local without rails"
|
||||
bundle "config set --local without rails"
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "activesupport"
|
||||
|
@ -620,7 +609,7 @@ RSpec.describe "Bundler.setup" do
|
|||
end
|
||||
|
||||
it "remembers --without and does not bail on bare Bundler.setup" do
|
||||
bundle "config --local without rails"
|
||||
bundle "config set --local without rails"
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "activesupport"
|
||||
|
@ -636,7 +625,7 @@ RSpec.describe "Bundler.setup" do
|
|||
end
|
||||
|
||||
it "remembers --without and does not bail on bare Bundler.setup, even in the case of path gems no longer available" do
|
||||
bundle "config --local without development"
|
||||
bundle "config set --local without development"
|
||||
|
||||
path = bundled_app(File.join("vendor", "foo"))
|
||||
build_lib "foo", :path => path
|
||||
|
@ -656,7 +645,7 @@ RSpec.describe "Bundler.setup" do
|
|||
end
|
||||
|
||||
it "remembers --without and does not include groups passed to Bundler.setup" do
|
||||
bundle "config --local without rails"
|
||||
bundle "config set --local without rails"
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "activesupport"
|
||||
|
@ -1126,9 +1115,8 @@ end
|
|||
|
||||
context "is not present" do
|
||||
it "does not change the lock" do
|
||||
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
|
||||
lockfile lock_with(nil)
|
||||
ruby "require '#{entrypoint}'"
|
||||
ruby "require '#{entrypoint}/setup'"
|
||||
lockfile_should_be lock_with(nil)
|
||||
end
|
||||
end
|
||||
|
@ -1145,10 +1133,9 @@ end
|
|||
|
||||
context "is older" do
|
||||
it "does not change the lock" do
|
||||
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
|
||||
system_gems "bundler-1.10.1"
|
||||
lockfile lock_with("1.10.1")
|
||||
ruby "require '#{entrypoint}'"
|
||||
ruby "require '#{entrypoint}/setup'"
|
||||
lockfile_should_be lock_with("1.10.1")
|
||||
end
|
||||
end
|
||||
|
@ -1219,9 +1206,8 @@ end
|
|||
describe "with gemified standard libraries" do
|
||||
it "does not load Psych" do
|
||||
gemfile ""
|
||||
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
|
||||
ruby <<-RUBY
|
||||
require '#{entrypoint}'
|
||||
require '#{entrypoint}/setup'
|
||||
puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined"
|
||||
require 'psych'
|
||||
puts Psych::VERSION
|
||||
|
@ -1422,9 +1408,4 @@ end
|
|||
expect(last_command.stdboth).to eq("true")
|
||||
end
|
||||
end
|
||||
|
||||
# Tested rubygems does not include https://github.com/rubygems/rubygems/pull/2728 and will not always end up activating the current bundler
|
||||
def mis_activates_prerelease_default_bundler?
|
||||
Gem.rubygems_version < Gem::Version.new("3.1.a")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -72,6 +72,7 @@ RSpec.configure do |config|
|
|||
Spec::Rubygems.test_setup
|
||||
ENV["BUNDLE_SPEC_RUN"] = "true"
|
||||
ENV["BUNDLE_USER_CONFIG"] = ENV["BUNDLE_USER_CACHE"] = ENV["BUNDLE_USER_PLUGIN"] = nil
|
||||
ENV["XDG_CONFIG_HOME"] = nil
|
||||
ENV["GEMRC"] = nil
|
||||
|
||||
# Don't wrap output in tests
|
||||
|
|
|
@ -45,10 +45,14 @@ class Endpoint < Sinatra::Base
|
|||
Pathname.new(ENV["BUNDLER_SPEC_GEM_REPO"])
|
||||
else
|
||||
case request.host
|
||||
when "gem.repo1"
|
||||
Spec::Path.gem_repo1
|
||||
when "gem.repo2"
|
||||
Spec::Path.gem_repo2
|
||||
when "gem.repo3"
|
||||
Spec::Path.gem_repo3
|
||||
when "gem.repo4"
|
||||
Spec::Path.gem_repo4
|
||||
else
|
||||
Spec::Path.gem_repo1
|
||||
end
|
||||
|
|
|
@ -60,7 +60,7 @@ module Spec
|
|||
def run(cmd, *args)
|
||||
opts = args.last.is_a?(Hash) ? args.pop : {}
|
||||
groups = args.map(&:inspect).join(", ")
|
||||
setup = "require '#{lib_dir}/bundler' ; Bundler.ui.silence { Bundler.setup(#{groups}) }"
|
||||
setup = "require '#{entrypoint}' ; Bundler.ui.silence { Bundler.setup(#{groups}) }"
|
||||
ruby([setup, cmd].join(" ; "), opts)
|
||||
end
|
||||
|
||||
|
|
|
@ -20,12 +20,11 @@ module Spec
|
|||
default_source = instance_double("Bundler::Source::Rubygems", :specs => @index)
|
||||
source_requirements = { :default => default_source }
|
||||
@deps.each do |d|
|
||||
@platforms.each do |p|
|
||||
source_requirements[d.name] = d.source = default_source
|
||||
@platforms.each do |p|
|
||||
deps << Bundler::DepProxy.get_proxy(d, p)
|
||||
end
|
||||
end
|
||||
source_requirements ||= {}
|
||||
args[0] ||= [] # base
|
||||
args[1] ||= Bundler::GemVersionPromoter.new # gem_version_promoter
|
||||
args[2] ||= [] # additional_base_requirements
|
||||
|
|
|
@ -156,7 +156,7 @@ module Spec
|
|||
actual_source = out.split("\n").last
|
||||
next "Expected #{name} (#{version}) to be installed from `#{source}`, was actually from `#{actual_source}`"
|
||||
end
|
||||
next "Command to check forgem inclusion of gem #{full_name} failed"
|
||||
next "Command to check for inclusion of gem #{full_name} failed"
|
||||
end.compact
|
||||
|
||||
@errors.empty?
|
||||
|
|
|
@ -205,6 +205,13 @@ module Spec
|
|||
root.join("lib")
|
||||
end
|
||||
|
||||
# Sometimes rubygems version under test does not include
|
||||
# https://github.com/rubygems/rubygems/pull/2728 and will not always end up
|
||||
# activating the current bundler. In that case, require bundler absolutely.
|
||||
def entrypoint
|
||||
Gem.rubygems_version < Gem::Version.new("3.1.a") ? "#{lib_dir}/bundler" : "bundler"
|
||||
end
|
||||
|
||||
def global_plugin_gem(*args)
|
||||
home ".bundle", "plugin", "gems", *args
|
||||
end
|
||||
|
|
|
@ -26,14 +26,14 @@ class TestBundledCA < Gem::TestCase
|
|||
end
|
||||
|
||||
def assert_https(host)
|
||||
self.assertions += 1
|
||||
assert true
|
||||
http = Net::HTTP.new(host, 443)
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
||||
http.cert_store = bundled_certificate_store
|
||||
http.get('/')
|
||||
rescue Errno::ENOENT, Errno::ETIMEDOUT, SocketError
|
||||
skip "#{host} seems offline, I can't tell whether ssl would work."
|
||||
pend "#{host} seems offline, I can't tell whether ssl would work."
|
||||
rescue OpenSSL::SSL::SSLError => e
|
||||
# Only fail for certificate verification errors
|
||||
if e.message =~ /certificate verify failed/
|
||||
|
|
|
@ -96,7 +96,7 @@ class TestDeprecate < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_deprecated_method_calls_the_old_method
|
||||
capture_io do
|
||||
capture_output do
|
||||
thing = Thing.new
|
||||
thing.foo
|
||||
assert_equal "foo", thing.message
|
||||
|
@ -108,7 +108,7 @@ class TestDeprecate < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_deprecated_method_outputs_a_warning
|
||||
out, err = capture_io do
|
||||
out, err = capture_output do
|
||||
thing = Thing.new
|
||||
thing.foo
|
||||
thing.foo_arg("msg")
|
||||
|
@ -141,7 +141,7 @@ class TestDeprecate < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_deprecated_method_outputs_a_warning_old_way
|
||||
out, err = capture_io do
|
||||
out, err = capture_output do
|
||||
thing = OtherThing.new
|
||||
thing.foo
|
||||
thing.foo_arg("msg")
|
||||
|
|
|
@ -106,7 +106,7 @@ class TestGem < Gem::TestCase
|
|||
|
||||
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
|
||||
|
||||
assert_path_exists File.join(gemhome2, 'gems', 'a-1')
|
||||
assert_path_exist File.join(gemhome2, 'gems', 'a-1')
|
||||
end
|
||||
|
||||
def test_self_install_in_rescue
|
||||
|
@ -212,7 +212,7 @@ class TestGem < Gem::TestCase
|
|||
|
||||
def test_require_missing
|
||||
save_loaded_features do
|
||||
assert_raises ::LoadError do
|
||||
assert_raise ::LoadError do
|
||||
require "test_require_missing"
|
||||
end
|
||||
end
|
||||
|
@ -224,7 +224,7 @@ class TestGem < Gem::TestCase
|
|||
|
||||
install_specs a1
|
||||
|
||||
assert_raises ::LoadError do
|
||||
assert_raise ::LoadError do
|
||||
require "a*"
|
||||
end
|
||||
|
||||
|
@ -261,7 +261,7 @@ class TestGem < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_self_activate_bin_path_no_exec_name
|
||||
e = assert_raises ArgumentError do
|
||||
e = assert_raise ArgumentError do
|
||||
Gem.activate_bin_path 'a'
|
||||
end
|
||||
|
||||
|
@ -342,7 +342,7 @@ class TestGem < Gem::TestCase
|
|||
|
||||
# c2 is missing, and b2 which has it as a dependency will be activated, so we should get an error about the orphaned dependency
|
||||
|
||||
e = assert_raises Gem::UnsatisfiableDependencyError do
|
||||
e = assert_raise Gem::UnsatisfiableDependencyError do
|
||||
load Gem.activate_bin_path("a", "exec", ">= 0")
|
||||
end
|
||||
|
||||
|
@ -390,7 +390,7 @@ class TestGem < Gem::TestCase
|
|||
|
||||
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
||||
|
||||
e = assert_raises Gem::GemNotFoundException do
|
||||
e = assert_raise Gem::GemNotFoundException do
|
||||
load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
|
||||
end
|
||||
|
||||
|
@ -487,7 +487,7 @@ class TestGem < Gem::TestCase
|
|||
|
||||
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
||||
|
||||
e = assert_raises Gem::GemNotFoundException do
|
||||
e = assert_raise Gem::GemNotFoundException do
|
||||
load Gem.activate_bin_path("bundler", "bundle", "= 2.2.8")
|
||||
end
|
||||
|
||||
|
@ -495,7 +495,7 @@ class TestGem < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_self_bin_path_no_exec_name
|
||||
e = assert_raises ArgumentError do
|
||||
e = assert_raise ArgumentError do
|
||||
Gem.bin_path 'a'
|
||||
end
|
||||
|
||||
|
@ -516,20 +516,20 @@ class TestGem < Gem::TestCase
|
|||
util_spec 'a', '2' do |s|
|
||||
s.executables = ['exec']
|
||||
end
|
||||
assert_raises(Gem::GemNotFoundException) do
|
||||
assert_raise(Gem::GemNotFoundException) do
|
||||
Gem.bin_path('a', 'other', '2')
|
||||
end
|
||||
end
|
||||
|
||||
def test_self_bin_path_no_bin_file
|
||||
util_spec 'a', '1'
|
||||
assert_raises(ArgumentError) do
|
||||
assert_raise(ArgumentError) do
|
||||
Gem.bin_path('a', nil, '1')
|
||||
end
|
||||
end
|
||||
|
||||
def test_self_bin_path_not_found
|
||||
assert_raises(Gem::GemNotFoundException) do
|
||||
assert_raise(Gem::GemNotFoundException) do
|
||||
Gem.bin_path('non-existent', 'blah')
|
||||
end
|
||||
end
|
||||
|
@ -596,7 +596,7 @@ class TestGem < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_self_datadir_nonexistent_package
|
||||
assert_raises(Gem::MissingSpecError) do
|
||||
assert_raise(Gem::MissingSpecError) do
|
||||
Gem::Specification.find_by_name("xyzzy").datadir
|
||||
end
|
||||
end
|
||||
|
@ -692,12 +692,12 @@ class TestGem < Gem::TestCase
|
|||
|
||||
Gem.ensure_gem_subdirectories @gemhome
|
||||
|
||||
assert_path_exists File.join @gemhome, 'build_info'
|
||||
assert_path_exists File.join @gemhome, 'cache'
|
||||
assert_path_exists File.join @gemhome, 'doc'
|
||||
assert_path_exists File.join @gemhome, 'extensions'
|
||||
assert_path_exists File.join @gemhome, 'gems'
|
||||
assert_path_exists File.join @gemhome, 'specifications'
|
||||
assert_path_exist File.join @gemhome, 'build_info'
|
||||
assert_path_exist File.join @gemhome, 'cache'
|
||||
assert_path_exist File.join @gemhome, 'doc'
|
||||
assert_path_exist File.join @gemhome, 'extensions'
|
||||
assert_path_exist File.join @gemhome, 'gems'
|
||||
assert_path_exist File.join @gemhome, 'specifications'
|
||||
end
|
||||
|
||||
def test_self_ensure_gem_directories_permissions
|
||||
|
@ -1058,7 +1058,7 @@ class TestGem < Gem::TestCase
|
|||
|
||||
assert_equal ["\xCF", "\x80"], Gem.read_binary('test').chars.to_a
|
||||
|
||||
skip 'chmod not supported' if Gem.win_platform?
|
||||
pend 'chmod not supported' if Gem.win_platform?
|
||||
|
||||
begin
|
||||
File.chmod 0444, 'test'
|
||||
|
@ -1144,7 +1144,7 @@ class TestGem < Gem::TestCase
|
|||
|
||||
assert_equal Gem::Requirement.create('>= 1.2.3'), Gem.env_requirement('foo')
|
||||
assert_equal Gem::Requirement.create('1.2.3'), Gem.env_requirement('bAr')
|
||||
assert_raises(Gem::Requirement::BadRequirementError) { Gem.env_requirement('baz') }
|
||||
assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement('baz') }
|
||||
assert_equal Gem::Requirement.default, Gem.env_requirement('qux')
|
||||
end
|
||||
|
||||
|
@ -1349,7 +1349,7 @@ class TestGem < Gem::TestCase
|
|||
io.puts '# a_file.rb'
|
||||
end
|
||||
|
||||
e = assert_raises Gem::MissingSpecError do
|
||||
e = assert_raise Gem::MissingSpecError do
|
||||
Gem.try_activate 'a_file'
|
||||
end
|
||||
|
||||
|
@ -1370,7 +1370,7 @@ class TestGem < Gem::TestCase
|
|||
io.puts '# a_file.rb'
|
||||
end
|
||||
|
||||
e = assert_raises Gem::MissingSpecError do
|
||||
e = assert_raise Gem::MissingSpecError do
|
||||
Gem.try_activate 'a_file'
|
||||
end
|
||||
|
||||
|
@ -1389,7 +1389,7 @@ class TestGem < Gem::TestCase
|
|||
io.write spec.to_ruby_for_cache
|
||||
end
|
||||
|
||||
_, err = capture_io do
|
||||
_, err = capture_output do
|
||||
refute Gem.try_activate 'nonexistent'
|
||||
end
|
||||
|
||||
|
@ -1414,7 +1414,7 @@ class TestGem < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_setting_paths_does_not_warn_about_unknown_keys
|
||||
stdout, stderr = capture_io do
|
||||
stdout, stderr = capture_output do
|
||||
Gem.paths = { 'foo' => [],
|
||||
'bar' => Object.new,
|
||||
'GEM_HOME' => Gem.paths.home,
|
||||
|
@ -1432,7 +1432,7 @@ class TestGem < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_deprecated_paths=
|
||||
stdout, stderr = capture_io do
|
||||
stdout, stderr = capture_output do
|
||||
Gem.paths = { 'GEM_HOME' => Gem.paths.home,
|
||||
'GEM_PATH' => [Gem.paths.home, 'foo'] }
|
||||
end
|
||||
|
@ -1727,7 +1727,7 @@ class TestGem < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_looks_for_gemdeps_files_automatically_on_start
|
||||
skip "Requiring bundler messes things up" if Gem.java_platform?
|
||||
pend "Requiring bundler messes things up" if Gem.java_platform?
|
||||
|
||||
a = util_spec "a", "1", nil, "lib/a.rb"
|
||||
b = util_spec "b", "1", nil, "lib/b.rb"
|
||||
|
@ -1763,7 +1763,7 @@ class TestGem < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
|
||||
skip "Requiring bundler messes things up" if Gem.java_platform?
|
||||
pend "Requiring bundler messes things up" if Gem.java_platform?
|
||||
|
||||
a = util_spec "a", "1", nil, "lib/a.rb"
|
||||
b = util_spec "b", "1", nil, "lib/b.rb"
|
||||
|
@ -1881,7 +1881,7 @@ class TestGem < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_use_gemdeps_argument_missing
|
||||
e = assert_raises ArgumentError do
|
||||
e = assert_raise ArgumentError do
|
||||
Gem.use_gemdeps 'gem.deps.rb'
|
||||
end
|
||||
|
||||
|
@ -1893,7 +1893,7 @@ class TestGem < Gem::TestCase
|
|||
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] =
|
||||
ENV['RUBYGEMS_GEMDEPS'], 'gem.deps.rb'
|
||||
|
||||
e = assert_raises ArgumentError do
|
||||
e = assert_raise ArgumentError do
|
||||
Gem.use_gemdeps 'gem.deps.rb'
|
||||
end
|
||||
|
||||
|
@ -1966,9 +1966,11 @@ You may need to `gem install -g` to install missing gems
|
|||
EXPECTED
|
||||
|
||||
Gem::Deprecate.skip_during do
|
||||
assert_output nil, expected do
|
||||
actual_stdout, actual_stderr = capture_output do
|
||||
Gem.use_gemdeps
|
||||
end
|
||||
assert_empty actual_stdout
|
||||
assert_equal(expected, actual_stderr)
|
||||
end
|
||||
ensure
|
||||
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
||||
|
@ -2073,7 +2075,7 @@ You may need to `gem install -g` to install missing gems
|
|||
refute_includes $LOAD_PATH, test_plugin_path
|
||||
$LOAD_PATH.unshift test_plugin_path
|
||||
|
||||
capture_io do
|
||||
capture_output do
|
||||
yield
|
||||
end
|
||||
ensure
|
||||
|
|
|
@ -78,8 +78,8 @@ class TestGemBundlerVersionFinder < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_deleted_directory
|
||||
skip "Cannot perform this test on windows" if win_platform?
|
||||
skip "Cannot perform this test on Solaris" if /solaris/ =~ RUBY_PLATFORM
|
||||
pend "Cannot perform this test on windows" if win_platform?
|
||||
pend "Cannot perform this test on Solaris" if /solaris/ =~ RUBY_PLATFORM
|
||||
require "tmpdir"
|
||||
|
||||
orig_dir = Dir.pwd
|
||||
|
|
|
@ -118,7 +118,7 @@ class TestGemCommand < Gem::TestCase
|
|||
use_ui @ui do
|
||||
@cmd.when_invoked { true }
|
||||
|
||||
ex = assert_raises OptionParser::InvalidOption do
|
||||
ex = assert_raise OptionParser::InvalidOption do
|
||||
@cmd.invoke('-zzz')
|
||||
end
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class TestGemCommandManager < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_find_command_ambiguous
|
||||
e = assert_raises Gem::CommandLineError do
|
||||
e = assert_raise Gem::CommandLineError do
|
||||
@command_manager.find_command 'u'
|
||||
end
|
||||
|
||||
|
@ -50,7 +50,7 @@ class TestGemCommandManager < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_find_command_unknown
|
||||
e = assert_raises Gem::CommandLineError do
|
||||
e = assert_raise Gem::CommandLineError do
|
||||
@command_manager.find_command 'xyz'
|
||||
end
|
||||
|
||||
|
@ -65,7 +65,7 @@ class TestGemCommandManager < Gem::TestCase
|
|||
@command_manager.register_command :interrupt
|
||||
|
||||
use_ui @ui do
|
||||
assert_raises Gem::MockGemUi::TermError do
|
||||
assert_raise Gem::MockGemUi::TermError do
|
||||
@command_manager.run %w[interrupt]
|
||||
end
|
||||
assert_equal '', ui.output
|
||||
|
@ -82,7 +82,7 @@ class TestGemCommandManager < Gem::TestCase
|
|||
|
||||
@command_manager.register_command :crash
|
||||
use_ui @ui do
|
||||
assert_raises Gem::MockGemUi::TermError do
|
||||
assert_raise Gem::MockGemUi::TermError do
|
||||
@command_manager.run %w[crash]
|
||||
end
|
||||
assert_equal '', ui.output
|
||||
|
@ -96,7 +96,7 @@ class TestGemCommandManager < Gem::TestCase
|
|||
|
||||
def test_process_args_bad_arg
|
||||
use_ui @ui do
|
||||
assert_raises Gem::MockGemUi::TermError do
|
||||
assert_raise Gem::MockGemUi::TermError do
|
||||
@command_manager.process_args %w[--bad-arg]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -126,7 +126,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
|
||||
use_ui @ui do
|
||||
Dir.chdir @tempdir do
|
||||
assert_raises Gem::InvalidSpecificationException do
|
||||
assert_raise Gem::InvalidSpecificationException do
|
||||
@cmd.execute
|
||||
end
|
||||
end
|
||||
|
@ -180,7 +180,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
|
||||
use_ui @ui do
|
||||
Dir.chdir @tempdir do
|
||||
assert_raises Gem::InvalidSpecificationException do
|
||||
assert_raise Gem::InvalidSpecificationException do
|
||||
@cmd.execute
|
||||
end
|
||||
end
|
||||
|
@ -208,8 +208,8 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
@cmd.options[:args] = [gemspec_file]
|
||||
|
||||
out, err = use_ui @ui do
|
||||
capture_io do
|
||||
assert_raises Gem::MockGemUi::TermError do
|
||||
capture_output do
|
||||
assert_raise Gem::MockGemUi::TermError do
|
||||
@cmd.execute
|
||||
end
|
||||
end
|
||||
|
@ -225,7 +225,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
def test_execute_missing_file
|
||||
@cmd.options[:args] = %w[some_gem]
|
||||
use_ui @ui do
|
||||
assert_raises Gem::MockGemUi::TermError do
|
||||
assert_raise Gem::MockGemUi::TermError do
|
||||
@cmd.execute
|
||||
end
|
||||
end
|
||||
|
@ -329,7 +329,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
@cmd.options[:args] = ["*.gemspec"]
|
||||
|
||||
use_ui @ui do
|
||||
assert_raises Gem::MockGemUi::TermError do
|
||||
assert_raise Gem::MockGemUi::TermError do
|
||||
@cmd.execute
|
||||
end
|
||||
end
|
||||
|
@ -527,7 +527,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
|
||||
use_ui @ui do
|
||||
Dir.chdir(gemspec_dir) do
|
||||
assert_raises Gem::MockGemUi::TermError do
|
||||
assert_raise Gem::MockGemUi::TermError do
|
||||
@cmd.execute
|
||||
end
|
||||
end
|
||||
|
@ -582,7 +582,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_build_signed_gem
|
||||
skip 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
|
||||
pend 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
|
||||
|
||||
trust_dir = Gem::Security.trust_dir
|
||||
|
||||
|
@ -609,7 +609,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_build_signed_gem_with_cert_expiration_length_days
|
||||
skip 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
|
||||
pend 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
|
||||
|
||||
gem_path = File.join Gem.user_home, ".gem"
|
||||
Dir.mkdir gem_path
|
||||
|
@ -653,7 +653,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_build_auto_resign_cert
|
||||
skip 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
|
||||
pend 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
|
||||
|
||||
gem_path = File.join Gem.user_home, ".gem"
|
||||
Dir.mkdir gem_path
|
||||
|
|
|
@ -54,7 +54,7 @@ class TestGemCommandsCertCommand < Gem::TestCase
|
|||
assert_equal PUBLIC_CERT.to_pem, match.first.to_pem
|
||||
assert_equal @trust_dir.cert_path(PUBLIC_CERT), match.last
|
||||
|
||||
assert_raises StopIteration do
|
||||
assert_raise StopIteration do
|
||||
matches.next
|
||||
end
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ class TestGemCommandsCertCommand < Gem::TestCase
|
|||
assert_equal ALTERNATE_CERT.to_pem, match.first.to_pem
|
||||
assert_equal @trust_dir.cert_path(ALTERNATE_CERT), match.last
|
||||
|
||||
assert_raises StopIteration do
|
||||
assert_raise StopIteration do
|
||||
matches.next
|
||||
end
|
||||
end
|
||||
|
@ -83,7 +83,7 @@ class TestGemCommandsCertCommand < Gem::TestCase
|
|||
|
||||
cert_path = @trust_dir.cert_path PUBLIC_CERT
|
||||
|
||||
assert_path_exists cert_path
|
||||
assert_path_exist cert_path
|
||||
|
||||
assert_equal "Added '/CN=nobody/DC=example'\n", @ui.output
|
||||
assert_empty @ui.error
|
||||
|
@ -138,8 +138,8 @@ Added '/CN=alternate/DC=example'
|
|||
assert_empty output
|
||||
assert_empty @build_ui.error
|
||||
|
||||
assert_path_exists File.join(@tempdir, 'gem-private_key.pem')
|
||||
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
|
||||
assert_path_exist File.join(@tempdir, 'gem-private_key.pem')
|
||||
assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
|
||||
end
|
||||
|
||||
def test_execute_build_bad_email_address
|
||||
|
@ -152,15 +152,15 @@ Added '/CN=alternate/DC=example'
|
|||
|
||||
use_ui @build_ui do
|
||||
|
||||
e = assert_raises Gem::CommandLineError do
|
||||
e = assert_raise Gem::CommandLineError do
|
||||
@cmd.execute
|
||||
end
|
||||
|
||||
assert_equal "Invalid email address #{email}",
|
||||
e.message
|
||||
|
||||
refute_path_exists File.join(@tempdir, 'gem-private_key.pem')
|
||||
refute_path_exists File.join(@tempdir, 'gem-public_cert.pem')
|
||||
assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
|
||||
assert_path_not_exist File.join(@tempdir, 'gem-public_cert.pem')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -195,8 +195,8 @@ Added '/CN=alternate/DC=example'
|
|||
assert_empty output
|
||||
assert_empty @build_ui.error
|
||||
|
||||
assert_path_exists File.join(@tempdir, 'gem-private_key.pem')
|
||||
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
|
||||
assert_path_exist File.join(@tempdir, 'gem-private_key.pem')
|
||||
assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
|
||||
|
||||
pem = File.read("#{@tempdir}/gem-public_cert.pem")
|
||||
cert = OpenSSL::X509::Certificate.new(pem)
|
||||
|
@ -214,7 +214,7 @@ Added '/CN=alternate/DC=example'
|
|||
@build_ui = Gem::MockGemUi.new "#{passphrase}\n#{passphrase_confirmation}"
|
||||
|
||||
use_ui @build_ui do
|
||||
e = assert_raises Gem::CommandLineError do
|
||||
e = assert_raise Gem::CommandLineError do
|
||||
@cmd.execute
|
||||
end
|
||||
|
||||
|
@ -232,8 +232,8 @@ Added '/CN=alternate/DC=example'
|
|||
|
||||
end
|
||||
|
||||
refute_path_exists File.join(@tempdir, 'gem-private_key.pem')
|
||||
refute_path_exists File.join(@tempdir, 'gem-public_cert.pem')
|
||||
assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
|
||||
assert_path_not_exist File.join(@tempdir, 'gem-public_cert.pem')
|
||||
end
|
||||
|
||||
def test_execute_build_key
|
||||
|
@ -254,8 +254,8 @@ Added '/CN=alternate/DC=example'
|
|||
assert_empty output
|
||||
assert_empty @ui.error
|
||||
|
||||
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
|
||||
refute_path_exists File.join(@tempdir, 'gem-private_key.pem')
|
||||
assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
|
||||
assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
|
||||
end
|
||||
|
||||
def test_execute_build_encrypted_key
|
||||
|
@ -276,7 +276,7 @@ Added '/CN=alternate/DC=example'
|
|||
assert_empty output
|
||||
assert_empty @ui.error
|
||||
|
||||
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
|
||||
assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
|
||||
end
|
||||
|
||||
def test_execute_certificate
|
||||
|
@ -346,7 +346,7 @@ Added '/CN=alternate/DC=example'
|
|||
|
||||
cert_path = @trust_dir.cert_path PUBLIC_CERT
|
||||
|
||||
assert_path_exists cert_path
|
||||
assert_path_exist cert_path
|
||||
|
||||
@cmd.handle_options %W[--remove nobody]
|
||||
|
||||
|
@ -357,7 +357,7 @@ Added '/CN=alternate/DC=example'
|
|||
assert_equal "Removed '/CN=nobody/DC=example'\n", @ui.output
|
||||
assert_equal '', @ui.error
|
||||
|
||||
refute_path_exists cert_path
|
||||
assert_path_not_exist cert_path
|
||||
end
|
||||
|
||||
def test_execute_remove_multiple
|
||||
|
@ -367,8 +367,8 @@ Added '/CN=alternate/DC=example'
|
|||
public_path = @trust_dir.cert_path PUBLIC_CERT
|
||||
alternate_path = @trust_dir.cert_path ALTERNATE_CERT
|
||||
|
||||
assert_path_exists public_path
|
||||
assert_path_exists alternate_path
|
||||
assert_path_exist public_path
|
||||
assert_path_exist alternate_path
|
||||
|
||||
@cmd.handle_options %W[--remove example]
|
||||
|
||||
|
@ -384,8 +384,8 @@ Removed '/CN=nobody/DC=example'
|
|||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
|
||||
refute_path_exists public_path
|
||||
refute_path_exists alternate_path
|
||||
assert_path_not_exist public_path
|
||||
assert_path_not_exist alternate_path
|
||||
end
|
||||
|
||||
def test_execute_remove_twice
|
||||
|
@ -395,8 +395,8 @@ Removed '/CN=nobody/DC=example'
|
|||
public_path = @trust_dir.cert_path PUBLIC_CERT
|
||||
alternate_path = @trust_dir.cert_path ALTERNATE_CERT
|
||||
|
||||
assert_path_exists public_path
|
||||
assert_path_exists alternate_path
|
||||
assert_path_exist public_path
|
||||
assert_path_exist alternate_path
|
||||
|
||||
@cmd.handle_options %W[--remove nobody --remove alternate]
|
||||
|
||||
|
@ -412,8 +412,8 @@ Removed '/CN=alternate/DC=example'
|
|||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
|
||||
refute_path_exists public_path
|
||||
refute_path_exists alternate_path
|
||||
assert_path_not_exist public_path
|
||||
assert_path_not_exist alternate_path
|
||||
end
|
||||
|
||||
def test_execute_sign
|
||||
|
@ -552,7 +552,7 @@ Removed '/CN=alternate/DC=example'
|
|||
@cmd.handle_options %W[--sign #{path}]
|
||||
|
||||
use_ui @ui do
|
||||
assert_raises Gem::MockGemUi::TermError do
|
||||
assert_raise Gem::MockGemUi::TermError do
|
||||
@cmd.execute
|
||||
end
|
||||
end
|
||||
|
@ -580,7 +580,7 @@ ERROR: --certificate not specified and ~/.gem/gem-public_cert.pem does not exis
|
|||
@cmd.handle_options %W[--sign #{path}]
|
||||
|
||||
use_ui @ui do
|
||||
assert_raises Gem::MockGemUi::TermError do
|
||||
assert_raise Gem::MockGemUi::TermError do
|
||||
@cmd.execute
|
||||
end
|
||||
end
|
||||
|
@ -686,7 +686,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
|
||||
def test_handle_options_add_bad
|
||||
nonexistent = File.join @tempdir, 'nonexistent'
|
||||
e = assert_raises OptionParser::InvalidArgument do
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--add #{nonexistent}]
|
||||
end
|
||||
|
||||
|
@ -696,7 +696,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
bad = File.join @tempdir, 'bad'
|
||||
FileUtils.touch bad
|
||||
|
||||
e = assert_raises OptionParser::InvalidArgument do
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--add #{bad}]
|
||||
end
|
||||
|
||||
|
@ -706,7 +706,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
|
||||
def test_handle_options_certificate
|
||||
nonexistent = File.join @tempdir, 'nonexistent'
|
||||
e = assert_raises OptionParser::InvalidArgument do
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--certificate #{nonexistent}]
|
||||
end
|
||||
|
||||
|
@ -716,7 +716,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
bad = File.join @tempdir, 'bad'
|
||||
FileUtils.touch bad
|
||||
|
||||
e = assert_raises OptionParser::InvalidArgument do
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--certificate #{bad}]
|
||||
end
|
||||
|
||||
|
@ -727,7 +727,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
|
||||
def test_handle_options_key_bad
|
||||
nonexistent = File.join @tempdir, 'nonexistent'
|
||||
e = assert_raises OptionParser::InvalidArgument do
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--private-key #{nonexistent}]
|
||||
end
|
||||
|
||||
|
@ -738,14 +738,14 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
bad = File.join @tempdir, 'bad'
|
||||
FileUtils.touch bad
|
||||
|
||||
e = assert_raises OptionParser::InvalidArgument do
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--private-key #{bad}]
|
||||
end
|
||||
|
||||
assert_equal "invalid argument: --private-key #{bad}: invalid RSA key",
|
||||
e.message
|
||||
|
||||
e = assert_raises OptionParser::InvalidArgument do
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[--private-key #{PUBLIC_KEY_FILE}]
|
||||
end
|
||||
|
||||
|
@ -792,7 +792,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
|
|||
|
||||
def test_handle_options_sign_nonexistent
|
||||
nonexistent = File.join @tempdir, 'nonexistent'
|
||||
e = assert_raises OptionParser::InvalidArgument do
|
||||
e = assert_raise OptionParser::InvalidArgument do
|
||||
@cmd.handle_options %W[
|
||||
--private-key #{ALTERNATE_KEY_FILE}
|
||||
|
||||
|
|
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