1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Lazily load shellwords

https://github.com/rubygems/rubygems/commit/ef6388656a
This commit is contained in:
David Rodríguez 2021-07-25 16:10:55 +02:00 committed by Hiroshi SHIBATA
parent 350f4a0b66
commit 095b5bbcc1
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
4 changed files with 8 additions and 7 deletions

View file

@ -1,7 +1,5 @@
# frozen_string_literal: true
require "shellwords"
module Bundler
class CLI::Open
attr_reader :options, :name
@ -19,6 +17,7 @@ module Bundler
else
path = spec.full_gem_path
Dir.chdir(path) do
require "shellwords"
command = Shellwords.split(editor) + [path]
Bundler.with_original_env do
system(*command)

View file

@ -1,7 +1,5 @@
# frozen_string_literal: true
require "shellwords"
module Bundler
class GemInstaller
attr_reader :spec, :standalone, :worker, :force, :installer
@ -47,6 +45,7 @@ module Bundler
def spec_settings
# Fetch the build settings, if there are any
if settings = Bundler.settings["build.#{spec.name}"]
require "shellwords"
Shellwords.shellsplit(settings)
end
end

View file

@ -61,7 +61,10 @@ module Bundler
def build_extensions
extension_cache_path = options[:bundler_extension_cache_path]
return super unless extension_cache_path && extension_dir = spec.extension_dir
unless extension_cache_path && extension_dir = spec.extension_dir
require "shellwords" # compensate missing require in rubygems before version 3.2.25
return super
end
extension_dir = Pathname.new(extension_dir)
build_complete = SharedHelpers.filesystem_access(extension_cache_path.join("gem.build_complete"), :read, &:file?)
@ -71,6 +74,7 @@ module Bundler
FileUtils.cp_r extension_cache_path, spec.extension_dir
end
else
require "shellwords" # compensate missing require in rubygems before version 3.2.25
super
if extension_dir.directory? # not made for gems without extensions
SharedHelpers.filesystem_access(extension_cache_path.parent, &:mkpath)

View file

@ -1,7 +1,5 @@
# frozen_string_literal: true
require "shellwords"
module Bundler
class Source
class Git
@ -224,6 +222,7 @@ module Bundler
end
def check_allowed(command)
require "shellwords"
command_with_no_credentials = URICredentialsFilter.credential_filtered_string("git #{command.shelljoin}", uri)
raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
command_with_no_credentials