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

Merge master branch from rubygems/rubygems upstream.

* Enable Style/MethodDefParentheses in Rubocop
    https://github.com/rubygems/rubygems/pull/2478
  * Enable Style/MultilineIfThen in Rubocop
    https://github.com/rubygems/rubygems/pull/2479
  * Fix required_ruby_version with prereleases and improve error message
    https://github.com/rubygems/rubygems/pull/2344
  * Fix bundler rubygems binstub not properly looking for bundler
    https://github.com/rubygems/rubygems/pull/2426

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2018-11-21 10:20:47 +00:00
parent 2f023c5dba
commit 5335ce0e06
247 changed files with 1290 additions and 1363 deletions

View file

@ -98,7 +98,7 @@ class Gem::Commands::CertCommand < Gem::Command
end
end
def add_certificate certificate # :nodoc:
def add_certificate(certificate) # :nodoc:
Gem::Security.trust_dir.trust_cert certificate
say "Added '#{certificate.subject}'"
@ -132,7 +132,7 @@ class Gem::Commands::CertCommand < Gem::Command
sign_certificates unless options[:sign].empty?
end
def build email
def build(email)
if !valid_email?(email)
raise Gem::CommandLineError, "Invalid email address #{email}"
end
@ -148,7 +148,7 @@ class Gem::Commands::CertCommand < Gem::Command
end
end
def build_cert email, key # :nodoc:
def build_cert(email, key) # :nodoc:
expiration_length_days = options[:expiration_length_days] ||
Gem.configuration.cert_expiration_length_days
@ -179,7 +179,7 @@ class Gem::Commands::CertCommand < Gem::Command
return key, key_path
end
def certificates_matching filter
def certificates_matching(filter)
return enum_for __method__, filter unless block_given?
Gem::Security.trusted_certificates.select do |certificate, _|
@ -231,7 +231,7 @@ For further reading on signing gems see `ri Gem::Security`.
EOF
end
def list_certificates_matching filter # :nodoc:
def list_certificates_matching(filter) # :nodoc:
certificates_matching filter do |certificate, _|
# this could probably be formatted more gracefully
say certificate.subject.to_s
@ -276,14 +276,14 @@ For further reading on signing gems see `ri Gem::Security`.
load_default_key unless options[:key]
end
def remove_certificates_matching filter # :nodoc:
def remove_certificates_matching(filter) # :nodoc:
certificates_matching filter do |certificate, path|
FileUtils.rm path
say "Removed '#{certificate.subject}'"
end
end
def sign cert_file
def sign(cert_file)
cert = File.read cert_file
cert = OpenSSL::X509::Certificate.new cert
@ -314,11 +314,10 @@ For further reading on signing gems see `ri Gem::Security`.
private
def valid_email? email
def valid_email?(email)
# It's simple, but is all we need
email =~ /\A.+@.+\z/
end
end if defined?(OpenSSL::SSL)