summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-22 06:28:04 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-22 06:28:04 +0000
commit3dc6efbe9ca582d6930f25754a16043dedecfa6f (patch)
tree35980c7383e9e12d092e0eff78f5f16eca2fa1fc /lib
parent59a6215af65b3bfade13836681cbacc3294e6e78 (diff)
Merge rubygems master targeted RubyGems 3.1.0.
https://github.com/rubygems/rubygems/commit/1172320540c8c33c59fc1db5191b021c3b2db487 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/commands/build_command.rb41
-rw-r--r--lib/rubygems/commands/push_command.rb2
-rw-r--r--lib/rubygems/gemcutter_utilities.rb4
-rw-r--r--lib/rubygems/rdoc.rb4
-rw-r--r--lib/rubygems/request.rb1
-rw-r--r--lib/rubygems/resolver.rb2
-rw-r--r--lib/rubygems/specification.rb3
-rw-r--r--lib/rubygems/test_case.rb2
-rw-r--r--lib/rubygems/validator.rb27
10 files changed, 44 insertions, 44 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index e114c5abd4..d31c216142 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -9,7 +9,7 @@
require 'rbconfig'
module Gem
- VERSION = "3.0.2".freeze
+ VERSION = "3.1.0.pre1".freeze
end
# Must be first since it unloads the prelude from 1.9.2
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index e59471e976..761b80ee94 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -18,6 +18,10 @@ class Gem::Commands::BuildCommand < Gem::Command
add_option '-o', '--output FILE', 'output gem with the given filename' do |value, options|
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|
+ options[:build_path] = value
+ end
end
def arguments # :nodoc:
@@ -60,25 +64,36 @@ Gems can be saved to a specified filename with the output option:
end
if File.exist? gemspec
- Dir.chdir(File.dirname(gemspec)) do
- spec = Gem::Specification.load File.basename(gemspec)
-
- if spec
- Gem::Package.build(
- spec,
- options[:force],
- options[:strict],
- options[:output]
- )
- else
- alert_error "Error loading gemspec. Aborting."
- terminate_interaction 1
+ spec = Gem::Specification.load(gemspec)
+
+ if options[:build_path]
+ Dir.chdir(File.dirname(gemspec)) do
+ spec = Gem::Specification.load File.basename(gemspec)
+ build_package(spec)
end
+ else
+ build_package(spec)
end
+
else
alert_error "Gemspec file not found: #{gemspec}"
terminate_interaction 1
end
end
+ private
+
+ def build_package(spec)
+ if spec
+ Gem::Package.build(
+ spec,
+ options[:force],
+ options[:strict],
+ options[:output]
+ )
+ else
+ alert_error "Error loading gemspec. Aborting."
+ terminate_interaction 1
+ end
+ end
end
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb
index 3ea4703a3e..55ee3ae73f 100644
--- a/lib/rubygems/commands/push_command.rb
+++ b/lib/rubygems/commands/push_command.rb
@@ -15,6 +15,8 @@ https://rubygems.org) and adds it to the index.
The gem can be removed from the index and deleted from the server using the yank
command. For further discussion see the help for the yank command.
+
+The push command will use ~/.gem/credentials to authenticate to a server, but you can use the RubyGems environment variable GEM_HOST_API_KEY to set the api key to authenticate.
EOF
end
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb
index 3607b61529..c6ccc209c8 100644
--- a/lib/rubygems/gemcutter_utilities.rb
+++ b/lib/rubygems/gemcutter_utilities.rb
@@ -38,7 +38,9 @@ module Gem::GemcutterUtilities
# The API key from the command options or from the user's configuration.
def api_key
- if options[:key]
+ if ENV["GEM_HOST_API_KEY"]
+ ENV["GEM_HOST_API_KEY"]
+ elsif options[:key]
verify_api_key options[:key]
elsif Gem.configuration.api_keys.key?(host)
Gem.configuration.api_keys[host]
diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
index dfaf7c55bf..4e16fbb86f 100644
--- a/lib/rubygems/rdoc.rb
+++ b/lib/rubygems/rdoc.rb
@@ -18,7 +18,7 @@ begin
module Gem
RDoc = ::RDoc::RubygemsHook
end
+
+ Gem.done_installing(&Gem::RDoc.method(:generation_hook))
rescue LoadError
end
-
-Gem.done_installing(&Gem::RDoc.method(:generation_hook))
diff --git a/lib/rubygems/request.rb b/lib/rubygems/request.rb
index fb164d79cf..d442f6534b 100644
--- a/lib/rubygems/request.rb
+++ b/lib/rubygems/request.rb
@@ -168,6 +168,7 @@ class Gem::Request
no_env_proxy = env_proxy.nil? || env_proxy.empty?
+ return :no_proxy if scheme == 'https' && no_env_proxy
return get_proxy_from_env 'http' if no_env_proxy and _scheme != 'http'
return :no_proxy if no_env_proxy
diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb
index 46276f3260..8a72006ea8 100644
--- a/lib/rubygems/resolver.rb
+++ b/lib/rubygems/resolver.rb
@@ -231,8 +231,6 @@ class Gem::Resolver
raise exc
end
- sources = []
-
groups = Hash.new { |hash, key| hash[key] = [] }
# create groups & sources in the same loop
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index bba3ffeab5..0215f4aa66 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1285,7 +1285,7 @@ class Gem::Specification < Gem::BasicSpecification
unresolved = unresolved_deps
unless unresolved.empty?
w = "W" + "ARN"
- warn "#{w}: Unresolved or ambigious specs during Gem::Specification.reset:"
+ warn "#{w}: Unresolved or ambiguous specs during Gem::Specification.reset:"
unresolved.values.each do |dep|
warn " #{dep}"
@@ -2254,6 +2254,7 @@ class Gem::Specification < Gem::BasicSpecification
attributes.each do |attr_name|
current_value = self.send attr_name
+ current_value = current_value.sort if %i(files test_files).include? attr_name
if current_value != default_value(attr_name) or
self.class.required_attribute? attr_name
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index a93f749240..783e8956a1 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -1057,6 +1057,8 @@ Also, a list:
Gem.instance_variable_set :@platforms, nil
Gem::Platform.instance_variable_set :@local, nil
+ yield if block_given?
+
platform
end
diff --git a/lib/rubygems/validator.rb b/lib/rubygems/validator.rb
index 828497f700..f00021daa9 100644
--- a/lib/rubygems/validator.rb
+++ b/lib/rubygems/validator.rb
@@ -19,29 +19,6 @@ class Gem::Validator
require 'find'
end
- ##
- # Given a gem file's contents, validates against its own MD5 checksum
- # gem_data:: [String] Contents of the gem file
-
- def verify_gem(gem_data)
- # TODO remove me? The code here only validate an MD5SUM that was
- # in some old formatted gems, but hasn't been for a long time.
- end
-
- ##
- # Given the path to a gem file, validates against its own MD5 checksum
- #
- # gem_path:: [String] Path to gem file
-
- def verify_gem_file(gem_path)
- File.open gem_path, Gem.binary_mode do |file|
- gem_data = file.read
- verify_gem gem_data
- end
- rescue Errno::ENOENT, Errno::EINVAL
- raise Gem::VerificationError, "missing gem file #{gem_path}"
- end
-
private
def find_files_for_gem(gem_directory)
@@ -105,7 +82,9 @@ class Gem::Validator
end
begin
- verify_gem_file(gem_path)
+ unless File.readable?(gem_path)
+ raise Gem::VerificationError, "missing gem file #{gem_path}"
+ end
good, gone, unreadable = nil, nil, nil, nil