diff options
135 files changed, 1293 insertions, 868 deletions
@@ -602,6 +602,10 @@ EOF reset_rubygems! end def reset_paths! @bin_path = nil @bundler_major_version = nil @@ -57,7 +57,7 @@ module Bundler custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile] if custom_gemfile && !custom_gemfile.empty? Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile) - Bundler.reset_paths! end Bundler.settings.set_command_option_if_given :retry, options[:retry] @@ -134,7 +134,8 @@ module Bundler if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+} Kernel.exec "man #{man_page}" else - puts File.read("#{File.dirname(man_page)}/#{File.basename(man_page)}.ronn") end elsif command_path = Bundler.which("bundler-#{cli}") Kernel.exec(command_path, "--help") @@ -380,6 +381,8 @@ module Bundler "Make binstubs that can work without the Bundler runtime" method_option "all", :type => :boolean, :banner => "Install binstubs for all gems" def binstubs(*gems) require_relative "cli/binstubs" Binstubs.new(options, gems).run @@ -16,7 +16,11 @@ module Bundler Bundler.settings.set_command_option_if_given :shebang, options["shebang"] installer = Installer.new(Bundler.root, Bundler.definition) - installer_opts = { :force => options[:force], :binstubs_cmd => true } if options[:all] raise InvalidOption, "Cannot specify --all with specific gems" unless gems.empty? @@ -38,7 +42,7 @@ module Bundler if options[:standalone] next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler" Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do - installer.generate_standalone_bundler_executable_stubs(spec) end else installer.generate_bundler_executable_stubs(spec, installer_opts) @@ -63,10 +63,10 @@ module Bundler Kernel.load(file) rescue SystemExit, SignalException raise - rescue Exception => e # rubocop:disable Lint/RescueException Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})" - backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : [] - abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}" end def process_title(file, args) @@ -76,8 +76,6 @@ module Bundler next unless gems.empty? || gems.include?(current_spec.name) active_spec = retrieve_active_spec(definition, current_spec) - next unless active_spec - next unless filter_options_.empty? || update_present_via_semver_portions(current_spec, active_spec, options) gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version) @@ -146,8 +144,6 @@ module Bundler end def retrieve_active_spec(definition, current_spec) - return unless current_spec.match_platform(Bundler.local_platform) - if strict active_spec = definition.find_resolved_spec(current_spec) else @@ -233,6 +229,8 @@ module Bundler end def update_present_via_semver_portions(current_spec, active_spec, options) current_major = current_spec.version.segments.first active_major = active_spec.version.segments.first @@ -22,13 +22,13 @@ module Bundler def initialize(fetcher) @fetcher = fetcher - require "tmpdir" end def update(local_path, remote_path, retrying = nil) headers = {} - Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir| local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename) # first try to fetch any new bytes on the existing file @@ -66,8 +66,8 @@ module Bundler end end - response_etag = (response["ETag"] || "").gsub(%r{\AW/}, "") - if etag_for(local_temp_path) == response_etag SharedHelpers.filesystem_access(local_path) do FileUtils.mv(local_temp_path, local_path) end @@ -75,7 +75,7 @@ module Bundler end if retrying - raise MisMatchedChecksumError.new(remote_path, response_etag, etag_for(local_temp_path)) end update(local_path, remote_path, :retrying) @@ -118,7 +118,7 @@ module Bundler end @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version) - add_platforms unless Bundler.frozen_bundle? converge_path_sources_to_gemspec_sources @path_changes = converge_paths @@ -547,17 +547,12 @@ module Bundler private - def add_platforms - (@dependencies.flat_map(&:expanded_platforms) + current_platforms).uniq.each do |platform| - add_platform(platform) - end end def current_platforms - [].tap do |platforms| - platforms << local_platform if Bundler.feature_flag.specific_platform? - platforms << generic_local_platform - end end def change_reason @@ -105,7 +105,7 @@ module Bundler out << [" User Home", Gem.user_home] out << [" User Path", Gem.user_dir] out << [" Bin Dir", Gem.bindir] - if defined?(OpenSSL) out << ["OpenSSL"] out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION) out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION) @@ -41,7 +41,6 @@ module Bundler settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") } settings_flag(:print_only_version_number) { bundler_3_mode? } settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? } - settings_flag(:specific_platform) { bundler_3_mode? } settings_flag(:suppress_install_using_messages) { bundler_3_mode? } settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? } settings_flag(:update_requires_all_flag) { bundler_4_mode? } @@ -8,7 +8,7 @@ module Bundler class Index < Base def specs(_gem_names) Bundler.rubygems.fetch_all_remote_specs(remote) - rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError, Net::HTTPFatalError => e case e.message when /certificate verify failed/ raise CertificateFailureError.new(display_uri) @@ -19,8 +19,7 @@ module Bundler raise BadAuthenticationError, remote_uri if remote_uri.userinfo raise AuthenticationRequiredError, remote_uri else - Bundler.ui.trace e - raise HTTPError, "Could not fetch specs from #{display_uri}" end end @@ -6,6 +6,18 @@ module Bundler module FriendlyErrors module_function def log_error(error) case error when YamlSyntaxError @@ -114,10 +126,13 @@ module Bundler end def self.with_friendly_errors yield rescue SignalException raise rescue Exception => e # rubocop:disable Lint/RescueException FriendlyErrors.log_error(e) exit FriendlyErrors.exit_status(e) end @@ -195,7 +195,11 @@ module Bundler if base # allow all platforms when searching from a lockfile dependency.matches_spec?(spec) else - dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform) end end @@ -179,11 +179,11 @@ module Bundler # @param [Pathname] gemfile_path The Gemfile from which to remove dependencies. def remove_gems_from_gemfile(gems, gemfile_path) patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/ - new_gemfile = [] multiline_removal = false IO.readlines(gemfile_path).each do |line| - if line.match(patterns) multiline_removal = line.rstrip.end_with?(",") # skip lines which match the regex next @@ -207,6 +207,13 @@ module Bundler new_gemfile.join.chomp end # @param [Array] gemfile Array of gemfile contents. # @param [String] block_name Name of block name to look for. def remove_nested_blocks(gemfile, block_name) @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "erb" require "rubygems/dependency_installer" require_relative "worker" require_relative "installer/parallel_installer" @@ -136,6 +135,7 @@ module Bundler end mode = Bundler::WINDOWS ? "wb:UTF-8" : "w" content = if RUBY_VERSION >= "2.6" ERB.new(template, :trim_mode => "-").result(binding) else @@ -143,7 +143,7 @@ module Bundler end File.write(binstub_path, content, :mode => mode, :perm => 0o777 & ~File.umask) - if Bundler::WINDOWS prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n" File.write("#{binstub_path}.cmd", prefix + content, :mode => mode) end @@ -164,7 +164,7 @@ module Bundler end end - def generate_standalone_bundler_executable_stubs(spec) # double-assignment to avoid warnings about variables that will be used by ERB bin_path = Bundler.bin_path unless path = Bundler.settings[:path] @@ -182,6 +182,7 @@ module Bundler executable_path = executable_path mode = Bundler::WINDOWS ? "wb:UTF-8" : "w" content = if RUBY_VERSION >= "2.6" ERB.new(template, :trim_mode => "-").result(binding) else @@ -189,7 +190,7 @@ module Bundler end File.write("#{bin_path}/#{executable}", content, :mode => mode, :perm => 0o755) - if Bundler::WINDOWS prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n" File.write("#{bin_path}/#{executable}.cmd", prefix + content, :mode => mode) end @@ -243,6 +244,7 @@ module Bundler end end.flatten Bundler.rubygems.load_plugin_files(path_plugin_files) end def ensure_specs_are_compatible! @@ -297,7 +299,7 @@ module Bundler # returns whether or not a re-resolve was needed def resolve_if_needed(options) - if [email protected]? && !options["force"] && !options["all-platforms"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file? return false if @definition.nothing_changed? && [email protected]_specs? end @@ -79,19 +79,17 @@ module Bundler @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name source.gemspec.tap {|s| s.source = source } else - search_object = Bundler.feature_flag.specific_platform? || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version) platform_object = Gem::Platform.new(platform) candidates = source.specs.search(search_object) same_platform_candidates = candidates.select do |spec| MatchPlatform.platforms_match?(spec.platform, platform_object) end search = same_platform_candidates.last || candidates.last - if search && Gem::Platform.new(search.platform) != platform_object && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty? - Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \ - "because it has different dependencies from the #{platform} version. " \ - "To use the platform-specific version of the gem, run `bundle config set --local specific_platform true` and install again." - search = source.specs.search(self).last - end search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification)) search end @@ -0,0 +1 @@ @@ -250,14 +250,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html). be changed in the next major version. * `silence_root_warning` (`BUNDLE_SILENCE_ROOT_WARNING`): Silence the warning Bundler prints when installing gems as root. -* `specific_platform` (`BUNDLE_SPECIFIC_PLATFORM`): - Allow bundler to resolve for the specific running platform and store it in - the lockfile, instead of only using a generic platform. - A specific platform is the exact platform triple reported by - `Gem::Platform.local`, such as `x86_64-darwin-16` or `universal-java-1.8`. - On the other hand, generic platforms are those such as `ruby`, `mswin`, or - `java`. In this example, `x86_64-darwin-16` would map to `ruby` and - `universal-java-1.8` to `java`. * `ssl_ca_cert` (`BUNDLE_SSL_CA_CERT`): Path to a designated CA certificate file or folder containing multiple certificates for trusted CAs in PEM format. @@ -371,7 +363,7 @@ Or you can set the credentials as an environment variable like this: For gems with a git source with HTTP(S) URL you can specify credentials like so: - bundle config set --global https://.com/bundler/bundler.git username:password Or you can set the credentials as an environment variable like so: @@ -105,7 +105,7 @@ automatically and that requires `bundler` to silently remember them. Since * `--local`: Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the - gems already present in Rubygems' cache or in `vendor/cache`. Note that if a appropriate platform-specific gem exists on `rubygems.org` it will not be found. @@ -260,7 +260,7 @@ module Bundler end def to_s - "plugin source for #{options[:type]} with uri #{uri}" end # Note: Do not override if you don't know what you are doing. @@ -10,7 +10,7 @@ module Bundler # So that we don't have to override all there methods to dummy ones # explicitly. # They will be handled by method_missing - [:gemspec, :gem, :path, :install_if, :platforms, :env].each {|m| undef_method m } # This lists the plugins that was added automatically and not specified by # the user. @@ -158,9 +158,8 @@ module Bundler # spec group. sg_ruby = sg.copy_for(Gem::Platform::RUBY) selected_sgs << sg_ruby if sg_ruby - all_platforms = @platforms + [platform] - next if all_platforms.to_a == [Gem::Platform::RUBY] sg_all_platforms = nil self.class.sort_platforms(all_platforms).reverse_each do |other_platform| if sg_all_platforms.nil? sg_all_platforms = sg.copy_for(other_platform) @@ -302,7 +301,7 @@ module Bundler versions_with_platforms = specs.map {|s| [s.version, s.platform] } message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n") message << if versions_with_platforms.any? - "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}" else "The source does not contain any versions of '#{name}'" end @@ -227,6 +227,10 @@ module Bundler Gem.load_plugin_files(files) if Gem.respond_to?(:load_plugin_files) end def ui=(obj) Gem::DefaultUserInteraction.ui = obj end @@ -42,7 +42,6 @@ module Bundler setup_makes_kernel_gem_public silence_deprecations silence_root_warning - specific_platform suppress_install_using_messages unlock_source_unlocks_spec update_requires_all_flag @@ -118,7 +118,7 @@ module Bundler git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}") File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination) rescue Errno::EEXIST => e - file_path = e.message[%r{.*?(/.*)}, 1] raise GitError, "Bundler could not install a gem because it needs to " \ "create a directory, but a file exists - #{file_path}. Please delete " \ "this file and try again." @@ -100,6 +100,7 @@ module Bundler @specs.map do |s| next s unless s.is_a?(LazySpecification) s.source.dependency_names = names if s.source.respond_to?(:dependency_names=) spec = s.__materialize__ raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec spec @@ -33,7 +33,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To ## Contributing Bug reports and pull requests are welcome on at https://.com/<%= config[:_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://.com/<%= config[:_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).<% end %> - <% if config[:mit] -%> ## License @@ -1,8 +1,8 @@ # frozen_string_literal: true -require "<%= config[:namespaced_path] %>/version" <%- if config[:ext] -%> -require "<%= config[:namespaced_path] %>/<%= config[:underscored_name] %>" <%- end -%> <%- config[:constant_array].each_with_index do |c, i| -%> @@ -33,4 +33,10 @@ Gem::Specification.new do |spec| <%- if config[:ext] -%> spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"] <%- end -%> end @@ -8,6 +8,8 @@ module Bundler return uri_to_anonymize if uri_to_anonymize.nil? uri = uri_to_anonymize.dup if uri.is_a?(String) require_relative "vendored_uri" uri = Bundler::URI(uri) end @@ -1,6 +1,5 @@ # frozen_string_literal: true -require_relative 'molinillo/compatibility' require_relative 'molinillo/gem_metadata' require_relative 'molinillo/errors' require_relative 'molinillo/resolver' @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module Bundler::Molinillo - # Hacks needed for old Ruby versions. - module Compatibility - module_function - - if [].respond_to?(:flat_map) - # Flat map - # @param [Enumerable] enum an enumerable object - # @block the block to flat-map with - # @return The enum, flat-mapped - def flat_map(enum, &blk) - enum.flat_map(&blk) - end - else - # Flat map - # @param [Enumerable] enum an enumerable object - # @block the block to flat-map with - # @return The enum, flat-mapped - def flat_map(enum, &blk) - enum.map(&blk).flatten(1) - end - end - end -end @@ -124,6 +124,7 @@ module Bundler::Molinillo dot.join("\n") end # @return [Boolean] whether the two dependency graphs are equal, determined # by a recursive traversal of each {#root_vertices} and its # {Vertex#successors} @@ -190,7 +191,7 @@ module Bundler::Molinillo # @return [Edge] the added edge def add_edge(origin, destination, requirement) if destination.path_to?(origin) - raise CircularDependencyError.new([origin, destination]) end add_edge_no_circular(origin, destination, requirement) end @@ -219,5 +220,37 @@ module Bundler::Molinillo def add_edge_no_circular(origin, destination, requirement) log.add_edge_no_circular(self, origin.name, destination.name, requirement) end end end @@ -14,11 +14,11 @@ module Bundler::Molinillo end # (see Action#up) - def up(_graph) end # (see Action#down) - def down(_graph) end # @!group Tag @@ -65,7 +65,7 @@ module Bundler::Molinillo # @param [SpecificationProvider] specification_provider see {#specification_provider} def initialize(conflicts, specification_provider) pairs = [] - Compatibility.flat_map(conflicts.values.flatten, &:requirements).each do |conflicting| conflicting.each do |source, conflict_requirements| conflict_requirements.each do |c| pairs << [c, source] @@ -2,5 +2,5 @@ module Bundler::Molinillo # The version of Bundler::Molinillo. - VERSION = '0.6.6'.freeze end @@ -207,7 +207,7 @@ module Bundler::Molinillo def start_resolution @started_at = Time.now - handle_missing_or_push_dependency_state(initial_state) debug { "Starting resolution (#{@started_at})\nUser-requested dependencies: #{original_requested}" } resolver_ui.before_resolution @@ -273,10 +273,10 @@ module Bundler::Molinillo states.last end - # Creates the initial state for the resolution, based upon the # {#requested} dependencies - # @return [DependencyState] the initial state for the resolution - def initial_state graph = DependencyGraph.new.tap do |dg| original_requested.each do |requested| vertex = dg.add_vertex(name_for(requested), nil, true) @@ -285,18 +285,7 @@ module Bundler::Molinillo dg.tag(:initial_state) end - requirements = sort_dependencies(original_requested, graph, {}) - initial_requirement = requirements.shift - DependencyState.new( - initial_requirement && name_for(initial_requirement), - requirements, - graph, - initial_requirement, - possibilities_for_requirement(initial_requirement, graph), - 0, - {}, - [] - ) end # Unwinds the states stack because a conflict has been encountered @@ -361,7 +350,7 @@ module Bundler::Molinillo current_detail end - # @param [Array<Object>] array of requirements that combine to create a conflict # @return [Array<UnwindDetails>] array of UnwindDetails that have a chance # of resolving the passed requirements def unwind_options_for_requirements(binding_requirements) @@ -429,7 +418,7 @@ module Bundler::Molinillo end # @param [DependencyState] state - # @param [Array] array of requirements # @return [Boolean] whether or not the given state has any possibilities # that could satisfy the given requirements def conflict_fixing_possibilities?(state, binding_requirements) @@ -444,7 +433,8 @@ module Bundler::Molinillo # Filter's a state's possibilities to remove any that would not fix the # conflict we've just rewound from - # @param [UnwindDetails] details of the conflict just unwound from # @return [void] def filter_possibilities_after_unwind(unwind_details) return unless state && !state.possibilities.empty? @@ -458,7 +448,7 @@ module Bundler::Molinillo # Filter's a state's possibilities to remove any that would not satisfy # the requirements in the conflict we've just rewound from - # @param [UnwindDetails] details of the conflict just unwound from # @return [void] def filter_possibilities_for_primary_unwind(unwind_details) unwinds_to_state = unused_unwind_options.select { |uw| uw.state_index == unwind_details.state_index } @@ -491,7 +481,7 @@ module Bundler::Molinillo # Filter's a state's possibilities to remove any that would (eventually) # create a requirement in the conflict we've just rewound from - # @param [UnwindDetails] details of the conflict just unwound from # @return [void] def filter_possibilities_for_parent_unwind(unwind_details) unwinds_to_state = unused_unwind_options.select { |uw| uw.state_index == unwind_details.state_index } @@ -500,7 +490,7 @@ module Bundler::Molinillo primary_unwinds = unwinds_to_state.select(&:unwinding_to_primary_requirement?).uniq parent_unwinds = unwinds_to_state.uniq - primary_unwinds - allowed_possibility_sets = Compatibility.flat_map(primary_unwinds) do |unwind| states[unwind.state_index].possibilities.select do |possibility_set| possibility_set.possibilities.any? do |poss| possibility_satisfies_requirements?(poss, unwind.conflicting_requirements) @@ -508,7 +498,7 @@ module Bundler::Molinillo end end - requirements_to_avoid = Compatibility.flat_map(parent_unwinds, &:sub_dependencies_to_avoid) state.possibilities.reject! do |possibility_set| !allowed_possibility_sets.include?(possibility_set) && @@ -524,12 +514,12 @@ module Bundler::Molinillo possible_binding_requirements = conflict.requirements.values.flatten(1).uniq - # When there’s a `CircularDependency` error the conflicting requirement - # (the one causing the circular) won’t be `conflict.requirement` - # (which won’t be for the right state, because we won’t have created it, - # because it’s circular). - # We need to make sure we have that requirement in the conflict’s list, - # otherwise we won’t be able to unwind properly, so we just return all # the requirements for the conflict. return possible_binding_requirements if conflict.underlying_error @@ -558,8 +548,8 @@ module Bundler::Molinillo end # @param [Object] requirement we wish to check - # @param [Array] array of requirements - # @param [Array] array of possibilities the requirements will be used to filter # @return [Boolean] whether or not the given requirement is required to filter # out all elements of the array of possibilities. def binding_requirement_in_set?(requirement, possible_binding_requirements, possibilities) @@ -568,6 +558,7 @@ module Bundler::Molinillo end end # @return [Object] the requirement that led to `requirement` being added # to the list of requirements. def parent_of(requirement) @@ -577,6 +568,7 @@ module Bundler::Molinillo parent_state.requirement end # @return [Object] the requirement that led to a version of a possibility # with the given name being activated. def requirement_for_existing_name(name) @@ -585,6 +577,7 @@ module Bundler::Molinillo states.find { |s| s.name == name }.requirement end # @return [ResolutionState] the state whose `requirement` is the given # `requirement`. def find_state_for(requirement) @@ -592,6 +585,7 @@ module Bundler::Molinillo states.find { |i| requirement == i.requirement } end # @return [Conflict] a {Conflict} that reflects the failure to activate # the {#possibility} in conjunction with the current {#state} def create_conflict(underlying_error = nil) @@ -628,6 +622,7 @@ module Bundler::Molinillo vertex.requirements.map { |r| requirement_tree_for(r) } end # @return [Array<Object>] the list of requirements that led to # `requirement` being required. def requirement_tree_for(requirement) @@ -673,9 +668,8 @@ module Bundler::Molinillo attempt_to_filter_existing_spec(existing_vertex) else latest = possibility.latest_version - # use reject!(!satisfied) for 1.8.7 compatibility - possibility.possibilities.reject! do |possibility| - !requirement_satisfied_by?(requirement, activated, possibility) end if possibility.latest_version.nil? # ensure there's a possibility for better error messages @@ -705,7 +699,7 @@ module Bundler::Molinillo # Generates a filtered version of the existing vertex's `PossibilitySet` using the # current state's `requirement` - # @param [Object] existing vertex # @return [PossibilitySet] filtered possibility set def filtered_possibility_set(vertex) PossibilitySet.new(vertex.payload.dependencies, vertex.payload.possibilities & possibility.possibilities) @@ -730,7 +724,7 @@ module Bundler::Molinillo end # Requires the dependencies that the recently activated spec has - # @param [Object] activated_possibility the PossibilitySet that has just been # activated # @return [void] def require_nested_dependencies_for(possibility_set) @@ -749,6 +743,8 @@ module Bundler::Molinillo # Pushes a new {DependencyState} that encapsulates both existing and new # requirements # @param [Array] new_requirements # @return [void] def push_state_for_requirements(new_requirements, requires_sort = true, new_activated = activated) new_requirements = sort_dependencies(new_requirements.uniq, new_activated, conflicts) if requires_sort @@ -767,7 +763,8 @@ module Bundler::Molinillo # Checks a proposed requirement with any existing locked requirement # before generating an array of possibilities for it. - # @param [Object] the proposed requirement # @return [Array] possibilities def possibilities_for_requirement(requirement, activated = self.activated) return [] unless requirement @@ -778,7 +775,8 @@ module Bundler::Molinillo group_possibilities(search_for(requirement)) end - # @param [Object] the proposed requirement # @return [Array] possibility set containing only the locked requirement, if any def locked_requirement_possibility_set(requirement, activated = self.activated) all_possibilities = search_for(requirement) @@ -797,8 +795,8 @@ module Bundler::Molinillo # Build an array of PossibilitySets, with each element representing a group of # dependency versions that all have the same sub-dependency version constraints # and are contiguous. - # @param [Array] an array of possibilities - # @return [Array] an array of possibility sets def group_possibilities(possibilities) possibility_sets = [] current_possibility_set = nil @@ -3,6 +3,8 @@ require_relative '../../../../uri/lib/uri' require 'cgi' # for escaping require_relative '../../../../connection_pool/lib/connection_pool' ## # Persistent connections for Net::HTTP # @@ -147,14 +149,9 @@ class Bundler::Persistent::Net::HTTP::Persistent EPOCH = Time.at 0 # :nodoc: ## - # Is OpenSSL available? - HAVE_OPENSSL = begin # :nodoc: - require 'openssl' - true - rescue LoadError - false - end ## # The default connection pool size is 1/4 the allowed open files @@ -0,0 +1,154 @@ @@ -0,0 +1,4 @@ @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = "2.2.0.rc.2".freeze def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-ADD" "1" "October 2020" "" "" . .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://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-BINSTUBS" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CACHE" "1" "October 2020" "" "" . .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://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CHECK" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CLEAN" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CONFIG" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-config\fR \- Set bundler configuration options @@ -262,9 +262,6 @@ The following is a list of all configuration keys and their purpose\. You can le \fBsilence_root_warning\fR (\fBBUNDLE_SILENCE_ROOT_WARNING\fR): Silence the warning Bundler prints when installing gems as root\. . .IP "\(bu" 4 -\fBspecific_platform\fR (\fBBUNDLE_SPECIFIC_PLATFORM\fR): Allow bundler to resolve for the specific running platform and store it in the lockfile, instead of only using a generic platform\. A specific platform is the exact platform triple reported by \fBGem::Platform\.local\fR, such as \fBx86_64\-darwin\-16\fR or \fBuniversal\-java\-1\.8\fR\. On the other hand, generic platforms are those such as \fBruby\fR, \fBmswin\fR, or \fBjava\fR\. In this example, \fBx86_64\-darwin\-16\fR would map to \fBruby\fR and \fBuniversal\-java\-1\.8\fR to \fBjava\fR\. -. -.IP "\(bu" 4 \fBssl_ca_cert\fR (\fBBUNDLE_SSL_CA_CERT\fR): Path to a designated CA certificate file or folder containing multiple certificates for trusted CAs in PEM format\. . .IP "\(bu" 4 @@ -441,7 +438,7 @@ For gems with a git source with HTTP(S) URL you can specify credentials like so: . .nf -bundle config set \-\-global https://\.com/bundler/bundler\.git username:password . .fi . @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-DOCTOR" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-doctor\fR \- Checks the bundle for common problems @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-EXEC" "1" "October 2020" "" "" . .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://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-GEM" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INFO" "1" "October 2020" "" "" . .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://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INIT" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-init\fR \- Generates a Gemfile into the current working directory @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INJECT" "1" "October 2020" "" "" . .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://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INSTALL" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile @@ -67,7 +67,7 @@ The maximum number of parallel download and install jobs\. The default is \fB1\f . .TP \fB\-\-local\fR -Do not attempt to connect to \fBrubygems\.org\fR\. Instead, Bundler will use the gems already present in Rubygems\' cache or in \fBvendor/cache\fR\. Note that if a appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\. . .TP \fB\-\-no\-cache\fR @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-LIST" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-list\fR \- List all the gems in the bundle @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-LOCK" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-OPEN" "1" "October 2020" "" "" . .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://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-OUTDATED" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-outdated\fR \- List installed gems with newer versions available @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-PLATFORM" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-platform\fR \- Displays platform compatibility information @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-PRISTINE" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-REMOVE" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-remove\fR \- Removes gems from the Gemfile @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-SHOW" "1" "October 2020" "" "" . .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://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-UPDATE" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-update\fR \- Update your gems to the latest available versions @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-VIZ" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE" "1" "October 2020" "" "" . .SH "NAME" \fBbundle\fR \- Ruby Dependency Management @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://.com/rtomayko/ronn/tree/0.7.3 . -.TH "GEMFILE" "5" "October 2020" "" "" . .SH "NAME" \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs @@ -32,49 +32,49 @@ RSpec.describe "bundle executable" do it "aliases e to exec" do bundle "e --help" - expect(out).to include("BUNDLE-EXEC") end it "aliases ex to exec" do bundle "ex --help" - expect(out).to include("BUNDLE-EXEC") end it "aliases exe to exec" do bundle "exe --help" - expect(out).to include("BUNDLE-EXEC") end it "aliases c to check" do bundle "c --help" - expect(out).to include("BUNDLE-CHECK") end it "aliases i to install" do bundle "i --help" - expect(out).to include("BUNDLE-INSTALL") end it "aliases ls to list" do bundle "ls --help" - expect(out).to include("BUNDLE-LIST") end it "aliases package to cache" do bundle "package --help" - expect(out).to include("BUNDLE-CACHE") end it "aliases pack to cache" do bundle "pack --help" - expect(out).to include("BUNDLE-CACHE") end end @@ -3,28 +3,25 @@ require "net/http" require "bundler/compact_index_client" require "bundler/compact_index_client/updater" RSpec.describe Bundler::CompactIndexClient::Updater do let(:fetcher) { double(:fetcher) } - let(:local_path) { Pathname("/tmp/localpath") } let(:remote_path) { double(:remote_path) } let!(:updater) { described_class.new(fetcher) } context "when the ETag header is missing" do # Regression test for https://.com/rubygems/bundler/issues/5463 - let(:response) { double(:response, :body => "") } - - it "MisMatchedChecksumError is raised" do - # Twice: #update retries on failure - expect(response).to receive(:[]).with("Content-Encoding").twice { "" } - expect(response).to receive(:[]).with("ETag").twice { nil } - expect(fetcher).to receive(:call).twice { response } - expect do - updater.update(local_path, remote_path) - end.to raise_error(Bundler::CompactIndexClient::Updater::MisMatchedChecksumError) end end @@ -43,7 +40,8 @@ RSpec.describe Bundler::CompactIndexClient::Updater do context "when bundler doesn't have permissions on Dir.tmpdir" do it "Errno::EACCES is raised" do - allow(Dir).to receive(:mktmpdir) { raise Errno::EACCES } expect do updater.update(local_path, remote_path) @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "openssl" require "bundler/settings" RSpec.describe Bundler::Env do @@ -17,100 +17,81 @@ RSpec.describe Bundler::Fetcher::Index do end context "error handling" do - shared_examples_for "the error is properly handled" do - let(:remote_uri) { Bundler::URI("http://remote-uri.org") } - before do - allow(subject).to receive(:remote_uri).and_return(remote_uri) - end - context "when certificate verify failed" do - let(:error_message) { "certificate verify failed" } - it "should raise a Bundler::Fetcher::CertificateFailureError" do - expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::CertificateFailureError, - %r{Could not verify the SSL certificate for http://sample_uri.com}) - end end - context "when a 401 response occurs" do - let(:error_message) { "401" } - - before do - allow(remote_uri).to receive(:userinfo).and_return(userinfo) - end - - context "and there was userinfo" do - let(:userinfo) { double(:userinfo) } - it "should raise a Bundler::Fetcher::BadAuthenticationError" do - expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::BadAuthenticationError, - %r{Bad username or password for http://remote-uri.org}) - end - end - context "and there was no userinfo" do - let(:userinfo) { nil } - it "should raise a Bundler::Fetcher::AuthenticationRequiredError" do - expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError, - %r{Authentication is required for http://remote-uri.org}) - end end end - context "when a 403 response occurs" do - let(:error_message) { "403" } - before do - allow(remote_uri).to receive(:userinfo).and_return(userinfo) end - context "and there was userinfo" do - let(:userinfo) { double(:userinfo) } - it "should raise a Bundler::Fetcher::BadAuthenticationError" do - expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::BadAuthenticationError, - %r{Bad username or password for http://remote-uri.org}) - end - end - context "and there was no userinfo" do - let(:userinfo) { nil } - it "should raise a Bundler::Fetcher::AuthenticationRequiredError" do - expect { subject.specs(gem_names) }.to raise_error(Bundler::Fetcher::AuthenticationRequiredError, - %r{Authentication is required for http://remote-uri.org}) - end end end - context "any other message is returned" do - let(:error_message) { "You get an error, you get an error!" } - - before { allow(Bundler).to receive(:ui).and_return(double(:trace => nil)) } - it "should raise a Bundler::HTTPError" do - expect { subject.specs(gem_names) }.to raise_error(Bundler::HTTPError, "Could not fetch specs from http://sample_uri.com") end end end - context "when a Gem::RemoteFetcher::FetchError occurs" do - before { allow(rubygems).to receive(:fetch_all_remote_specs) { raise Gem::RemoteFetcher::FetchError.new(error_message, nil) } } - it_behaves_like "the error is properly handled" - end - context "when a OpenSSL::SSL::SSLError occurs" do - before { allow(rubygems).to receive(:fetch_all_remote_specs) { raise OpenSSL::SSL::SSLError.new(error_message) } } - - it_behaves_like "the error is properly handled" - end - - context "when a Net::HTTPFatalError occurs" do - before { allow(rubygems).to receive(:fetch_all_remote_specs) { raise Net::HTTPFatalError.new(error_message, 404) } } - - it_behaves_like "the error is properly handled" end end end @@ -79,4 +79,10 @@ RSpec.describe Bundler::Plugin::API::Source do end end end end @@ -2,7 +2,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do let(:path) { Pathname("path") } - let(:uri) { "https://.com/bundler/bundler.git" } let(:ref) { "HEAD" } let(:revision) { nil } let(:git_source) { nil } @@ -11,20 +11,20 @@ RSpec.describe Bundler::Source::Git::GitProxy do context "with configured credentials" do it "adds username and password to URI" do Bundler.settings.temporary(uri => "u:p") do - expect(subject).to receive(:git_retry).with(match("https://u:[email protected]/bundler/bundler.git")) subject.checkout end end it "adds username and password to URI for host" do Bundler.settings.temporary(".com" => "u:p") do - expect(subject).to receive(:git_retry).with(match("https://u:[email protected]/bundler/bundler.git")) subject.checkout end end it "does not add username and password to mismatched URI" do - Bundler.settings.temporary("https://u:[email protected]/bundler/bundler-mismatch.git" => "u:p") do expect(subject).to receive(:git_retry).with(match(uri)) subject.checkout end @@ -32,7 +32,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do it "keeps original userinfo" do Bundler.settings.temporary(".com" => "u:p") do - original = "https://orig:[email protected]/bundler/bundler.git" subject = described_class.new(Pathname("path"), original, "HEAD") expect(subject).to receive(:git_retry).with(match(original)) subject.checkout @@ -197,7 +197,12 @@ RSpec.describe "bundle cache" do end it "adds and removes when gems are updated" do - update_repo2 bundle "update", :all => true expect(cached_gem("rack-1.2")).to exist expect(cached_gem("rack-1.0.0")).not_to exist @@ -51,6 +51,18 @@ RSpec.describe "bundle binstubs <gem>" do expect(bundled_app("bin/rake")).to exist end it "displays an error when used without any gem" do install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -96,6 +108,10 @@ RSpec.describe "bundle binstubs <gem>" do before do pristine_system_gems "bundler-#{system_bundler_version}" build_repo2 do build_gem "prints_loaded_gems", "1.0" do |s| s.executables = "print_loaded_gems" s.bindir = "exe" @@ -262,7 +278,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "sets correct permissions for binstubs" do - skip "https://.com/rubygems/bundler/issues/6895" if Gem.win_platform? with_umask(0o002) do install_gemfile <<-G @@ -352,6 +368,14 @@ RSpec.describe "bundle binstubs <gem>" do expect(bundled_app("foo/rackup")).to exist end end end context "when the bin already exists" do @@ -417,8 +441,14 @@ RSpec.describe "bundle binstubs <gem>" do end it "works if the gem has development dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "with_development_dependency" G @@ -71,13 +71,19 @@ RSpec.describe "bundle check" do end it "prints a generic message if you changed your lockfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem 'rails' G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rails" gem "rails_pinned_to_old_activesupport" G @@ -603,8 +603,7 @@ RSpec.describe "bundle clean" do it "when using --force on system gems, it doesn't remove binaries" do bundle "config set path.system true" - build_repo2 - update_repo2 do build_gem "bindir" do |s| s.bindir = "exe" s.executables = "foo" @@ -640,7 +639,7 @@ RSpec.describe "bundle clean" do end end - realworld_system_gems "fiddle" install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" @@ -2,8 +2,43 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do before :each do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rack" gem "activesupport", :group => :test gem "rack_middleware", :group => :development @@ -28,7 +63,7 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do it "starts another REPL if configured as such" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "pry" G bundle "config set console pry" @@ -87,7 +122,7 @@ RSpec.describe "bundle console", :bundler => "< 3", :readline => true do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rack" gem "activesupport", :group => :test gem "rack_middleware", :group => :development @@ -68,7 +68,7 @@ RSpec.describe "bundle exec" do end it "respects custom process title when loading through ruby" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? script_that_changes_its_own_title_and_checks_if_picked_up_by_ps_unix_utility = <<~'RUBY' Process.setproctitle("1-2-3-4-5-6-7") @@ -93,7 +93,7 @@ RSpec.describe "bundle exec" do end it "handles --keep-file-descriptors" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? require "tempfile" @@ -126,7 +126,7 @@ RSpec.describe "bundle exec" do end it "can run a command named --verbose" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? install_gemfile 'gem "rack"' File.open(bundled_app("--verbose"), "w") do |f| @@ -286,7 +286,7 @@ RSpec.describe "bundle exec" do end it "does not duplicate already exec'ed RUBYOPT" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? install_gemfile <<-G gem "rack" @@ -304,7 +304,7 @@ RSpec.describe "bundle exec" do end it "does not duplicate already exec'ed RUBYLIB" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? install_gemfile <<-G gem "rack" @@ -357,7 +357,7 @@ RSpec.describe "bundle exec" do bundle "config set clean false" # want to keep the rackup binstub install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" - gem "with_license" G [true, false].each do |l| bundle "config set disable_exec_load #{l}" @@ -373,7 +373,7 @@ RSpec.describe "bundle exec" do each_prefix.call("exec") do |exec| describe "when #{exec} is used" do before(:each) do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? install_gemfile <<-G gem "rack" @@ -588,7 +588,7 @@ RSpec.describe "bundle exec" do describe "with gems bundled for deployment" do it "works when calling bundler from another script" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? gemfile <<-G module Monkey @@ -644,7 +644,7 @@ RSpec.describe "bundle exec" do shared_examples_for "it runs" do it "like a normally executed executable" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? subject expect(exitstatus).to eq(exit_code) @@ -698,15 +698,23 @@ RSpec.describe "bundle exec" do let(:exit_code) { 1 } let(:expected_err) do "bundler: failed to load command: #{path} (#{path})" \ - "\nRuntimeError: ERROR\n #{path}:10:in `<top (required)>'" end - it_behaves_like "it runs" end context "the executable raises an error without a backtrace" do let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } let(:exit_code) { 1 } - let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" } let(:expected) { super() } it_behaves_like "it runs" @@ -747,7 +755,7 @@ RSpec.describe "bundle exec" do let(:expected) { "" } let(:expected_err) { <<-EOS.strip } \e[31mCould not find gem 'rack (= 2)' in locally installed gems. -The source contains 'rack' at: 1.0.0\e[0m \e[33mRun `bundle install` to install missing gems.\e[0m EOS @@ -825,7 +833,7 @@ __FILE__: #{path.to_s.inspect} RUBY it "receives the signal" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? bundle("exec #{path}") do |_, o, thr| o.gets # Consumes 'Started' and ensures that thread has started @@ -848,7 +856,7 @@ __FILE__: #{path.to_s.inspect} RUBY it "makes sure no unexpected signals are restored to DEFAULT" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? test_signals.each do |n| Signal.trap(n, "IGNORE") @@ -865,6 +873,8 @@ __FILE__: #{path.to_s.inspect} context "nested bundle exec" do context "when bundle in a local path" do before do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -874,8 +884,6 @@ __FILE__: #{path.to_s.inspect} end it "correctly shells out" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? - file = bundled_app("file_that_bundle_execs.rb") create_file(file, <<-RUBY) #!#{Gem.ruby} @@ -887,12 +895,55 @@ __FILE__: #{path.to_s.inspect} end end context "with a system gem that shadows a default gem" do let(:openssl_version) { "99.9.9" } let(:expected) { ruby "gem 'openssl', '< 999999'; require 'openssl'; puts OpenSSL::VERSION", :artifice => nil, :raise_on_error => false } it "only leaves the default gem in the stdlib available" do - skip "https://.com/rubygems/bundler/issues/6898" if Gem.win_platform? skip "openssl isn't a default gem" if expected.empty? install_gemfile "" # must happen before installing the broken system gem @@ -1,24 +1,51 @@ # frozen_string_literal: true RSpec.describe "bundle fund" do it "prints fund information for all gems in the bundle" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata' gem 'has_funding' gem 'rack-obama' G bundle "fund" - expect(out).to include("* has_metadata (1.0)\n Funding: https://example.com/has_metadata/funding") expect(out).to include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding") expect(out).to_not include("rack-obama") end it "does not consider fund information for gem dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem 'gem_with_dependent_funding' G @@ -30,7 +57,7 @@ RSpec.describe "bundle fund" do it "prints message if none of the gems have fund information" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem 'rack-obama' G @@ -42,13 +69,13 @@ RSpec.describe "bundle fund" do describe "with --group option" do it "prints fund message for only specified group gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata', :group => :development gem 'has_funding' G bundle "fund --group development" - expect(out).to include("* has_metadata (1.0)\n Funding: https://example.com/has_metadata/funding") expect(out).to_not include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding") end end @@ -3,8 +3,22 @@ RSpec.describe "bundle info" do context "with a standard Gemfile" do before do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rails" gem "has_metadata" G @@ -66,7 +80,6 @@ RSpec.describe "bundle info" do \tHomepage: http://example.com \tDocumentation: https://www.example.info/gems/bestgemever/0.0.1 \tSource Code: https://example.com/user/bestgemever -\tFunding: https://example.com/has_metadata/funding \tWiki: https://example.com/user/bestgemever/wiki \tChangelog: https://example.com/user/bestgemever/CHANGELOG.md \tBug Tracker: https://example.com/user/bestgemever/issues @@ -141,8 +141,14 @@ RSpec.describe "bundle install with gem sources" do end it "does not install the development dependency" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "with_development_dependency" G @@ -216,6 +222,18 @@ RSpec.describe "bundle install with gem sources" do expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5" end describe "with a gem that installs multiple platforms" do it "installs gems for the local platform as first choice" do skip "version is 1.0, not 1.0.0" if Gem.win_platform? @@ -294,8 +312,11 @@ RSpec.describe "bundle install with gem sources" do end it "finds gems in multiple sources", :bundler => "< 3" do - build_repo2 - update_repo2 install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -2,8 +2,14 @@ RSpec.describe "bundle licenses" do before :each do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rails" gem "with_license" G @@ -18,7 +24,7 @@ RSpec.describe "bundle licenses" do it "performs an automatic bundle install" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rails" gem "with_license" gem "foo" @@ -117,6 +117,10 @@ RSpec.describe "bundle list" do context "with paths option" do before do build_repo2 do build_gem "bar" end @@ -15,7 +15,7 @@ RSpec.describe "bundle lock" do gemfile <<-G source "#{file_uri_for(repo)}" gem "rails" - gem "with_license" gem "foo" G @@ -40,7 +40,7 @@ RSpec.describe "bundle lock" do activeresource (= 2.3.2) rake (= 13.0.1) rake (13.0.1) - with_license (1.0) PLATFORMS #{lockfile_platforms} @@ -48,7 +48,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES foo rails - with_license BUNDLED WITH #{Bundler::VERSION} @@ -14,6 +14,7 @@ RSpec.describe "bundle gem" do prepare_gemspec(bundled_app(gem_name, "#{gem_name}.gemspec")) rubocop_version = RUBY_VERSION > "2.4" ? "0.90.0" : "0.80.1" gems = ["minitest", "rake", "rake-compiler", "rspec", "rubocop -v #{rubocop_version}", "test-unit"] gems += ["rubocop-ast -v 0.4.0"] if rubocop_version == "0.90.0" path = Bundler.feature_flag.default_install_uses_path? ? local_gem_path(:base => bundled_app(gem_name)) : system_gem_path realworld_system_gems gems, :path => path @@ -423,7 +424,7 @@ RSpec.describe "bundle gem" do it "requires the version file" do bundle "gem #{gem_name}" - expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(%r{require "#{require_path}/version"}) end it "creates a base error class" do @@ -910,6 +911,8 @@ RSpec.describe "bundle gem" do let(:require_path) { "test_gem" } let(:flags) { nil } it "does not nest constants" do @@ -963,6 +966,8 @@ RSpec.describe "bundle gem" do let(:require_path) { "test/gem" } it "nests constants so they work" do bundle "gem #{gem_name}" expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb").read).to match(/module Test\n module Gem/) @@ -83,7 +83,7 @@ RSpec.describe "bundle remove" do end end - describe "remove mutiple gems from gemfile" do context "when all gems are present in gemfile" do it "shows success fir all removed gems" do gemfile <<-G @@ -210,7 +210,7 @@ RSpec.describe "bundle remove" do end end - context "when the gem belongs to mutiple groups" do it "removes the groups" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -616,4 +616,84 @@ RSpec.describe "bundle remove" do expect(out).to include("foo could not be removed.") end end end @@ -15,6 +15,10 @@ RSpec.describe "bundle update" do describe "with no arguments", :bundler => "< 3" do it "updates the entire bundle" do update_repo2 do build_gem "activesupport", "3.0" end @@ -38,6 +42,10 @@ RSpec.describe "bundle update" do describe "with --all", :bundler => "3" do it "updates the entire bundle" do update_repo2 do build_gem "activesupport", "3.0" end @@ -103,6 +111,10 @@ RSpec.describe "bundle update" do describe "with a top level dependency" do it "unlocks all child dependencies that are unrelated to other locked dependencies" do update_repo2 do build_gem "activesupport", "3.0" end @@ -124,7 +136,12 @@ RSpec.describe "bundle update" do describe "with a child dependency" do it "should update the child dependency" do - update_repo2 bundle "update rack" expect(the_bundle).to include_gems "rack 1.2" end @@ -217,6 +234,10 @@ RSpec.describe "bundle update" do gem "rack" G update_repo2 do build_gem "activesupport", "3.0" end bundle "update --group development" @@ -269,6 +290,10 @@ RSpec.describe "bundle update" do gem "rack" G update_repo2 do build_gem "activesupport", "3.0" end bundle "update --group development" @@ -446,6 +471,10 @@ RSpec.describe "bundle update in more complicated situations" do G update_repo2 do build_gem "thin", "2.0" do |s| s.add_dependency "rack" end @@ -54,6 +54,12 @@ RSpec.describe "bundle install" do end it "works for gems with multiple versions in its dependencies" do install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" @@ -93,6 +99,12 @@ RSpec.describe "bundle install" do it "causes a conflict if child dependencies conflict" do bundle "config set force_ruby_platform true" install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "activemerchant" @@ -114,6 +126,12 @@ RSpec.describe "bundle install" do it "causes a conflict if a child dependency conflicts with the Gemfile" do bundle "config set force_ruby_platform true" install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "rails_pinned_to_old_activesupport" @@ -132,6 +150,12 @@ RSpec.describe "bundle install" do end it "does not cause a conflict if new dependencies in the Gemfile require older dependencies than the lockfile" do install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" gem 'rails', "2.3.2" @@ -361,10 +361,7 @@ RSpec.describe "install in deployment or frozen mode" do bundle "config --local deployment true" bundle :install, :raise_on_error => false expect(err).to include("deployment mode") - # The drive letter of the Windows environment is fragile value in Actions - unless Gem.win_platform? - expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}") - end expect(err).not_to include("You have added to the Gemfile") expect(err).not_to include("You have changed in the Gemfile") end @@ -388,10 +385,7 @@ RSpec.describe "install in deployment or frozen mode" do bundle "config --local deployment true" bundle :install, :raise_on_error => false expect(err).to include("deployment mode") - # The drive letter of the Windows environment is fragile value in Actions - unless Gem.win_platform? - expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`") - end expect(err).not_to include("You have added to the Gemfile") expect(err).not_to include("You have deleted from the Gemfile") end @@ -422,8 +422,6 @@ RSpec.describe "bundle install from an existing gemspec" do end end - bundle "config specific_platform false" - %w[ruby jruby].each do |platform| simulate_platform(platform) do install_gemfile <<-G @@ -30,11 +30,15 @@ RSpec.describe "bundle install with git sources" do expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes :size => 1 end - it "caches the git repo globally" do simulate_new_machine bundle "config set global_gem_cache true" bundle :install expect(Dir["#{home}/.bundle/cache/git/foo-1.0-*"]).to have_attributes :size => 1 end it "caches the evaluated gemspec" do @@ -83,7 +87,7 @@ RSpec.describe "bundle install with git sources" do gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}" G - expect(err).to include("The source contains 'foo' at: 1.0") end it "complains with version and platform if pinned specs don't exist in the git repo" do @@ -99,7 +103,7 @@ RSpec.describe "bundle install with git sources" do end G - expect(err).to include("The source contains 'only_java' at: 1.0 java") end it "complains with multiple versions and platforms if pinned specs don't exist in the git repo" do @@ -120,7 +124,7 @@ RSpec.describe "bundle install with git sources" do end G - expect(err).to include("The source contains 'only_java' at: 1.0 java, 1.1 java") end it "still works after moving the application directory" do @@ -933,8 +937,6 @@ RSpec.describe "bundle install with git sources" do end it "prints a friendly error if a file blocks the git repo" do - skip "drive letter is not detected correctly in error message" if Gem.win_platform? - build_git "foo" FileUtils.mkdir_p(default_bundle_path) @@ -718,11 +718,11 @@ RSpec.describe "bundle install with explicit source paths" do expect(bar_file).not_to be_file build_lib "foo" do |s| - s.write("lib/rubygems_plugin.rb", "FileUtils.touch('#{foo_file}')") end build_git "bar" do |s| - s.write("lib/rubygems_plugin.rb", "FileUtils.touch('#{bar_file}')") end install_gemfile <<-G @@ -255,32 +255,6 @@ RSpec.describe "bundle install across platforms" do expect(the_bundle).to include_gems "nokogiri 1.4.2 JAVA", "weakling 0.0.3" end - it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 3" do - simulate_platform x64_mac - - update_repo2 do - build_gem "facter", "2.4.6" - build_gem "facter", "2.4.6" do |s| - s.platform = "universal-darwin" - s.add_runtime_dependency "CFPropertyList" - end - build_gem "CFPropertyList" - end - - install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - - gem "facter" - G - - expect(err).to include "Unable to use the platform-specific (universal-darwin) version of facter (2.4.6) " \ - "because it has different dependencies from the ruby version. " \ - "To use the platform-specific version of the gem, run `bundle config set --local specific_platform true` and install again." - - expect(the_bundle).to include_gem "facter 2.4.6" - expect(the_bundle).not_to include_gem "CFPropertyList" - end - it "works with gems with platform-specific dependency having different requirements order" do simulate_platform x64_mac @@ -430,7 +404,7 @@ RSpec.describe "bundle install with platform conditionals" do expect(out).not_to match(/Could not find gem 'some_gem/) end - it "resolves all platforms by default and without warning messages" do simulate_platform "ruby" gemfile <<-G @@ -447,14 +421,9 @@ RSpec.describe "bundle install with platform conditionals" do GEM remote: #{file_uri_for(gem_repo1)}/ specs: - rack (1.0.0) PLATFORMS - java ruby - x64-mingw32 - x86-mingw32 - x86-mswin32 DEPENDENCIES rack @@ -469,13 +438,21 @@ RSpec.describe "when a gem has no architecture" do it "still installs correctly" do simulate_platform mswin gemfile <<-G # Try to install gem with nil arch source "http://localgemserver.test/" gem "rcov" G - bundle :install, :artifice => "windows" expect(the_bundle).to include_gems "rcov 1.0.0" end end @@ -597,6 +597,10 @@ RSpec.describe "bundle install with gems on multiple sources" do G build_repo2 do build_gem "bar" end @@ -1,53 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle install with specific_platform enabled" do - before do - bundle "config set specific_platform true" - - build_repo2 do - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86_64-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x86-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "x64-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1") {|s| s.platform = "universal-darwin" } - - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86_64-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x64-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") {|s| s.platform = "x86-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.5") - - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "universal-darwin" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86_64-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x86-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") {|s| s.platform = "x64-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.4") - - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86_64-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x86-linux" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "x64-mingw32" } - build_gem("google-protobuf", "3.0.0.alpha.5.0.3") {|s| s.platform = "universal-darwin" } - - build_gem("google-protobuf", "3.0.0.alpha.4.0") - build_gem("google-protobuf", "3.0.0.alpha.3.1.pre") - build_gem("google-protobuf", "3.0.0.alpha.3") - build_gem("google-protobuf", "3.0.0.alpha.2.0") - build_gem("google-protobuf", "3.0.0.alpha.1.1") - build_gem("google-protobuf", "3.0.0.alpha.1.0") - - build_gem("facter", "2.4.6") - build_gem("facter", "2.4.6") do |s| - s.platform = "universal-darwin" - s.add_runtime_dependency "CFPropertyList" - end - build_gem("CFPropertyList") - end - end - let(:google_protobuf) { <<-G } source "#{file_uri_for(gem_repo2)}" gem "google-protobuf" @@ -57,6 +10,7 @@ RSpec.describe "bundle install with specific_platform enabled" do before { simulate_platform "x86_64-darwin-15" } it "locks to both the specific darwin platform and ruby" do install_gemfile(google_protobuf) allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) expect(the_bundle.locked_gems.platforms).to eq([pl("ruby"), pl("x86_64-darwin-15")]) @@ -67,14 +21,66 @@ RSpec.describe "bundle install with specific_platform enabled" do ]) end - it "caches both the universal-darwin and ruby gems when --all-platforms is passed" do gemfile(google_protobuf) - bundle "package --all-platforms" expect([cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1"), cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin")]). to all(exist) end it "uses the platform-specific gem with extra dependencies" do install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" gem "facter" @@ -94,6 +100,7 @@ RSpec.describe "bundle install with specific_platform enabled" do end it "adds the foreign platform" do install_gemfile(google_protobuf) bundle "lock --add-platform=#{x64_mingw}" @@ -106,6 +113,7 @@ RSpec.describe "bundle install with specific_platform enabled" do end it "falls back on plain ruby when that version doesnt have a platform-specific gem" do install_gemfile(google_protobuf) bundle "lock --add-platform=#{java}" @@ -117,4 +125,55 @@ RSpec.describe "bundle install with specific_platform enabled" do end end end end @@ -138,19 +138,6 @@ RSpec.describe "compact index api" do expect(the_bundle).to include_gems("foo 1.0") end - it "falls back when the API errors out" do - simulate_platform mswin - - gemfile <<-G - source "#{source_uri}" - gem "rcov" - G - - bundle :install, :artifice => "windows" - expect(out).to include("Fetching source index from #{source_uri}") - expect(the_bundle).to include_gems "rcov 1.0.0" - end - it "falls back when the API URL returns 403 Forbidden" do gemfile <<-G source "#{source_uri}" @@ -258,14 +245,37 @@ The checksum of /versions does not match the checksum provided by the server! So end it "does not double check for gems that are only installed locally" do - system_gems %w[rack-1.0.0 thin-1.0 net_a-1.0] bundle "config set --local path.system true" ENV["BUNDLER_SPEC_ALL_REQUESTS"] = strip_whitespace(<<-EOS).strip #{source_uri}/versions #{source_uri}/info/rack EOS - install_gemfile <<-G, :artifice => "compact_index", :verbose => true source "#{source_uri}" gem "rack" G @@ -499,13 +509,19 @@ The checksum of /versions does not match the checksum provided by the server! So end it "does not refetch if the only unmet dependency is bundler" do gemfile <<-G source "#{source_uri}" gem "bundler_dep" G - bundle :install, :artifice => "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") end @@ -598,27 +614,6 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "rack 1.0.0" end - it "strips http basic authentication creds for modern index" do - gemfile <<-G - source "#{basic_auth_source_uri}" - gem "rack" - G - - bundle :install, :artifice => "endopint_marshal_fail_basic_authentication" - expect(out).not_to include("#{user}:#{password}") - expect(the_bundle).to include_gems "rack 1.0.0" - end - - it "strips http basic auth creds when it can't reach the server" do - gemfile <<-G - source "#{basic_auth_source_uri}" - gem "rack" - G - - bundle :install, :artifice => "endpoint_500", :raise_on_error => false - expect(out).not_to include("#{user}:#{password}") - end - it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do gemfile <<-G source "#{basic_auth_source_uri}" @@ -121,12 +121,20 @@ RSpec.describe "gemcutter's dependency API" do it "falls back when the API errors out" do simulate_platform mswin gemfile <<-G source "#{source_uri}" gem "rcov" G - bundle :install, :artifice => "windows" expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rcov 1.0.0" end @@ -473,13 +481,19 @@ RSpec.describe "gemcutter's dependency API" do end it "does not refetch if the only unmet dependency is bundler" do gemfile <<-G source "#{source_uri}" gem "bundler_dep" G - bundle :install, :artifice => "endpoint" expect(out).to include("Fetching gem metadata from #{source_uri}") end @@ -578,7 +592,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endopint_marshal_fail_basic_authentication" expect(out).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -166,8 +166,7 @@ RSpec.describe "bundle flex_install" do expect(the_bundle).to include_gems "rack_middleware 1.0", "rack 0.9.1" - build_repo2 - update_repo2 do build_gem "rack-obama", "2.0" do |s| s.add_dependency "rack", "=1.2" end @@ -2,11 +2,38 @@ RSpec.describe "bundle install" do context "with gem sources" do context "when gems include a fund URI" do it "displays the plural fund message after installing" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata' gem 'has_funding' gem 'rack-obama' G @@ -16,7 +43,7 @@ RSpec.describe "bundle install" do it "displays the singular fund message after installing" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem 'has_funding' gem 'rack-obama' G @@ -28,7 +55,7 @@ RSpec.describe "bundle install" do context "when gems do not include fund messages" do it "does not display any fund messages" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "activesupport" G @@ -39,7 +66,7 @@ RSpec.describe "bundle install" do context "when a dependency includes a fund message" do it "does not display the fund message" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem 'gem_with_dependent_funding' G @@ -1,9 +1,46 @@ # frozen_string_literal: true RSpec.describe "bundle install with install-time dependencies" do it "installs gems with implicit rake dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "with_implicit_rake_dep" gem "another_implicit_rake_dep" gem "rake" @@ -43,7 +80,7 @@ RSpec.describe "bundle install with install-time dependencies" do describe "with crazy rubygem plugin stuff" do it "installs plugins" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "net_b" G @@ -52,7 +89,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs plugins depended on by other plugins" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "net_a" G @@ -61,7 +98,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs multiple levels of dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "net_c" gem "net_e" G @@ -72,7 +109,7 @@ RSpec.describe "bundle install with install-time dependencies" do context "with ENV['BUNDLER_DEBUG_RESOLVER'] set" do it "produces debug output" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "net_c" gem "net_e" G @@ -86,7 +123,7 @@ RSpec.describe "bundle install with install-time dependencies" do context "with ENV['DEBUG_RESOLVER'] set" do it "produces debug output" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "net_c" gem "net_e" G @@ -100,7 +137,7 @@ RSpec.describe "bundle install with install-time dependencies" do context "with ENV['DEBUG_RESOLVER_TREE'] set" do it "produces debug output" do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "net_c" gem "net_e" G @@ -126,6 +163,10 @@ RSpec.describe "bundle install with install-time dependencies" do it "installs the older version" do build_repo2 do build_gem "rack", "9001.0.0" do |s| s.required_ruby_version = "> 9000" end @@ -198,13 +239,7 @@ RSpec.describe "bundle install with install-time dependencies" do let(:ruby_requirement) { %("#{RUBY_VERSION}") } let(:error_message_requirement) { "~> #{RUBY_VERSION}.0" } - let(:error_message_platform) do - if Bundler.feature_flag.specific_platform? - " #{Bundler.local_platform}" - else - "" - end - end shared_examples_for "ruby version conflicts" do it "raises an error during resolution" do @@ -1,10 +1,19 @@ # frozen_string_literal: true RSpec.describe "bundle install" do describe "when prerelease gems are available" do it "finds prereleases" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "not_released" G expect(the_bundle).to include_gems "not_released 1.0.pre" @@ -12,7 +21,7 @@ RSpec.describe "bundle install" do it "uses regular releases if available" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "has_prerelease" G expect(the_bundle).to include_gems "has_prerelease 1.0" @@ -20,7 +29,7 @@ RSpec.describe "bundle install" do it "uses prereleases if requested" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "has_prerelease", "1.1.pre" G expect(the_bundle).to include_gems "has_prerelease 1.1.pre" @@ -3,16 +3,28 @@ RSpec.describe "the lockfile format" do include Bundler::GemHelpers it "generates a simple lockfile for a single source, gem" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -37,7 +49,7 @@ RSpec.describe "the lockfile format" do specs: GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -53,14 +65,14 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G, :env => { "BUNDLER_VERSION" => Bundler::VERSION } - source "#{file_uri_for(gem_repo1)}" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -80,7 +92,7 @@ RSpec.describe "the lockfile format" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -95,14 +107,14 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -120,7 +132,7 @@ RSpec.describe "the lockfile format" do it "updates the lockfile's bundler version if not present" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -132,14 +144,14 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rack", "> 0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -160,7 +172,7 @@ RSpec.describe "the lockfile format" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -175,7 +187,7 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" gem "rack" G @@ -189,7 +201,7 @@ RSpec.describe "the lockfile format" do lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -212,7 +224,7 @@ RSpec.describe "the lockfile format" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -227,7 +239,7 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G, :env => { "BUNDLER_VERSION" => Bundler::VERSION } - source "#{file_uri_for(gem_repo1)}/" gem "rack" G @@ -239,7 +251,7 @@ RSpec.describe "the lockfile format" do lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -256,14 +268,14 @@ RSpec.describe "the lockfile format" do it "generates a simple lockfile for a single source, gem with dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack-obama" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) rack-obama (1.0) @@ -282,14 +294,14 @@ RSpec.describe "the lockfile format" do it "generates a simple lockfile for a single source, gem with a version requirement" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack-obama", ">= 1.0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) rack-obama (1.0) @@ -380,13 +392,13 @@ RSpec.describe "the lockfile format" do it "generates lockfiles with multiple requirements" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "net-sftp" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: net-sftp (1.1.1) net-ssh (>= 1.0.0, < 1.99.0) @@ -405,34 +417,6 @@ RSpec.describe "the lockfile format" do expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0" end - it "generates a simple lockfile for a single pinned source, gem with a version requirement", :bundler => "< 3" do - git = build_git "foo" - - install_gemfile <<-G - gem "foo", :git => "#{lib_path("foo-1.0")}" - G - - lockfile_should_be <<-G - GIT - remote: #{lib_path("foo-1.0")} - revision: #{git.ref_for("master")} - specs: - foo (1.0) - - GEM - specs: - - PLATFORMS - #{lockfile_platforms} - - DEPENDENCIES - foo! - - BUNDLED WITH - #{Bundler::VERSION} - G - end - it "generates a simple lockfile for a single pinned source, gem with a version requirement" do git = build_git "foo" @@ -465,7 +449,7 @@ RSpec.describe "the lockfile format" do build_lib "omg", :path => lib_path("omg") gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" platforms :#{not_local_tag} do gem "omg", :path => "#{lib_path("omg")}" @@ -481,7 +465,7 @@ RSpec.describe "the lockfile format" do specs: GEM - remote: #{file_uri_for(gem_repo1)}// specs: rack (1.0.0) @@ -653,7 +637,7 @@ RSpec.describe "the lockfile format" do bar = build_git "bar" install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack" gem "foo", :path => "#{lib_path("foo-1.0")}" @@ -673,7 +657,7 @@ RSpec.describe "the lockfile format" do foo (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -692,7 +676,7 @@ RSpec.describe "the lockfile format" do it "lists gems alphabetically" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "thin" gem "actionpack" @@ -701,7 +685,7 @@ RSpec.describe "the lockfile format" do lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: actionpack (2.3.2) activesupport (= 2.3.2) @@ -727,14 +711,14 @@ RSpec.describe "the lockfile format" do it "orders dependencies' dependencies in alphabetical order" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rails" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: actionmailer (2.3.2) activesupport (= 2.3.2) @@ -766,13 +750,13 @@ RSpec.describe "the lockfile format" do it "orders dependencies by version" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem 'double_deps' G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: double_deps (1.0) net-ssh @@ -792,14 +776,14 @@ RSpec.describe "the lockfile format" do it "does not add the :require option to the lockfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack-obama", ">= 1.0", :require => "rack/obama" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) rack-obama (1.0) @@ -818,14 +802,14 @@ RSpec.describe "the lockfile format" do it "does not add the :group option to the lockfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack-obama", ">= 1.0", :group => :test G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) rack-obama (1.0) @@ -956,51 +940,10 @@ RSpec.describe "the lockfile format" do G end - it "keeps existing platforms in the lockfile", :bundler => "< 3" do lockfile <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ - specs: - rack (1.0.0) - - PLATFORMS - java - - DEPENDENCIES - rack - - BUNDLED WITH - #{Bundler::VERSION} - G - - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" - - gem "rack" - G - - lockfile_should_be <<-G - GEM - remote: #{file_uri_for(gem_repo1)}/ - specs: - rack (1.0.0) - - PLATFORMS - java - #{generic_local_platform} - - DEPENDENCIES - rack - - BUNDLED WITH - #{Bundler::VERSION} - G - end - - it "keeps existing platforms in the lockfile", :bundler => "3" do - lockfile <<-G - GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -1015,21 +958,20 @@ RSpec.describe "the lockfile format" do G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) PLATFORMS java - #{generic_local_platform} - #{specific_local_platform} DEPENDENCIES rack @@ -1039,38 +981,7 @@ RSpec.describe "the lockfile format" do G end - it "persists the spec's platform to the lockfile", :bundler => "< 3" do - build_repo2 do - build_gem "platform_specific", "1.0" do |s| - s.platform = Gem::Platform.new("universal-java-16") - end - end - - simulate_platform "universal-java-16" - - install_gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "platform_specific" - G - - lockfile_should_be <<-G - GEM - remote: #{file_uri_for(gem_repo2)}/ - specs: - platform_specific (1.0-java) - - PLATFORMS - java - - DEPENDENCIES - platform_specific - - BUNDLED WITH - #{Bundler::VERSION} - G - end - - it "persists the spec's platform and specific platform to the lockfile", :bundler => "3" do build_repo2 do build_gem "platform_specific", "1.0" do |s| s.platform = Gem::Platform.new("universal-java-16") @@ -1105,19 +1016,19 @@ RSpec.describe "the lockfile format" do it "does not add duplicate gems" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack" G install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack" gem "activesupport" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: activesupport (2.3.5) rack (1.0.0) @@ -1136,14 +1047,14 @@ RSpec.describe "the lockfile format" do it "does not add duplicate dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack" gem "rack" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -1160,14 +1071,14 @@ RSpec.describe "the lockfile format" do it "does not add duplicate dependencies with versions" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack", "1.0" gem "rack", "1.0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -1184,14 +1095,14 @@ RSpec.describe "the lockfile format" do it "does not add duplicate dependencies in different groups" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack", "1.0", :group => :one gem "rack", "1.0", :group => :two G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (1.0.0) @@ -1208,7 +1119,7 @@ RSpec.describe "the lockfile format" do it "raises if two different versions are used" do install_gemfile <<-G, :raise_on_error => false - source "#{file_uri_for(gem_repo1)}/" gem "rack", "1.0" gem "rack", "1.1" G @@ -1219,7 +1130,7 @@ RSpec.describe "the lockfile format" do it "raises if two different sources are used" do install_gemfile <<-G, :raise_on_error => false - source "#{file_uri_for(gem_repo1)}/" gem "rack" gem "rack", :git => "git://hubz.com" G @@ -1230,13 +1141,13 @@ RSpec.describe "the lockfile format" do it "works correctly with multiple version dependencies" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "rack", "> 0.9", "< 1.0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (0.9.1) @@ -1253,14 +1164,14 @@ RSpec.describe "the lockfile format" do it "captures the Ruby version in the lockfile" do install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" ruby '#{RUBY_VERSION}' gem "rack", "> 0.9", "< 1.0" G lockfile_should_be <<-G GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack (0.9.1) @@ -1289,7 +1200,7 @@ RSpec.describe "the lockfile format" do revision = revision_for(lib_path("omg")) gemfile <<-G - source "#{file_uri_for(gem_repo1)}/" gem "omg", :git => "#{lib_path("omg")}", :branch => 'master' G @@ -1314,7 +1225,7 @@ RSpec.describe "the lockfile format" do omg (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ specs: PLATFORMS @@ -1341,7 +1252,7 @@ RSpec.describe "the lockfile format" do omg (1.0) GEM - remote: #{file_uri_for(gem_repo1)}/ specs: PLATFORMS @@ -1358,7 +1269,7 @@ RSpec.describe "the lockfile format" do it "raises a helpful error message when the lockfile is missing deps" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}/ specs: rack_middleware (1.0) @@ -1370,7 +1281,7 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G, :raise_on_error => false - source "#{file_uri_for(gem_repo1)}" gem "rack_middleware" G @@ -1400,7 +1311,11 @@ RSpec.describe "the lockfile format" do context "during updates" do it "preserves Gemfile.lock \\n line endings" do - update_repo2 expect { bundle "update", :all => true }.to change { File.mtime(bundled_app_lock) } expect(File.read(bundled_app_lock)).not_to match("\r\n") @@ -1410,7 +1325,12 @@ RSpec.describe "the lockfile format" do it "preserves Gemfile.lock \\n\\r line endings" do skip "needs to be adapted" if Gem.win_platform? - update_repo2 win_lock = File.read(bundled_app_lock).gsub(/\n/, "\r\n") File.open(bundled_app_lock, "wb") {|f| f.puts(win_lock) } set_lockfile_mtime_to_known_value @@ -1449,7 +1369,7 @@ RSpec.describe "the lockfile format" do it "refuses to install if Gemfile.lock contains conflict markers" do lockfile <<-L GEM - remote: #{file_uri_for(gem_repo1)}// specs: <<<<<<< rack (1.0.0) @@ -1468,7 +1388,7 @@ RSpec.describe "the lockfile format" do L install_gemfile <<-G, :raise_on_error => false - source "#{file_uri_for(gem_repo1)}/" gem "rack" G @@ -496,6 +496,10 @@ G #{ruby_version_correct} G update_repo2 do build_gem "activesupport", "3.0" end @@ -512,6 +516,10 @@ G #{ruby_version_correct_engineless} G update_repo2 do build_gem "activesupport", "3.0" end @@ -208,6 +208,19 @@ RSpec.describe "bundler plugin install" do plugin_should_be_installed("ga-plugin") end context "in deployment mode" do it "installs plugins" do install_gemfile <<-G @@ -33,6 +33,7 @@ RSpec.describe "real source plugins" do def install(spec, opts) mkdir_p(install_path.parent) FileUtils.cp_r(path, install_path) spec_path = install_path.join("\#{spec.full_name}.gemspec") @@ -66,32 +67,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("a-path-gem 1.0") end - it "writes to lock file", :bundler => "< 3" do - bundle "install" - - lockfile_should_be <<-G - PLUGIN SOURCE - remote: #{lib_path("a-path-gem-1.0")} - type: mpath - specs: - a-path-gem (1.0) - - GEM - remote: #{file_uri_for(gem_repo2)}/ - specs: - - PLATFORMS - #{generic_local_platform} - - DEPENDENCIES - a-path-gem! - - BUNDLED WITH - #{Bundler::VERSION} - G - end - - it "writes to lock file", :bundler => "3" do bundle "install" lockfile_should_be <<-G @@ -362,34 +338,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("ma-gitp-gem 1.0") end - it "writes to lock file", :bundler => "< 3" do - revision = revision_for(lib_path("ma-gitp-gem-1.0")) - bundle "install" - - lockfile_should_be <<-G - PLUGIN SOURCE - remote: #{file_uri_for(lib_path("ma-gitp-gem-1.0"))} - type: gitp - revision: #{revision} - specs: - ma-gitp-gem (1.0) - - GEM - remote: #{file_uri_for(gem_repo2)}/ - specs: - - PLATFORMS - #{generic_local_platform} - - DEPENDENCIES - ma-gitp-gem! - - BUNDLED WITH - #{Bundler::VERSION} - G - end - - it "writes to lock file", :bundler => "3" do revision = revision_for(lib_path("ma-gitp-gem-1.0")) bundle "install" @@ -190,7 +190,7 @@ RSpec.describe "The library itself" do line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" } end end - documented_settings = File.read("man/bundle-config.1.ronn")[/LIST OF AVAILABLE KEYS.*/m].scan(/^\* `#{key_pattern}`/).flatten documented_settings.each do |s| all_settings.delete(s) @@ -249,7 +249,7 @@ RSpec.describe "The library itself" do end it "does not use require internally, but require_relative" do - exempt = %r{templates/|vendor/} all_bad_requires = [] lib_tracked_files.each do |filename| next if filename =~ exempt @@ -74,10 +74,10 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = bundle :install, :artifice => nil, :raise_on_error => false expect(out).to include("Fetching source index from #{mirror}") - expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Could not fetch specs from #{mirror}") end it "prints each error and warning on a new line" do @@ -90,10 +90,10 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = expect(out).to include "Fetching source index from #{mirror}/" expect(err).to include <<-EOS.strip -Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ -Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ -Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ -Could not fetch specs from #{mirror}/ EOS end end @@ -112,10 +112,10 @@ Could not fetch specs from #{mirror}/ bundle :install, :artifice => nil, :raise_on_error => false expect(out).to include("Fetching source index from #{mirror}") - expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}") - expect(err).to include("Could not fetch specs from #{mirror}") end end @@ -138,7 +138,7 @@ Could not fetch specs from #{mirror}/ end def setup_mirror - mirror_port = find_unused_port - @mirror_uri = "http://#{host}:#{mirror_port}" end end @@ -369,4 +369,34 @@ RSpec.describe "bundler/inline#gemfile" do expect(out).to eq("WIN") expect(err).to be_empty end end @@ -1233,6 +1233,9 @@ end end << "bundler" exempts << "fiddle" if Gem.win_platform? && Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7") exempts << "uri" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7") exempts end @@ -1313,7 +1316,7 @@ end expect(out).to eq("The Gemfile's dependencies are satisfied") end - # bundler respects paths specified directly in RUBYLIB or RUBYOPT, and # that happens when running ruby from the ruby-core setup. To # workaround, we manually remove those for these tests when they would # override the default gem. @@ -76,14 +76,6 @@ module Spec s.add_dependency "activesupport", ">= 2.0.0" end - build_gem "rails_pinned_to_old_activesupport" do |s| - s.add_dependency "activesupport", "= 1.2.3" - end - - build_gem "missing_dep" do |s| - s.add_dependency "not_here" - end - build_gem "rspec", "1.2.7", :no_default => true do |s| s.write "lib/spec.rb", "SPEC = '1.2.7'" end @@ -158,23 +150,6 @@ module Spec build_gem "duradura", "7.0" - build_gem "multiple_versioned_deps" do |s| - s.add_dependency "weakling", ">= 0.0.1", "< 0.1" - end - - build_gem "not_released", "1.0.pre" - - build_gem "has_prerelease", "1.0" - build_gem "has_prerelease", "1.1.pre" - - build_gem "with_development_dependency" do |s| - s.add_development_dependency "activesupport", "= 2.3.5" - end - - build_gem "with_license" do |s| - s.license = "MIT" - end - build_gem "with_implicit_rake_dep" do |s| s.extensions << "Rakefile" s.write "Rakefile", <<-RUBY @@ -215,10 +190,6 @@ module Spec s.write "lib/rubygems_plugin.rb", "require 'bundler/omg' ; puts 'FAIL'" end - build_gem "bundler_dep" do |s| - s.add_dependency "bundler" - end - # The yard gem iterates over Gem.source_index looking for plugins build_gem "yard" do |s| s.write "lib/yard.rb", <<-Y @@ -228,115 +199,12 @@ module Spec Y end - # The rcov gem is platform mswin32, but has no arch - build_gem "rcov" do |s| - s.platform = Gem::Platform.new([nil, "mswin32", nil]) - s.write "lib/rcov.rb", "RCOV = '1.0.0'" - end - build_gem "net-ssh" build_gem "net-sftp", "1.1.1" do |s| s.add_dependency "net-ssh", ">= 1.0.0", "< 1.99.0" end - # Test complicated gem dependencies for install - build_gem "net_a" do |s| - s.add_dependency "net_b" - s.add_dependency "net_build_extensions" - end - - build_gem "net_b" - - build_gem "net_build_extensions" do |s| - s.add_dependency "rake" - s.extensions << "Rakefile" - s.write "Rakefile", <<-RUBY - task :default do - path = File.expand_path("../lib", __FILE__) - FileUtils.mkdir_p(path) - File.open("\#{path}/net_build_extensions.rb", "w") do |f| - f.puts "NET_BUILD_EXTENSIONS = 'YES'" - end - end - RUBY - end - - build_gem "net_c" do |s| - s.add_dependency "net_a" - s.add_dependency "net_d" - end - - build_gem "net_d" - - build_gem "net_e" do |s| - s.add_dependency "net_d" - end - - # Capistrano did this (at least until version 2.5.10) - # RubyGems 2.2 doesn't allow the specifying of a dependency twice - # See https://.com/rubygems/rubygems/commit/03dbac93a3396a80db258d9bc63500333c25bd2f - build_gem "double_deps", "1.0", :skip_validation => true do |s| - s.add_dependency "net-ssh", ">= 1.0.0" - s.add_dependency "net-ssh" - end - build_gem "foo" - - # A minimal fake pry console - build_gem "pry" do |s| - s.write "lib/pry.rb", <<-RUBY - class Pry - class << self - def toplevel_binding - unless defined?(@toplevel_binding) && @toplevel_binding - TOPLEVEL_BINDING.eval %{ - def self.__pry__; binding; end - Pry.instance_variable_set(:@toplevel_binding, __pry__) - class << self; undef __pry__; end - } - end - @toplevel_binding.eval('private') - @toplevel_binding - end - - def __pry__ - while line = gets - begin - puts eval(line, toplevel_binding).inspect.sub(/^"(.*)"$/, '=> \\1') - rescue Exception => e - puts "\#{e.class}: \#{e.message}" - puts e.backtrace.first - end - end - end - alias start __pry__ - end - end - RUBY - end - - build_gem "has_metadata" do |s| - s.metadata = { - "bug_tracker_uri" => "https://example.com/user/bestgemever/issues", - "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md", - "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1", - "homepage_uri" => "https://bestgemever.example.io", - "mailing_list_uri" => "https://groups.example.com/bestgemever", - "funding_uri" => "https://example.com/has_metadata/funding", - "source_code_uri" => "https://example.com/user/bestgemever", - "wiki_uri" => "https://example.com/user/bestgemever/wiki", - } - end - - build_gem "has_funding", "1.2.3" do |s| - s.metadata = { - "funding_uri" => "https://example.com/has_funding/funding", - } - end - - build_gem "gem_with_dependent_funding", "1.0" do |s| - s.add_dependency "has_funding" - end end end @@ -366,9 +234,6 @@ module Spec def update_repo2 update_repo gem_repo2 do - build_gem "rack", "1.2" do |s| - s.executables = "rackup" - end yield if block_given? end end @@ -658,6 +523,7 @@ module Spec file = Pathname.new(path).join(file) FileUtils.mkdir_p(file.dirname) File.open(file, "w") {|f| f.puts source } end path end @@ -94,11 +94,7 @@ module Spec end def local_platforms - if Bundler.feature_flag.specific_platform? - [local, specific_local_platform] - else - [local] - end end end end @@ -2,9 +2,30 @@ RSpec.describe "bundle update" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata' gem 'has_funding', '< 2.0' G @@ -14,8 +35,8 @@ RSpec.describe "bundle update" do context "when listed gems are updated" do before do gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'has_metadata' gem 'has_funding' G |