mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 01:23:57 +02:00
Merge RubyGems-3.4.15 and Bundler-2.4.15
This commit is contained in:
parent
a36c836433
commit
e44e42c303
25 changed files with 190 additions and 106 deletions
|
@ -76,7 +76,10 @@ module Bundler
|
||||||
|
|
||||||
@lockfile = lockfile
|
@lockfile = lockfile
|
||||||
@lockfile_contents = String.new
|
@lockfile_contents = String.new
|
||||||
|
|
||||||
@locked_bundler_version = nil
|
@locked_bundler_version = nil
|
||||||
|
@resolved_bundler_version = nil
|
||||||
|
|
||||||
@locked_ruby_version = nil
|
@locked_ruby_version = nil
|
||||||
@new_platform = nil
|
@new_platform = nil
|
||||||
@removed_platform = nil
|
@removed_platform = nil
|
||||||
|
@ -146,7 +149,7 @@ module Bundler
|
||||||
@dependency_changes = converge_dependencies
|
@dependency_changes = converge_dependencies
|
||||||
@local_changes = converge_locals
|
@local_changes = converge_locals
|
||||||
|
|
||||||
@incomplete_lockfile = check_missing_lockfile_specs
|
@missing_lockfile_dep = check_missing_lockfile_dep
|
||||||
end
|
end
|
||||||
|
|
||||||
def gem_version_promoter
|
def gem_version_promoter
|
||||||
|
@ -234,6 +237,14 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_dependencies
|
def current_dependencies
|
||||||
|
filter_relevant(dependencies)
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_locked_dependencies
|
||||||
|
filter_relevant(locked_dependencies)
|
||||||
|
end
|
||||||
|
|
||||||
|
def filter_relevant(dependencies)
|
||||||
dependencies.select do |d|
|
dependencies.select do |d|
|
||||||
d.should_include? && !d.gem_platforms([generic_local_platform]).empty?
|
d.should_include? && !d.gem_platforms([generic_local_platform]).empty?
|
||||||
end
|
end
|
||||||
|
@ -273,7 +284,7 @@ module Bundler
|
||||||
@resolve ||= if Bundler.frozen_bundle?
|
@resolve ||= if Bundler.frozen_bundle?
|
||||||
Bundler.ui.debug "Frozen, using resolution from the lockfile"
|
Bundler.ui.debug "Frozen, using resolution from the lockfile"
|
||||||
@locked_specs
|
@locked_specs
|
||||||
elsif !unlocking? && nothing_changed?
|
elsif no_resolve_needed?
|
||||||
if deleted_deps.any?
|
if deleted_deps.any?
|
||||||
Bundler.ui.debug "Some dependencies were deleted, using a subset of the resolution from the lockfile"
|
Bundler.ui.debug "Some dependencies were deleted, using a subset of the resolution from the lockfile"
|
||||||
SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
|
SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
|
||||||
|
@ -310,7 +321,7 @@ module Bundler
|
||||||
|
|
||||||
if @locked_bundler_version
|
if @locked_bundler_version
|
||||||
locked_major = @locked_bundler_version.segments.first
|
locked_major = @locked_bundler_version.segments.first
|
||||||
current_major = Bundler.gem_version.segments.first
|
current_major = bundler_version_to_lock.segments.first
|
||||||
|
|
||||||
updating_major = locked_major < current_major
|
updating_major = locked_major < current_major
|
||||||
end
|
end
|
||||||
|
@ -350,25 +361,16 @@ module Bundler
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bundler_version_to_lock
|
||||||
|
@resolved_bundler_version || Bundler.gem_version
|
||||||
|
end
|
||||||
|
|
||||||
def to_lock
|
def to_lock
|
||||||
require_relative "lockfile_generator"
|
require_relative "lockfile_generator"
|
||||||
LockfileGenerator.generate(self)
|
LockfileGenerator.generate(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
|
def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
|
||||||
msg = String.new
|
|
||||||
msg << "You are trying to install in deployment mode after changing\n" \
|
|
||||||
"your Gemfile. Run `bundle install` elsewhere and add the\n" \
|
|
||||||
"updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control."
|
|
||||||
|
|
||||||
unless explicit_flag
|
|
||||||
suggested_command = unless Bundler.settings.locations("frozen").keys.include?(:env)
|
|
||||||
"bundle config set frozen false"
|
|
||||||
end
|
|
||||||
msg << "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \
|
|
||||||
"freeze \nby running `#{suggested_command}`." if suggested_command
|
|
||||||
end
|
|
||||||
|
|
||||||
added = []
|
added = []
|
||||||
deleted = []
|
deleted = []
|
||||||
changed = []
|
changed = []
|
||||||
|
@ -382,13 +384,8 @@ module Bundler
|
||||||
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
||||||
|
|
||||||
both_sources = Hash.new {|h, k| h[k] = [] }
|
both_sources = Hash.new {|h, k| h[k] = [] }
|
||||||
@dependencies.each {|d| both_sources[d.name][0] = d }
|
current_dependencies.each {|d| both_sources[d.name][0] = d }
|
||||||
|
current_locked_dependencies.each {|d| both_sources[d.name][1] = d }
|
||||||
locked_dependencies.each do |d|
|
|
||||||
next if !Bundler.feature_flag.bundler_3_mode? && @locked_specs[d.name].empty?
|
|
||||||
|
|
||||||
both_sources[d.name][1] = d
|
|
||||||
end
|
|
||||||
|
|
||||||
both_sources.each do |name, (dep, lock_dep)|
|
both_sources.each do |name, (dep, lock_dep)|
|
||||||
next if dep.nil? || lock_dep.nil?
|
next if dep.nil? || lock_dep.nil?
|
||||||
|
@ -403,11 +400,20 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
reason = change_reason
|
reason = change_reason
|
||||||
msg << "\n\n#{reason.split(", ").map(&:capitalize).join("\n")}" unless reason.strip.empty?
|
msg = String.new
|
||||||
|
msg << "#{reason.capitalize.strip}, but the lockfile can't be updated because frozen mode is set"
|
||||||
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
|
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
|
||||||
msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
|
msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
|
||||||
msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
|
msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
|
||||||
msg << "\n"
|
msg << "\n\nRun `bundle install` elsewhere and add the updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control.\n"
|
||||||
|
|
||||||
|
unless explicit_flag
|
||||||
|
suggested_command = unless Bundler.settings.locations("frozen").keys.include?(:env)
|
||||||
|
"bundle config set frozen false"
|
||||||
|
end
|
||||||
|
msg << "If this is a development machine, remove the #{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)} " \
|
||||||
|
"freeze by running `#{suggested_command}`." if suggested_command
|
||||||
|
end
|
||||||
|
|
||||||
raise ProductionError, msg if added.any? || deleted.any? || changed.any? || !nothing_changed?
|
raise ProductionError, msg if added.any? || deleted.any? || changed.any? || !nothing_changed?
|
||||||
end
|
end
|
||||||
|
@ -472,7 +478,11 @@ module Bundler
|
||||||
private :sources
|
private :sources
|
||||||
|
|
||||||
def nothing_changed?
|
def nothing_changed?
|
||||||
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@incomplete_lockfile
|
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@missing_lockfile_dep && !@unlocking_bundler
|
||||||
|
end
|
||||||
|
|
||||||
|
def no_resolve_needed?
|
||||||
|
!unlocking? && nothing_changed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def unlocking?
|
def unlocking?
|
||||||
|
@ -486,7 +496,14 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def expanded_dependencies
|
def expanded_dependencies
|
||||||
dependencies + metadata_dependencies
|
dependencies_with_bundler + metadata_dependencies
|
||||||
|
end
|
||||||
|
|
||||||
|
def dependencies_with_bundler
|
||||||
|
return dependencies unless @unlocking_bundler
|
||||||
|
return dependencies if dependencies.map(&:name).include?("bundler")
|
||||||
|
|
||||||
|
[Dependency.new("bundler", @unlocking_bundler)] + dependencies
|
||||||
end
|
end
|
||||||
|
|
||||||
def resolution_packages
|
def resolution_packages
|
||||||
|
@ -552,6 +569,8 @@ module Bundler
|
||||||
def start_resolution
|
def start_resolution
|
||||||
result = resolver.start
|
result = resolver.start
|
||||||
|
|
||||||
|
@resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
|
||||||
|
|
||||||
SpecSet.new(SpecSet.new(result).for(dependencies, false, @platforms))
|
SpecSet.new(SpecSet.new(result).for(dependencies, false, @platforms))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -609,7 +628,8 @@ module Bundler
|
||||||
[@new_platform, "you added a new platform to your gemfile"],
|
[@new_platform, "you added a new platform to your gemfile"],
|
||||||
[@path_changes, "the gemspecs for path gems changed"],
|
[@path_changes, "the gemspecs for path gems changed"],
|
||||||
[@local_changes, "the gemspecs for git local gems changed"],
|
[@local_changes, "the gemspecs for git local gems changed"],
|
||||||
[@incomplete_lockfile, "your lock file is missing some gems"],
|
[@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
|
||||||
|
[@unlocking_bundler, "an update to the version of Bundler itself was requested"],
|
||||||
].select(&:first).map(&:last).join(", ")
|
].select(&:first).map(&:last).join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -664,7 +684,7 @@ module Bundler
|
||||||
!sources_with_changes.each {|source| @unlock[:sources] << source.name }.empty?
|
!sources_with_changes.each {|source| @unlock[:sources] << source.name }.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_missing_lockfile_specs
|
def check_missing_lockfile_dep
|
||||||
all_locked_specs = @locked_specs.map(&:name) << "bundler"
|
all_locked_specs = @locked_specs.map(&:name) << "bundler"
|
||||||
|
|
||||||
missing = @locked_specs.select do |s|
|
missing = @locked_specs.select do |s|
|
||||||
|
@ -674,10 +694,14 @@ module Bundler
|
||||||
if missing.any?
|
if missing.any?
|
||||||
@locked_specs.delete(missing)
|
@locked_specs.delete(missing)
|
||||||
|
|
||||||
true
|
return missing.first.name
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return if @dependency_changes
|
||||||
|
|
||||||
|
current_dependencies.find do |d|
|
||||||
|
@locked_specs[d.name].empty?
|
||||||
|
end&.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def converge_paths
|
def converge_paths
|
||||||
|
@ -861,8 +885,16 @@ module Bundler
|
||||||
metadata_dependencies.each do |dep|
|
metadata_dependencies.each do |dep|
|
||||||
source_requirements[dep.name] = sources.metadata_source
|
source_requirements[dep.name] = sources.metadata_source
|
||||||
end
|
end
|
||||||
source_requirements[:default_bundler] = source_requirements["bundler"] || sources.default_source
|
|
||||||
|
default_bundler_source = source_requirements["bundler"] || sources.default_source
|
||||||
|
|
||||||
|
if @unlocking_bundler
|
||||||
|
default_bundler_source.add_dependency_names("bundler")
|
||||||
|
else
|
||||||
|
source_requirements[:default_bundler] = default_bundler_source
|
||||||
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
||||||
|
end
|
||||||
|
|
||||||
verify_changed_sources!
|
verify_changed_sources!
|
||||||
source_requirements
|
source_requirements
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,7 +71,7 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_bundled_with
|
def add_bundled_with
|
||||||
add_section("BUNDLED WITH", Bundler::VERSION)
|
add_section("BUNDLED WITH", definition.bundler_version_to_lock.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_section(name, value)
|
def add_section(name, value)
|
||||||
|
|
|
@ -160,7 +160,7 @@ module Bundler
|
||||||
constraint_string = constraint.constraint_string
|
constraint_string = constraint.constraint_string
|
||||||
requirements = constraint_string.split(" OR ").map {|req| Gem::Requirement.new(req.split(",")) }
|
requirements = constraint_string.split(" OR ").map {|req| Gem::Requirement.new(req.split(",")) }
|
||||||
|
|
||||||
if name == "bundler"
|
if name == "bundler" && bundler_pinned_to_current_version?
|
||||||
custom_explanation = "the current Bundler version (#{Bundler::VERSION}) does not satisfy #{constraint}"
|
custom_explanation = "the current Bundler version (#{Bundler::VERSION}) does not satisfy #{constraint}"
|
||||||
extended_explanation = bundler_not_found_message(requirements)
|
extended_explanation = bundler_not_found_message(requirements)
|
||||||
else
|
else
|
||||||
|
@ -230,6 +230,12 @@ module Bundler
|
||||||
def all_versions_for(package)
|
def all_versions_for(package)
|
||||||
name = package.name
|
name = package.name
|
||||||
results = (@base[name] + filter_prereleases(@all_specs[name], package)).uniq {|spec| [spec.version.hash, spec.platform] }
|
results = (@base[name] + filter_prereleases(@all_specs[name], package)).uniq {|spec| [spec.version.hash, spec.platform] }
|
||||||
|
|
||||||
|
if name == "bundler" && !bundler_pinned_to_current_version?
|
||||||
|
bundler_spec = Gem.loaded_specs["bundler"]
|
||||||
|
results << bundler_spec if bundler_spec
|
||||||
|
end
|
||||||
|
|
||||||
locked_requirement = base_requirements[name]
|
locked_requirement = base_requirements[name]
|
||||||
results = filter_matching_specs(results, locked_requirement) if locked_requirement
|
results = filter_matching_specs(results, locked_requirement) if locked_requirement
|
||||||
|
|
||||||
|
@ -254,6 +260,14 @@ module Bundler
|
||||||
@source_requirements[name] || @source_requirements[:default]
|
@source_requirements[name] || @source_requirements[:default]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_bundler_source
|
||||||
|
@source_requirements[:default_bundler]
|
||||||
|
end
|
||||||
|
|
||||||
|
def bundler_pinned_to_current_version?
|
||||||
|
!default_bundler_source.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def name_for_explicit_dependency_source
|
def name_for_explicit_dependency_source
|
||||||
Bundler.default_gemfile.basename.to_s
|
Bundler.default_gemfile.basename.to_s
|
||||||
rescue StandardError
|
rescue StandardError
|
||||||
|
@ -398,7 +412,7 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def bundler_not_found_message(conflict_dependencies)
|
def bundler_not_found_message(conflict_dependencies)
|
||||||
candidate_specs = filter_matching_specs(source_for(:default_bundler).specs.search("bundler"), conflict_dependencies)
|
candidate_specs = filter_matching_specs(default_bundler_source.specs.search("bundler"), conflict_dependencies)
|
||||||
|
|
||||||
if candidate_specs.any?
|
if candidate_specs.any?
|
||||||
target_version = candidate_specs.last.version
|
target_version = candidate_specs.last.version
|
||||||
|
|
|
@ -94,7 +94,7 @@ module Bundler
|
||||||
definition_method :requires
|
definition_method :requires
|
||||||
|
|
||||||
def lock(opts = {})
|
def lock(opts = {})
|
||||||
return if @definition.nothing_changed? && !@definition.unlocking?
|
return if @definition.no_resolve_needed?
|
||||||
@definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
|
@definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -381,7 +381,6 @@ module Bundler
|
||||||
idx = @allow_local ? installed_specs.dup : Index.new
|
idx = @allow_local ? installed_specs.dup : Index.new
|
||||||
|
|
||||||
Dir["#{cache_path}/*.gem"].each do |gemfile|
|
Dir["#{cache_path}/*.gem"].each do |gemfile|
|
||||||
next if /^bundler\-[\d\.]+?\.gem/.match?(gemfile)
|
|
||||||
s ||= Bundler.rubygems.spec_from_gem(gemfile)
|
s ||= Bundler.rubygems.spec_from_gem(gemfile)
|
||||||
s.source = self
|
s.source = self
|
||||||
idx << s
|
idx << s
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: false
|
# frozen_string_literal: false
|
||||||
|
|
||||||
module Bundler
|
module Bundler
|
||||||
VERSION = "2.4.14".freeze
|
VERSION = "2.4.15".freeze
|
||||||
|
|
||||||
def self.bundler_major_version
|
def self.bundler_major_version
|
||||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
require "rbconfig"
|
require "rbconfig"
|
||||||
|
|
||||||
module Gem
|
module Gem
|
||||||
VERSION = "3.4.14"
|
VERSION = "3.4.15"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Must be first since it unloads the prelude from 1.9.2
|
# Must be first since it unloads the prelude from 1.9.2
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#++
|
#++
|
||||||
|
|
||||||
require_relative "../user_interaction"
|
require_relative "../user_interaction"
|
||||||
|
require_relative "../shellwords"
|
||||||
|
|
||||||
class Gem::Ext::Builder
|
class Gem::Ext::Builder
|
||||||
include Gem::UserInteraction
|
include Gem::UserInteraction
|
||||||
|
@ -56,9 +57,8 @@ class Gem::Ext::Builder
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.ruby
|
def self.ruby
|
||||||
require "shellwords"
|
|
||||||
# Gem.ruby is quoted if it contains whitespace
|
# Gem.ruby is quoted if it contains whitespace
|
||||||
cmd = Gem.ruby.shellsplit
|
cmd = Shellwords.split(Gem.ruby)
|
||||||
|
|
||||||
# This load_path is only needed when running rubygems test without a proper installation.
|
# This load_path is only needed when running rubygems test without a proper installation.
|
||||||
# Prepending it in a normal installation will cause problem with order of $LOAD_PATH.
|
# Prepending it in a normal installation will cause problem with order of $LOAD_PATH.
|
||||||
|
@ -82,8 +82,7 @@ class Gem::Ext::Builder
|
||||||
p(command)
|
p(command)
|
||||||
end
|
end
|
||||||
results << "current directory: #{dir}"
|
results << "current directory: #{dir}"
|
||||||
require "shellwords"
|
results << Shellwords.join(command)
|
||||||
results << command.shelljoin
|
|
||||||
|
|
||||||
require "open3"
|
require "open3"
|
||||||
# Set $SOURCE_DATE_EPOCH for the subprocess.
|
# Set $SOURCE_DATE_EPOCH for the subprocess.
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require_relative "../shellwords"
|
||||||
|
|
||||||
# This class is used by rubygems to build Rust extensions. It is a thin-wrapper
|
# This class is used by rubygems to build Rust extensions. It is a thin-wrapper
|
||||||
# over the `cargo rustc` command which takes care of building Rust code in a way
|
# over the `cargo rustc` command which takes care of building Rust code in a way
|
||||||
# that Ruby can use.
|
# that Ruby can use.
|
||||||
|
@ -73,8 +75,6 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
||||||
end
|
end
|
||||||
|
|
||||||
def cargo_command(cargo_toml, dest_path, args = [], crate_name = nil)
|
def cargo_command(cargo_toml, dest_path, args = [], crate_name = nil)
|
||||||
require "shellwords"
|
|
||||||
|
|
||||||
cmd = []
|
cmd = []
|
||||||
cmd += [cargo, "rustc"]
|
cmd += [cargo, "rustc"]
|
||||||
cmd += ["--crate-type", "cdylib"]
|
cmd += ["--crate-type", "cdylib"]
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require_relative "../shellwords"
|
||||||
|
|
||||||
#--
|
#--
|
||||||
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -14,8 +17,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
||||||
rake = ENV["rake"]
|
rake = ENV["rake"]
|
||||||
|
|
||||||
if rake
|
if rake
|
||||||
require "shellwords"
|
rake = Shellwords.split(rake)
|
||||||
rake = rake.shellsplit
|
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
rake = ruby << "-rrubygems" << Gem.bin_path("rake", "rake")
|
rake = ruby << "-rrubygems" << Gem.bin_path("rake", "rake")
|
||||||
|
|
3
lib/rubygems/shellwords.rb
Normal file
3
lib/rubygems/shellwords.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
autoload :Shellwords, "shellwords"
|
|
@ -291,7 +291,7 @@ RSpec.describe "bundle cache" do
|
||||||
G
|
G
|
||||||
subject
|
subject
|
||||||
expect(exitstatus).to eq(16)
|
expect(exitstatus).to eq(16)
|
||||||
expect(err).to include("deployment mode")
|
expect(err).to include("frozen mode")
|
||||||
expect(err).to include("You have added to the Gemfile")
|
expect(err).to include("You have added to the Gemfile")
|
||||||
expect(err).to include("* rack-obama")
|
expect(err).to include("* rack-obama")
|
||||||
bundle "env"
|
bundle "env"
|
||||||
|
|
|
@ -109,7 +109,7 @@ Usage: "bundle inject GEM VERSION"
|
||||||
gem "rack-obama"
|
gem "rack-obama"
|
||||||
G
|
G
|
||||||
bundle "inject 'rack' '> 0'", :raise_on_error => false
|
bundle "inject 'rack' '> 0'", :raise_on_error => false
|
||||||
expect(err).to match(/trying to install in deployment mode after changing/)
|
expect(err).to match(/the lockfile can't be updated because frozen mode is set/)
|
||||||
|
|
||||||
expect(bundled_app_lock.read).not_to match(/rack-obama/)
|
expect(bundled_app_lock.read).not_to match(/rack-obama/)
|
||||||
end
|
end
|
||||||
|
|
|
@ -297,24 +297,27 @@ RSpec.describe "bundle lock" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "updates the bundler version in the lockfile without re-resolving", :rubygems => ">= 3.3.0.dev" do
|
it "updates the bundler version in the lockfile to the latest bundler version" do
|
||||||
build_repo4 do
|
build_repo4 do
|
||||||
build_gem "rack", "1.0"
|
build_gem "bundler", "55"
|
||||||
end
|
end
|
||||||
|
|
||||||
install_gemfile <<-G
|
system_gems "bundler-55", :gem_repo => gem_repo4
|
||||||
source "#{file_uri_for(gem_repo4)}"
|
|
||||||
gem "rack"
|
install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
|
||||||
|
source "https://gems.repo4"
|
||||||
G
|
G
|
||||||
lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2')
|
lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2')
|
||||||
|
|
||||||
FileUtils.rm_r gem_repo4
|
bundle "lock --update --bundler --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
|
||||||
|
expect(lockfile).to end_with("BUNDLED WITH\n 55\n")
|
||||||
|
|
||||||
bundle "lock --update --bundler"
|
update_repo4 do
|
||||||
expect(the_bundle).to include_gem "rack 1.0"
|
build_gem "bundler", "99"
|
||||||
|
end
|
||||||
|
|
||||||
allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
|
bundle "lock --update --bundler --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
|
||||||
expect(the_bundle.locked_gems.bundler_version).to eq v(Bundler::VERSION)
|
expect(lockfile).to end_with("BUNDLED WITH\n 99\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports adding new platforms" do
|
it "supports adding new platforms" do
|
||||||
|
|
|
@ -658,27 +658,27 @@ RSpec.describe "bundle update" do
|
||||||
bundle "update", :all => true, :raise_on_error => false
|
bundle "update", :all => true, :raise_on_error => false
|
||||||
|
|
||||||
expect(last_command).to be_failure
|
expect(last_command).to be_failure
|
||||||
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
|
expect(err).to match(/Bundler is unlocking, but the lockfile can't be updated because frozen mode is set/)
|
||||||
expect(err).to match(/freeze \nby running `bundle config set frozen false`./m)
|
expect(err).to match(/freeze by running `bundle config set frozen false`./)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should fail loudly when frozen is set globally" do
|
it "should fail loudly when frozen is set globally" do
|
||||||
bundle "config set --global frozen 1"
|
bundle "config set --global frozen 1"
|
||||||
bundle "update", :all => true, :raise_on_error => false
|
bundle "update", :all => true, :raise_on_error => false
|
||||||
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
|
expect(err).to match(/Bundler is unlocking, but the lockfile can't be updated because frozen mode is set/).
|
||||||
and match(/freeze \nby running `bundle config set frozen false`./m)
|
and match(/freeze by running `bundle config set frozen false`./)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should fail loudly when deployment is set globally" do
|
it "should fail loudly when deployment is set globally" do
|
||||||
bundle "config set --global deployment true"
|
bundle "config set --global deployment true"
|
||||||
bundle "update", :all => true, :raise_on_error => false
|
bundle "update", :all => true, :raise_on_error => false
|
||||||
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
|
expect(err).to match(/Bundler is unlocking, but the lockfile can't be updated because frozen mode is set/).
|
||||||
and match(/freeze \nby running `bundle config set frozen false`./m)
|
and match(/freeze by running `bundle config set frozen false`./)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not suggest any command to unfreeze bundler if frozen is set through ENV" do
|
it "should not suggest any command to unfreeze bundler if frozen is set through ENV" do
|
||||||
bundle "update", :all => true, :raise_on_error => false, :env => { "BUNDLE_FROZEN" => "true" }
|
bundle "update", :all => true, :raise_on_error => false, :env => { "BUNDLE_FROZEN" => "true" }
|
||||||
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
|
expect(err).to match(/Bundler is unlocking, but the lockfile can't be updated because frozen mode is set/)
|
||||||
expect(err).not_to match(/by running/)
|
expect(err).not_to match(/by running/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1239,7 +1239,7 @@ RSpec.describe "bundle update --ruby" do
|
||||||
end
|
end
|
||||||
|
|
||||||
RSpec.describe "bundle update --bundler" do
|
RSpec.describe "bundle update --bundler" do
|
||||||
it "updates the bundler version in the lockfile without re-resolving" do
|
it "updates the bundler version in the lockfile" do
|
||||||
build_repo4 do
|
build_repo4 do
|
||||||
build_gem "rack", "1.0"
|
build_gem "rack", "1.0"
|
||||||
end
|
end
|
||||||
|
@ -1250,8 +1250,6 @@ RSpec.describe "bundle update --bundler" do
|
||||||
G
|
G
|
||||||
lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2')
|
lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2')
|
||||||
|
|
||||||
FileUtils.rm_r gem_repo4
|
|
||||||
|
|
||||||
bundle :update, :bundler => true, :artifice => "compact_index", :verbose => true
|
bundle :update, :bundler => true, :artifice => "compact_index", :verbose => true
|
||||||
expect(out).to include("Using bundler #{Bundler::VERSION}")
|
expect(out).to include("Using bundler #{Bundler::VERSION}")
|
||||||
|
|
||||||
|
@ -1473,8 +1471,8 @@ RSpec.describe "bundle update --bundler" do
|
||||||
2.1.4
|
2.1.4
|
||||||
L
|
L
|
||||||
|
|
||||||
bundle "update --bundler=2.3.9", :env => { "BUNDLE_FROZEN" => "true" }
|
bundle "update --bundler=2.3.9", :env => { "BUNDLE_FROZEN" => "true" }, :raise_on_error => false
|
||||||
expect(err).to include("Cannot write a changed lockfile while frozen")
|
expect(err).to include("An update to the version of bundler itself was requested, but the lockfile can't be updated because frozen mode is set")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
G
|
G
|
||||||
|
|
||||||
bundle "install --deployment", :raise_on_error => false
|
bundle "install --deployment", :raise_on_error => false
|
||||||
expect(err).to include("deployment mode")
|
expect(err).to include("frozen mode")
|
||||||
expect(err).to include("You have added to the Gemfile")
|
expect(err).to include("You have added to the Gemfile")
|
||||||
expect(err).to include("* rack-obama")
|
expect(err).to include("* rack-obama")
|
||||||
expect(err).not_to include("You have deleted from the Gemfile")
|
expect(err).not_to include("You have deleted from the Gemfile")
|
||||||
|
@ -272,7 +272,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
|
|
||||||
bundle "config set --local deployment true"
|
bundle "config set --local deployment true"
|
||||||
bundle :install, :raise_on_error => false
|
bundle :install, :raise_on_error => false
|
||||||
expect(err).to include("deployment mode")
|
expect(err).to include("frozen mode")
|
||||||
expect(err).to include("You have added to the Gemfile")
|
expect(err).to include("You have added to the Gemfile")
|
||||||
expect(err).to include("* rack-obama")
|
expect(err).to include("* rack-obama")
|
||||||
expect(err).not_to include("You have deleted from the Gemfile")
|
expect(err).not_to include("You have deleted from the Gemfile")
|
||||||
|
@ -297,8 +297,12 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
expect(out).to eq("WIN")
|
expect(out).to eq("WIN")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "works if a gem is missing, but it's on a different platform, and the Gemfile has no global source", :bundler => "< 3" do
|
it "works if a gem is missing, but it's on a different platform" do
|
||||||
|
build_repo2
|
||||||
|
|
||||||
install_gemfile <<-G
|
install_gemfile <<-G
|
||||||
|
source "#{file_uri_for(gem_repo2)}"
|
||||||
|
|
||||||
source "#{file_uri_for(gem_repo1)}" do
|
source "#{file_uri_for(gem_repo1)}" do
|
||||||
gem "rake", platform: :#{not_local_tag}
|
gem "rake", platform: :#{not_local_tag}
|
||||||
end
|
end
|
||||||
|
@ -308,6 +312,40 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
expect(last_command).to be_success
|
expect(last_command).to be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "shows a good error if a gem is missing from the lockfile" do
|
||||||
|
build_repo4 do
|
||||||
|
build_gem "foo"
|
||||||
|
build_gem "bar"
|
||||||
|
end
|
||||||
|
|
||||||
|
gemfile <<-G
|
||||||
|
source "https://gem.repo4"
|
||||||
|
|
||||||
|
gem "foo"
|
||||||
|
gem "bar"
|
||||||
|
G
|
||||||
|
|
||||||
|
lockfile <<~L
|
||||||
|
GEM
|
||||||
|
remote: https://gem.repo4/
|
||||||
|
specs:
|
||||||
|
foo (1.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
#{lockfile_platforms}
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
foo
|
||||||
|
bar
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
|
||||||
|
bundle :install, :env => { "BUNDLE_FROZEN" => "true" }, :raise_on_error => false, :artifice => "compact_index"
|
||||||
|
expect(err).to include("Your lock file is missing \"bar\", but the lockfile can't be updated because frozen mode is set")
|
||||||
|
end
|
||||||
|
|
||||||
it "explodes if a path gem is missing" do
|
it "explodes if a path gem is missing" do
|
||||||
build_lib "path_gem"
|
build_lib "path_gem"
|
||||||
install_gemfile <<-G
|
install_gemfile <<-G
|
||||||
|
@ -333,7 +371,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
|
|
||||||
ENV["BUNDLE_FROZEN"] = "1"
|
ENV["BUNDLE_FROZEN"] = "1"
|
||||||
bundle "install", :raise_on_error => false
|
bundle "install", :raise_on_error => false
|
||||||
expect(err).to include("deployment mode")
|
expect(err).to include("frozen mode")
|
||||||
expect(err).to include("You have added to the Gemfile")
|
expect(err).to include("You have added to the Gemfile")
|
||||||
expect(err).to include("* rack-obama")
|
expect(err).to include("* rack-obama")
|
||||||
expect(err).not_to include("You have deleted from the Gemfile")
|
expect(err).not_to include("You have deleted from the Gemfile")
|
||||||
|
@ -349,7 +387,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
|
|
||||||
ENV["BUNDLE_DEPLOYMENT"] = "true"
|
ENV["BUNDLE_DEPLOYMENT"] = "true"
|
||||||
bundle "install", :raise_on_error => false
|
bundle "install", :raise_on_error => false
|
||||||
expect(err).to include("deployment mode")
|
expect(err).to include("frozen mode")
|
||||||
expect(err).to include("You have added to the Gemfile")
|
expect(err).to include("You have added to the Gemfile")
|
||||||
expect(err).to include("* rack-obama")
|
expect(err).to include("* rack-obama")
|
||||||
expect(err).not_to include("You have deleted from the Gemfile")
|
expect(err).not_to include("You have deleted from the Gemfile")
|
||||||
|
@ -379,7 +417,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
ENV["BUNDLE_FROZEN"] = "false"
|
ENV["BUNDLE_FROZEN"] = "false"
|
||||||
ENV["BUNDLE_DEPLOYMENT"] = "false"
|
ENV["BUNDLE_DEPLOYMENT"] = "false"
|
||||||
bundle "install"
|
bundle "install"
|
||||||
expect(out).not_to include("deployment mode")
|
expect(out).not_to include("frozen mode")
|
||||||
expect(out).not_to include("You have added to the Gemfile")
|
expect(out).not_to include("You have added to the Gemfile")
|
||||||
expect(out).not_to include("* rack-obama")
|
expect(out).not_to include("* rack-obama")
|
||||||
end
|
end
|
||||||
|
@ -392,7 +430,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
|
|
||||||
bundle "config set --local deployment true"
|
bundle "config set --local deployment true"
|
||||||
bundle :install, :raise_on_error => false
|
bundle :install, :raise_on_error => false
|
||||||
expect(err).to include("deployment mode")
|
expect(err).to include("frozen mode")
|
||||||
expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n")
|
expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n")
|
||||||
expect(err).to include("You have deleted from the Gemfile:\n* rack")
|
expect(err).to include("You have deleted from the Gemfile:\n* rack")
|
||||||
expect(err).not_to include("You have changed in the Gemfile")
|
expect(err).not_to include("You have changed in the Gemfile")
|
||||||
|
@ -406,7 +444,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
|
|
||||||
bundle "config set --local deployment true"
|
bundle "config set --local deployment true"
|
||||||
bundle :install, :raise_on_error => false
|
bundle :install, :raise_on_error => false
|
||||||
expect(err).to include("deployment mode")
|
expect(err).to include("frozen mode")
|
||||||
expect(err).not_to include("You have added to the Gemfile")
|
expect(err).not_to include("You have added to the Gemfile")
|
||||||
expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `git://hubz.com`")
|
expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `git://hubz.com`")
|
||||||
end
|
end
|
||||||
|
@ -426,7 +464,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
|
|
||||||
bundle "config set --local deployment true"
|
bundle "config set --local deployment true"
|
||||||
bundle :install, :raise_on_error => false
|
bundle :install, :raise_on_error => false
|
||||||
expect(err).to include("deployment mode")
|
expect(err).to include("frozen mode")
|
||||||
expect(err).not_to include("You have deleted from the Gemfile")
|
expect(err).not_to include("You have deleted from the Gemfile")
|
||||||
expect(err).not_to include("You have added to the Gemfile")
|
expect(err).not_to include("You have added to the Gemfile")
|
||||||
expect(err).to include("You have changed in the Gemfile:\n* rack from `#{lib_path("rack-1.0")}` to `no specified source`")
|
expect(err).to include("You have changed in the Gemfile:\n* rack from `#{lib_path("rack-1.0")}` to `no specified source`")
|
||||||
|
@ -450,7 +488,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
|
|
||||||
bundle "config set --local deployment true"
|
bundle "config set --local deployment true"
|
||||||
bundle :install, :raise_on_error => false
|
bundle :install, :raise_on_error => false
|
||||||
expect(err).to include("deployment mode")
|
expect(err).to include("frozen mode")
|
||||||
expect(err).to include("You have changed in the Gemfile:\n* rack from `#{lib_path("rack")}` to `no specified source`")
|
expect(err).to include("You have changed in the Gemfile:\n* rack from `#{lib_path("rack")}` to `no specified source`")
|
||||||
expect(err).not_to include("You have added to the Gemfile")
|
expect(err).not_to include("You have added to the Gemfile")
|
||||||
expect(err).not_to include("You have deleted from the Gemfile")
|
expect(err).not_to include("You have deleted from the Gemfile")
|
||||||
|
@ -469,7 +507,7 @@ RSpec.describe "install in deployment or frozen mode" do
|
||||||
|
|
||||||
run "require 'rack'", :raise_on_error => false
|
run "require 'rack'", :raise_on_error => false
|
||||||
expect(err).to include strip_whitespace(<<-E).strip
|
expect(err).to include strip_whitespace(<<-E).strip
|
||||||
The dependencies in your gemfile changed
|
The dependencies in your gemfile changed, but the lockfile can't be updated because frozen mode is set (Bundler::ProductionError)
|
||||||
|
|
||||||
You have added to the Gemfile:
|
You have added to the Gemfile:
|
||||||
* rack (= 1.0.0)
|
* rack (= 1.0.0)
|
||||||
|
@ -502,7 +540,7 @@ You have deleted from the Gemfile:
|
||||||
simulate_new_machine
|
simulate_new_machine
|
||||||
bundle "config set --local deployment true"
|
bundle "config set --local deployment true"
|
||||||
bundle "install --verbose"
|
bundle "install --verbose"
|
||||||
expect(out).not_to include("You are trying to install in deployment mode after changing your Gemfile")
|
expect(out).not_to include("but the lockfile can't be updated because frozen mode is set")
|
||||||
expect(out).not_to include("You have added to the Gemfile")
|
expect(out).not_to include("You have added to the Gemfile")
|
||||||
expect(out).not_to include("You have deleted from the Gemfile")
|
expect(out).not_to include("You have deleted from the Gemfile")
|
||||||
expect(out).to include("vendor/cache/foo")
|
expect(out).to include("vendor/cache/foo")
|
||||||
|
|
|
@ -150,7 +150,7 @@ RSpec.describe "bundle install from an existing gemspec" do
|
||||||
output = bundle("install", :dir => tmp.join("foo"))
|
output = bundle("install", :dir => tmp.join("foo"))
|
||||||
expect(output).not_to match(/You have added to the Gemfile/)
|
expect(output).not_to match(/You have added to the Gemfile/)
|
||||||
expect(output).not_to match(/You have deleted from the Gemfile/)
|
expect(output).not_to match(/You have deleted from the Gemfile/)
|
||||||
expect(output).not_to match(/install in deployment mode after changing/)
|
expect(output).not_to match(/the lockfile can't be updated because frozen mode is set/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should match a lockfile without needing to re-resolve" do
|
it "should match a lockfile without needing to re-resolve" do
|
||||||
|
|
|
@ -115,8 +115,6 @@ RSpec.describe "bundle install with specific platforms" do
|
||||||
s.platform = "arm64-darwin"
|
s.platform = "arm64-darwin"
|
||||||
s.required_ruby_version = "< #{Gem.ruby_version}"
|
s.required_ruby_version = "< #{Gem.ruby_version}"
|
||||||
end
|
end
|
||||||
|
|
||||||
build_gem "bundler", "2.1.4"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
gemfile <<~G
|
gemfile <<~G
|
||||||
|
@ -137,22 +135,21 @@ RSpec.describe "bundle install with specific platforms" do
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
nokogiri
|
nokogiri
|
||||||
|
|
||||||
RUBY VERSION
|
|
||||||
2.5.3p105
|
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.1.4
|
#{Bundler::VERSION}
|
||||||
L
|
L
|
||||||
|
|
||||||
simulate_platform "arm64-darwin-22", &example
|
simulate_platform "arm64-darwin-22", &example
|
||||||
end
|
end
|
||||||
|
|
||||||
it "still installs the generic RUBY variant if necessary" do
|
it "still installs the generic RUBY variant if necessary" do
|
||||||
bundle "update --bundler", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
|
bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
|
||||||
|
expect(out).to include("Installing nokogiri 1.3.10")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "still installs the generic RUBY variant if necessary, even in frozen mode" do
|
it "still installs the generic RUBY variant if necessary, even in frozen mode" do
|
||||||
bundle "update --bundler", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s, "BUNDLE_FROZEN" => "true" }
|
bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s, "BUNDLE_FROZEN" => "true" }
|
||||||
|
expect(out).to include("Installing nokogiri 1.3.10")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1371,7 +1371,7 @@ RSpec.describe "the lockfile format" do
|
||||||
L
|
L
|
||||||
|
|
||||||
bundle "install --verbose"
|
bundle "install --verbose"
|
||||||
expect(out).to include("re-resolving dependencies because your lock file is missing some gems")
|
expect(out).to include("re-resolving dependencies because your lock file is missing \"minitest-bisect\"")
|
||||||
|
|
||||||
expect(lockfile).to eq <<~L
|
expect(lockfile).to eq <<~L
|
||||||
GEM
|
GEM
|
||||||
|
|
|
@ -208,10 +208,8 @@ module Spec
|
||||||
update_repo(gem_repo4, &blk)
|
update_repo(gem_repo4, &blk)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_repo2
|
def update_repo2(&blk)
|
||||||
update_repo gem_repo2 do
|
update_repo(gem_repo2, &blk)
|
||||||
yield if block_given?
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_security_repo
|
def build_security_repo
|
||||||
|
|
|
@ -213,8 +213,9 @@ class Gem::MockBrowser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.post(uri)
|
def self.post(uri, content_type: "application/x-www-form-urlencoded")
|
||||||
post = Net::HTTP::Post.new(uri)
|
headers = { "content-type" => content_type } if content_type
|
||||||
|
post = Net::HTTP::Post.new(uri, headers)
|
||||||
Net::HTTP.start(uri.hostname, uri.port) do |http|
|
Net::HTTP.start(uri.hostname, uri.port) do |http|
|
||||||
http.request(post)
|
http.request(post)
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,4 +54,4 @@ DEPENDENCIES
|
||||||
webrick (~> 1.6)
|
webrick (~> 1.6)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.14
|
2.4.15
|
||||||
|
|
|
@ -70,4 +70,4 @@ DEPENDENCIES
|
||||||
test-unit
|
test-unit
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.14
|
2.4.15
|
||||||
|
|
|
@ -78,4 +78,4 @@ DEPENDENCIES
|
||||||
test-unit
|
test-unit
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.14
|
2.4.15
|
||||||
|
|
|
@ -42,4 +42,4 @@ DEPENDENCIES
|
||||||
webrick (= 1.7.0)
|
webrick (= 1.7.0)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.14
|
2.4.15
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue