parent
8a1be433e8
commit
71794a75db
Notes:
git
2022-08-03 13:14:33 +09:00
@ -9,7 +9,7 @@ module Bundler
|
||||
|
||||
def run
|
||||
platforms, ruby_version = Bundler.ui.silence do
|
||||
locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version
|
||||
locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version.gsub(/p\d+\Z/, "")
|
||||
gemfile_ruby_version = Bundler.definition.ruby_version && Bundler.definition.ruby_version.single_version_string
|
||||
[Bundler.definition.platforms.map {|p| "* #{p}" },
|
||||
locked_ruby_version || gemfile_ruby_version]
|
||||
|
@ -23,7 +23,7 @@ module Bundler
|
||||
Bundler.ui.warn "Make sure you have the graphviz ruby gem. You can install it with:"
|
||||
Bundler.ui.warn "`gem install ruby-graphviz`"
|
||||
rescue StandardError => e
|
||||
raise unless e.message =~ /GraphViz not installed or dot not in PATH/
|
||||
raise unless e.message.to_s.include?("GraphViz not installed or dot not in PATH")
|
||||
Bundler.ui.error e.message
|
||||
Bundler.ui.warn "Please install GraphViz. On a Mac with Homebrew, you can run `brew install graphviz`."
|
||||
end
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
module Bundler
|
||||
WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/
|
||||
FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/
|
||||
FREEBSD = RbConfig::CONFIG["host_os"].to_s.include?("bsd")
|
||||
NULL = WINDOWS ? "NUL" : "/dev/null"
|
||||
end
|
||||
|
@ -68,7 +68,7 @@ module Bundler
|
||||
raise CertificateFailureError.new(uri)
|
||||
rescue *HTTP_ERRORS => e
|
||||
Bundler.ui.trace e
|
||||
if e.is_a?(SocketError) || e.message =~ /host down:/
|
||||
if e.is_a?(SocketError) || e.message.to_s.include?("host down:")
|
||||
raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
|
||||
"connection and try again."
|
||||
else
|
||||
|
@ -13,7 +13,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("<%= relative_gemfile_path %>", __dir
|
||||
bundle_binstub = File.expand_path("bundle", __dir__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
||||
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
|
@ -62,8 +62,9 @@ m = Module.new do
|
||||
|
||||
def bundler_requirement
|
||||
@bundler_requirement ||=
|
||||
env_var_version || cli_arg_version ||
|
||||
bundler_requirement_for(lockfile_version)
|
||||
env_var_version ||
|
||||
cli_arg_version ||
|
||||
bundler_requirement_for(lockfile_version)
|
||||
end
|
||||
|
||||
def bundler_requirement_for(version)
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
|
@ -1010,7 +1010,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
||||
# Is this platform Solaris?
|
||||
|
||||
def self.solaris_platform?
|
||||
RUBY_PLATFORM =~ /solaris/
|
||||
RUBY_PLATFORM.include?("solaris")
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -86,8 +86,9 @@ Use --overwrite to force rebuilding of documentation.
|
||||
begin
|
||||
doc.generate
|
||||
rescue Errno::ENOENT => e
|
||||
e.message =~ / - /
|
||||
alert_error "Unable to document #{spec.full_name}, #{$'} is missing, skipping"
|
||||
match = / - /.match(e.message)
|
||||
alert_error "Unable to document #{spec.full_name}, " \
|
||||
" #{match.post_match} is missing, skipping"
|
||||
terminate_interaction 1 if specs.length == 1
|
||||
end
|
||||
end
|
||||
|
@ -171,7 +171,7 @@ module Gem
|
||||
def self.default_exec_format
|
||||
exec_format = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "%s") rescue "%s"
|
||||
|
||||
unless exec_format =~ /%s/
|
||||
unless exec_format.include?("%s")
|
||||
raise Gem::Exception,
|
||||
"[BUG] invalid exec_format #{exec_format.inspect}, no %s"
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ class Gem::Ext::Builder
|
||||
RbConfig::CONFIG["configure_args"] =~ /with-make-prog\=(\w+)/
|
||||
make_program_name = ENV["MAKE"] || ENV["make"] || $1
|
||||
unless make_program_name
|
||||
make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? "nmake" : "make"
|
||||
make_program_name = (RUBY_PLATFORM.include?("mswin")) ? "nmake" : "make"
|
||||
end
|
||||
make_program = Shellwords.split(make_program_name)
|
||||
|
||||
|
@ -234,8 +234,8 @@ class Gem::Installer
|
||||
io.gets # blankline
|
||||
|
||||
# TODO detect a specially formatted comment instead of trying
|
||||
# to run a regexp against Ruby code.
|
||||
next unless io.gets =~ /This file was generated by RubyGems/
|
||||
# to find a string inside Ruby code.
|
||||
next unless io.gets.to_s.include?("This file was generated by RubyGems")
|
||||
|
||||
ruby_executable = true
|
||||
existing = io.read.slice(%r{
|
||||
|
@ -26,7 +26,7 @@ class Gem::Validator
|
||||
Find.find gem_directory do |file_name|
|
||||
fn = file_name[gem_directory.size..file_name.size - 1].sub(/^\//, "")
|
||||
installed_files << fn unless
|
||||
fn =~ /CVS/ || fn.empty? || File.directory?(file_name)
|
||||
fn.empty? || fn.include?("CVS") || File.directory?(file_name)
|
||||
end
|
||||
|
||||
installed_files
|
||||
|
@ -231,7 +231,7 @@ G
|
||||
L
|
||||
|
||||
bundle "platform --ruby"
|
||||
expect(out).to eq("ruby 1.0.0p127")
|
||||
expect(out).to eq("ruby 1.0.0")
|
||||
end
|
||||
|
||||
it "handles when there is a requirement in the gemfile" do
|
@ -22,7 +22,7 @@ RSpec.describe "The library itself" do
|
||||
def check_for_tab_characters(filename)
|
||||
failing_lines = []
|
||||
each_line(filename) do |line, number|
|
||||
failing_lines << number + 1 if line =~ /\t/
|
||||
failing_lines << number + 1 if line.include?("\t")
|
||||
end
|
||||
|
||||
return if failing_lines.empty?
|
||||
|
@ -218,7 +218,7 @@ RSpec.describe "real world edgecases", :realworld => true do
|
||||
end
|
||||
|
||||
it "doesn't hang on big gemfile" do
|
||||
skip "Only for ruby 2.7.3" if RUBY_VERSION != "2.7.3" || RUBY_PLATFORM =~ /darwin/
|
||||
skip "Only for ruby 2.7.3" if RUBY_VERSION != "2.7.3" || RUBY_PLATFORM.include?("darwin")
|
||||
|
||||
gemfile <<~G
|
||||
# frozen_string_literal: true
|
||||
@ -330,7 +330,7 @@ RSpec.describe "real world edgecases", :realworld => true do
|
||||
end
|
||||
|
||||
it "doesn't hang on tricky gemfile" do
|
||||
skip "Only for ruby 2.7.3" if RUBY_VERSION != "2.7.3" || RUBY_PLATFORM =~ /darwin/
|
||||
skip "Only for ruby 2.7.3" if RUBY_VERSION != "2.7.3" || RUBY_PLATFORM.include?("darwin")
|
||||
|
||||
gemfile <<~G
|
||||
source 'https://rubygems.org'
|
||||
@ -356,7 +356,7 @@ RSpec.describe "real world edgecases", :realworld => true do
|
||||
end
|
||||
|
||||
it "doesn't hang on nix gemfile" do
|
||||
skip "Only for ruby 3.0.1" if RUBY_VERSION != "3.0.1" || RUBY_PLATFORM =~ /darwin/
|
||||
skip "Only for ruby 3.0.1" if RUBY_VERSION != "3.0.1" || RUBY_PLATFORM.include?("darwin")
|
||||
|
||||
gemfile <<~G
|
||||
source "https://rubygems.org" do
|
||||
|
@ -370,7 +370,7 @@ RSpec.describe "Bundler.setup" do
|
||||
|
||||
context "when the ruby stdlib is a substring of Gem.path" do
|
||||
it "does not reject the stdlib from $LOAD_PATH" do
|
||||
substring = "/" + $LOAD_PATH.find {|p| p =~ /vendor_ruby/ }.split("/")[2]
|
||||
substring = "/" + $LOAD_PATH.find {|p| p.include?("vendor_ruby") }.split("/")[2]
|
||||
run "puts 'worked!'", :env => { "GEM_PATH" => substring }
|
||||
expect(out).to eq("worked!")
|
||||
end
|
||||
@ -865,7 +865,7 @@ end
|
||||
|
||||
gemspec_content = File.binread(gemspec).
|
||||
sub("Bundler::VERSION", %("#{Bundler::VERSION}")).
|
||||
lines.reject {|line| line =~ %r{lib/bundler/version} }.join
|
||||
lines.reject {|line| line.include?("lib/bundler/version") }.join
|
||||
|
||||
File.open(File.join(specifications_dir, "#{full_name}.gemspec"), "wb") do |f|
|
||||
f.write(gemspec_content)
|
||||
|
@ -270,7 +270,7 @@ class Gem::TestCase < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def assert_contains_make_command(target, output, msg = nil)
|
||||
if output.match(/\n/)
|
||||
if output.include?("\n")
|
||||
msg = build_message(msg,
|
||||
"Expected output containing make command \"%s\", but was \n\nBEGIN_OF_OUTPUT\n%sEND_OF_OUTPUT" % [
|
||||
("%s %s" % [make_command, target]).rstrip,
|
||||
|
@ -36,7 +36,7 @@ class TestBundledCA < Gem::TestCase
|
||||
pend "#{host} seems offline, I can't tell whether ssl would work."
|
||||
rescue OpenSSL::SSL::SSLError => e
|
||||
# Only fail for certificate verification errors
|
||||
if e.message =~ /certificate verify failed/
|
||||
if e.message.include?("certificate verify failed")
|
||||
flunk "#{host} is not verifiable using the included certificates. Error was: #{e.message}"
|
||||
end
|
||||
raise
|
||||
|
@ -78,7 +78,7 @@ class TestGemBundlerVersionFinder < Gem::TestCase
|
||||
|
||||
def test_deleted_directory
|
||||
pend "Cannot perform this test on windows" if win_platform?
|
||||
pend "Cannot perform this test on Solaris" if /solaris/ =~ RUBY_PLATFORM
|
||||
pend "Cannot perform this test on Solaris" if RUBY_PLATFORM.include?("solaris")
|
||||
require "tmpdir"
|
||||
|
||||
orig_dir = Dir.pwd
|
||||
|
@ -106,7 +106,7 @@ install:
|
||||
end
|
||||
|
||||
def test_build_extensions
|
||||
pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
pend if RUBY_PLATFORM.include?("mswin") && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
@spec.extensions << "ext/extconf.rb"
|
||||
|
||||
ext_dir = File.join @spec.gem_dir, "ext"
|
||||
@ -142,7 +142,7 @@ install:
|
||||
end
|
||||
|
||||
def test_build_extensions_with_gemhome_with_space
|
||||
pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
pend if RUBY_PLATFORM.include?("mswin") && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
new_gemhome = File.join @tempdir, "gem home"
|
||||
File.rename(@gemhome, new_gemhome)
|
||||
@gemhome = new_gemhome
|
||||
@ -163,7 +163,7 @@ install:
|
||||
false
|
||||
end
|
||||
end
|
||||
pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
pend if RUBY_PLATFORM.include?("mswin") && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
|
||||
@spec.extensions << "ext/extconf.rb"
|
||||
|
||||
|
@ -164,7 +164,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
||||
def skip_unsupported_platforms!
|
||||
pend "jruby not supported" if java_platform?
|
||||
pend "truffleruby not supported (yet)" if RUBY_ENGINE == "truffleruby"
|
||||
pend "mswin not supported (yet)" if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS")
|
||||
pend "mswin not supported (yet)" if RUBY_PLATFORM.include?("mswin") && ENV.key?("GITHUB_ACTIONS")
|
||||
system(@rust_envs, "cargo", "-V", out: IO::NULL, err: [:child, :out])
|
||||
pend "cargo not present" unless $?.success?
|
||||
pend "ruby.h is not provided by ruby repo" if ruby_repo?
|
||||
|
@ -1490,7 +1490,7 @@ gem 'other', version
|
||||
|
||||
def test_install_extension_and_script
|
||||
pend "Makefile creation crashes on jruby" if Gem.java_platform?
|
||||
pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
pend if RUBY_PLATFORM.include?("mswin") && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
|
||||
@spec = setup_base_spec
|
||||
@spec.extensions << "extconf.rb"
|
||||
|
@ -83,7 +83,7 @@ class TestGemRequirement < Gem::TestCase
|
||||
Gem::Requirement.parse(Gem::Version.new("2"))
|
||||
end
|
||||
|
||||
if RUBY_VERSION >= "2.5" && !(Gem.java_platform? && ENV["JRUBY_OPTS"] =~ /--debug/)
|
||||
if RUBY_VERSION >= "2.5" && !(Gem.java_platform? && ENV["JRUBY_OPTS"].to_s.include?("--debug"))
|
||||
def test_parse_deduplication
|
||||
assert_same "~>", Gem::Requirement.parse("~> 1").first
|
||||
end
|
||||
|
@ -63,7 +63,7 @@ class TestGemResolverGitSpecification < Gem::TestCase
|
||||
|
||||
def test_install_extension
|
||||
pend if Gem.java_platform?
|
||||
pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
pend if RUBY_PLATFORM.include?("mswin") && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
|
||||
name, _, repository, = git_gem "a", 1 do |s|
|
||||
s.extensions << "ext/extconf.rb"
|
||||
end
|
||||
|
@ -70,7 +70,7 @@ class TestGemSecurityTrustDir < Gem::TestCase
|
||||
assert_path_exist @dest_dir
|
||||
|
||||
mask = 040700 & (~File.umask)
|
||||
mask |= 0200000 if /aix/ =~ RUBY_PLATFORM
|
||||
mask |= 0200000 if RUBY_PLATFORM.include?("aix")
|
||||
|
||||
assert_equal mask, File.stat(@dest_dir).mode unless win_platform?
|
||||
end
|
||||
@ -91,7 +91,7 @@ class TestGemSecurityTrustDir < Gem::TestCase
|
||||
@trust_dir.verify
|
||||
|
||||
mask = 040700 & (~File.umask)
|
||||
mask |= 0200000 if /aix/ =~ RUBY_PLATFORM
|
||||
mask |= 0200000 if RUBY_PLATFORM.include?("aix")
|
||||
|
||||
assert_equal mask, File.stat(@dest_dir).mode unless win_platform?
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ class TestKernel < Gem::TestCase
|
||||
|
||||
def test_gem
|
||||
assert gem("a", "= 1"), "Should load"
|
||||
assert $:.any? {|p| %r{a-1/lib} =~ p }
|
||||
assert $:.any? {|p| p.include?("a-1/lib") }
|
||||
end
|
||||
|
||||
def test_gem_default
|
||||
@ -50,13 +50,13 @@ class TestKernel < Gem::TestCase
|
||||
def test_gem_redundant
|
||||
assert gem("a", "= 1"), "Should load"
|
||||
refute gem("a", "= 1"), "Should not load"
|
||||
assert_equal 1, $:.select {|p| %r{a-1/lib} =~ p }.size
|
||||
assert_equal 1, $:.select {|p| p.include?("a-1/lib") }.size
|
||||
end
|
||||
|
||||
def test_gem_overlapping
|
||||
assert gem("a", "= 1"), "Should load"
|
||||
refute gem("a", ">= 1"), "Should not load"
|
||||
assert_equal 1, $:.select {|p| %r{a-1/lib} =~ p }.size
|
||||
assert_equal 1, $:.select {|p| p.include?("a-1/lib") }.size
|
||||
end
|
||||
|
||||
def test_gem_prerelease
|
||||
@ -83,13 +83,13 @@ class TestKernel < Gem::TestCase
|
||||
assert_match(/activated a-1/, ex.message)
|
||||
assert_equal "a", ex.name
|
||||
|
||||
assert $:.any? {|p| %r{a-1/lib} =~ p }
|
||||
refute $:.any? {|p| %r{a-2/lib} =~ p }
|
||||
assert $:.any? {|p| p.include?("a-1/lib") }
|
||||
refute $:.any? {|p| p.include?("a-2/lib") }
|
||||
end
|
||||
|
||||
def test_gem_not_adding_bin
|
||||
assert gem("a", "= 1"), "Should load"
|
||||
refute $:.any? {|p| %r{a-1/bin} =~ p }
|
||||
refute $:.any? {|p| p.include?("a-1/bin") }
|
||||
end
|
||||
|
||||
def test_gem_failing_inside_require_doesnt_cause_double_exceptions
|
||||
@ -114,7 +114,7 @@ class TestKernel < Gem::TestCase
|
||||
quick_gem "bundler", "2.a"
|
||||
|
||||
assert gem("bundler")
|
||||
assert $:.any? {|p| %r{bundler-1/lib} =~ p }
|
||||
assert $:.any? {|p| p.include?("bundler-1/lib") }
|
||||
end
|
||||
|
||||
def test_gem_bundler_inferred_bundler_version
|
||||
@ -123,7 +123,7 @@ class TestKernel < Gem::TestCase
|
||||
quick_gem "bundler", "2.a"
|
||||
|
||||
assert gem("bundler", ">= 0.a")
|
||||
assert $:.any? {|p| %r{bundler-1/lib} =~ p }
|
||||
assert $:.any? {|p| p.include?("bundler-1/lib") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user