mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge RubyGems-3.2.19 and Bundler-2.2.19
This commit is contained in:
parent
d4b4281959
commit
f63d3bbb6e
10 changed files with 75 additions and 11 deletions
|
@ -442,7 +442,20 @@ module Bundler
|
|||
valid_file = file.exist? && !file.size.zero?
|
||||
return {} unless valid_file
|
||||
require_relative "yaml_serializer"
|
||||
YAMLSerializer.load file.read
|
||||
YAMLSerializer.load(file.read).inject({}) do |config, (k, v)|
|
||||
new_k = k
|
||||
|
||||
if k.include?("-")
|
||||
Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
|
||||
"This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \
|
||||
"Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)."
|
||||
|
||||
new_k = k.gsub("-", "___")
|
||||
end
|
||||
|
||||
config[new_k] = v
|
||||
config
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -398,10 +398,6 @@ module Bundler
|
|||
next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
|
||||
s ||= Bundler.rubygems.spec_from_gem(gemfile)
|
||||
s.source = self
|
||||
if Bundler.rubygems.spec_missing_extensions?(s, false)
|
||||
Bundler.ui.debug "Source #{self} is ignoring #{s} because it is missing extensions"
|
||||
next
|
||||
end
|
||||
idx << s
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: false
|
||||
|
||||
module Bundler
|
||||
VERSION = "2.2.18".freeze
|
||||
VERSION = "2.2.19".freeze
|
||||
|
||||
def self.bundler_major_version
|
||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
require 'rbconfig'
|
||||
|
||||
module Gem
|
||||
VERSION = "3.2.18".freeze
|
||||
VERSION = "3.2.19".freeze
|
||||
end
|
||||
|
||||
# Must be first since it unloads the prelude from 1.9.2
|
||||
|
|
|
@ -355,6 +355,8 @@ class Gem::Command
|
|||
def add_option(*opts, &handler) # :yields: value, options
|
||||
group_name = Symbol === opts.first ? opts.shift : :options
|
||||
|
||||
raise "Do not pass an empty string in opts" if opts.include?("")
|
||||
|
||||
@option_groups[group_name] << [opts, handler]
|
||||
end
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class Gem::Commands::BuildCommand < Gem::Command
|
|||
options[:output] = value
|
||||
end
|
||||
|
||||
add_option '-C PATH', '', 'Run as if gem build was started in <PATH> instead of the current working directory.' do |value, options|
|
||||
add_option '-C PATH', 'Run as if gem build was started in <PATH> instead of the current working directory.' do |value, options|
|
||||
options[:build_path] = value
|
||||
end
|
||||
end
|
||||
|
|
|
@ -312,16 +312,26 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
|
|||
describe "BUNDLE_ keys format" do
|
||||
let(:settings) { described_class.new(bundled_app(".bundle")) }
|
||||
|
||||
it "converts older keys without double dashes" do
|
||||
it "converts older keys without double underscore" do
|
||||
config("BUNDLE_MY__PERSONAL.RACK" => "~/Work/git/rack")
|
||||
expect(settings["my.personal.rack"]).to eq("~/Work/git/rack")
|
||||
end
|
||||
|
||||
it "converts older keys without trailing slashes and double dashes" do
|
||||
it "converts older keys without trailing slashes and double underscore" do
|
||||
config("BUNDLE_MIRROR__HTTPS://RUBYGEMS.ORG" => "http://rubygems-mirror.org")
|
||||
expect(settings["mirror.https://rubygems.org/"]).to eq("http://rubygems-mirror.org")
|
||||
end
|
||||
|
||||
it "converts older keys with dashes" do
|
||||
config("BUNDLE_MY-PERSONAL-SERVER__ORG" => "my-personal-server.org")
|
||||
expect(Bundler.ui).to receive(:warn).with(
|
||||
"Your #{bundled_app(".bundle/config")} config includes `BUNDLE_MY-PERSONAL-SERVER__ORG`, which contains the dash character (`-`).\n" \
|
||||
"This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \
|
||||
"Please edit #{bundled_app(".bundle/config")} and replace any dashes in configuration keys with a triple underscore (`___`)."
|
||||
)
|
||||
expect(settings["my-personal-server.org"]).to eq("my-personal-server.org")
|
||||
end
|
||||
|
||||
it "reads newer keys format properly" do
|
||||
config("BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/" => "http://rubygems-mirror.org")
|
||||
expect(settings["mirror.https://rubygems.org/"]).to eq("http://rubygems-mirror.org")
|
||||
|
|
|
@ -302,6 +302,30 @@ RSpec.describe "bundle cache" do
|
|||
expect(out).to include("frozen").or include("deployment")
|
||||
end
|
||||
end
|
||||
|
||||
context "with gems with extensions" do
|
||||
before do
|
||||
build_repo2 do
|
||||
build_gem "racc", "2.0" do |s|
|
||||
s.add_dependency "rake"
|
||||
s.extensions << "Rakefile"
|
||||
s.write "Rakefile", "task(:default) { puts 'INSTALLING rack' }"
|
||||
end
|
||||
end
|
||||
|
||||
gemfile <<~G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
||||
gem "racc"
|
||||
G
|
||||
end
|
||||
|
||||
it "installs them properly from cache to a different path" do
|
||||
bundle "cache"
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle "install --local"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.describe "bundle install with gem sources" do
|
||||
|
@ -321,7 +345,7 @@ RSpec.describe "bundle install with gem sources" do
|
|||
expect(the_bundle).to include_gems "rack 1.0.0"
|
||||
end
|
||||
|
||||
it "does not hit the remote at all" do
|
||||
it "does not hit the remote at all in frozen mode" do
|
||||
build_repo2
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo2)}"
|
||||
|
|
|
@ -189,6 +189,18 @@ class TestGemCommand < Gem::TestCase
|
|||
assert_match %r{Usage: gem doit}, @ui.output
|
||||
end
|
||||
|
||||
def test_add_option
|
||||
assert_nothing_raised RuntimeError do
|
||||
@cmd.add_option('--force', 'skip validation of the spec') {|v,o| }
|
||||
end
|
||||
end
|
||||
|
||||
def test_add_option_with_empty
|
||||
assert_raise RuntimeError, "Do not pass an empty string in opts" do
|
||||
@cmd.add_option('', 'skip validation of the spec') {|v,o| }
|
||||
end
|
||||
end
|
||||
|
||||
def test_option_recognition
|
||||
@cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
|
||||
options[:help] = true
|
||||
|
|
|
@ -35,6 +35,13 @@ class TestGemCommandsHelpCommand < Gem::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_gem_help_build
|
||||
util_gem 'build' do |out, err|
|
||||
assert_match(/-C PATH *Run as if gem build was started in <PATH>/, out)
|
||||
assert_equal '', err
|
||||
end
|
||||
end
|
||||
|
||||
def test_gem_help_commands
|
||||
mgr = Gem::CommandManager.new
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue