aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/basic_specification.rb2
-rw-r--r--lib/rubygems/command.rb2
-rw-r--r--lib/rubygems/commands/help_command.rb2
-rw-r--r--lib/rubygems/commands/sources_command.rb6
-rw-r--r--lib/rubygems/commands/uninstall_command.rb2
-rw-r--r--lib/rubygems/ext/builder.rb4
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb2
-rw-r--r--lib/rubygems/resolver/api_set.rb2
-rw-r--r--lib/rubygems/resolver/api_specification.rb2
-rw-r--r--lib/rubygems/server.rb2
-rw-r--r--lib/rubygems/specification.rb20
-rw-r--r--lib/rubygems/specification_policy.rb10
-rw-r--r--lib/rubygems/test_case.rb40
-rw-r--r--lib/rubygems/util.rb8
-rw-r--r--lib/rubygems/version.rb2
15 files changed, 71 insertions, 35 deletions
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index c6d63ac473..339953eb29 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -78,7 +78,7 @@ class Gem::BasicSpecification
elsif missing_extensions?
@ignored = true
- if RUBY_ENGINE == platform || Gem::Platform.local === platform
+ if Gem::Platform::RUBY == platform || Gem::Platform.local === platform
warn "Ignoring #{full_name} because its extensions are not built. " +
"Try: gem pristine #{name} --version #{version}"
end
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index c1e5e13c5a..32ec0f8ba6 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -646,7 +646,7 @@ basic help message containing pointers to more information.
http://localhost:8808/
with info about installed gems
Further information:
- http://guides.rubygems.org
+ https://guides.rubygems.org
HELP
# :startdoc:
diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb
index 9f14e22f90..259e8b5622 100644
--- a/lib/rubygems/commands/help_command.rb
+++ b/lib/rubygems/commands/help_command.rb
@@ -38,7 +38,7 @@ Some examples of 'gem' usage.
* Create a gem:
- See http://guides.rubygems.org/make-your-own-gem/
+ See https://guides.rubygems.org/make-your-own-gem/
* See information about RubyGems:
diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb
index feab23237d..ca9d425232 100644
--- a/lib/rubygems/commands/sources_command.rb
+++ b/lib/rubygems/commands/sources_command.rb
@@ -136,7 +136,7 @@ RubyGems has been configured to serve gems via the following URLs through
its history:
* http://gems.rubyforge.org (RubyGems 1.3.6 and earlier)
-* http://rubygems.org (RubyGems 1.3.7 through 1.8.25)
+* https://rubygems.org/ (RubyGems 1.3.7 through 1.8.25)
* https://rubygems.org (RubyGems 2.0.1 and newer)
Since all of these sources point to the same set of gems you only need one
@@ -153,8 +153,8 @@ before it is added.
To remove a source use the --remove argument:
- $ gem sources --remove http://rubygems.org
- http://rubygems.org removed from sources
+ $ gem sources --remove https://rubygems.org/
+ https://rubygems.org/ removed from sources
EOF
end
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index 68e048c010..c1a9dbba32 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -143,7 +143,7 @@ that is a dependency of an existing gem. You can use the
uninstall_gem spec.name
end
- alert "Uninstalled all gems in #{options[:install_dir]}"
+ alert "Uninstalled all gems in #{options[:install_dir] || Gem.dir}"
end
def uninstall_specific
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index 2fc1074d92..a8bd4c8d1b 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -68,7 +68,9 @@ class Gem::Ext::Builder
results << (command.respond_to?(:shelljoin) ? command.shelljoin : command)
require "open3"
- output, status = Open3.capture2e(*command)
+ # Set $SOURCE_DATE_EPOCH for the subprocess.
+ env = {'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string}
+ output, status = Open3.capture2e(env, *command)
if verbose
puts output
else
diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb
index b7a8ee6f4f..ef3f302ea8 100644
--- a/lib/rubygems/request_set/gem_dependency_api.rb
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -235,7 +235,7 @@ class Gem::RequestSet::GemDependencyAPI
return unless (groups & @without_groups).empty?
dependencies.each do |dep|
- @set.gem dep.name, *dep.requirement
+ @set.gem dep.name, *dep.requirement.as_list
end
end
diff --git a/lib/rubygems/resolver/api_set.rb b/lib/rubygems/resolver/api_set.rb
index 6fd91e3b73..135f1b08aa 100644
--- a/lib/rubygems/resolver/api_set.rb
+++ b/lib/rubygems/resolver/api_set.rb
@@ -23,7 +23,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
##
# Creates a new APISet that will retrieve gems from +uri+ using the RubyGems
# API URL +dep_uri+ which is described at
- # http://guides.rubygems.org/rubygems-org-api
+ # https://guides.rubygems.org/rubygems-org-api
def initialize(dep_uri = 'https://rubygems.org/api/v1/dependencies')
super()
diff --git a/lib/rubygems/resolver/api_specification.rb b/lib/rubygems/resolver/api_specification.rb
index 9bbc095788..4052846e99 100644
--- a/lib/rubygems/resolver/api_specification.rb
+++ b/lib/rubygems/resolver/api_specification.rb
@@ -11,7 +11,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
# Creates an APISpecification for the given +set+ from the rubygems.org
# +api_data+.
#
- # See http://guides.rubygems.org/rubygems-org-api/#misc_methods for the
+ # See https://guides.rubygems.org/rubygems-org-api/#misc_methods for the
# format of the +api_data+.
def initialize(set, api_data)
diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb
index 97923ef698..83d7cf5abc 100644
--- a/lib/rubygems/server.rb
+++ b/lib/rubygems/server.rb
@@ -661,7 +661,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
"only_one_executable" => true,
"full_name" => "rubygems-#{Gem::VERSION}",
"has_deps" => false,
- "homepage" => "http://guides.rubygems.org/",
+ "homepage" => "https://guides.rubygems.org/",
"name" => 'rubygems',
"ri_installed" => true,
"summary" => "RubyGems itself",
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 5321edfcc3..f925480f88 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -193,6 +193,12 @@ class Gem::Specification < Gem::BasicSpecification
@@spec_with_requirable_file = {}
@@active_stub_with_requirable_file = {}
+ # Tracking removed method calls to warn users during build time.
+ REMOVED_METHODS = [:rubyforge_project=].freeze # :nodoc:
+ def removed_method_calls
+ @removed_method_calls ||= []
+ end
+
######################################################################
# :section: Required gemspec attributes
@@ -727,14 +733,6 @@ class Gem::Specification < Gem::BasicSpecification
attr_writer :original_platform # :nodoc:
##
- # Deprecated and ignored.
- #
- # Formerly used to set rubyforge project.
-
- attr_writer :rubyforge_project
- deprecate :rubyforge_project=, :none, 2019, 12
-
- ##
# The Gem::Specification version of this gemspec.
#
# Do not set this, it is set automatically when the gem is packaged.
@@ -2107,9 +2105,15 @@ class Gem::Specification < Gem::BasicSpecification
end
##
+ # Track removed method calls to warn about during build time.
# Warn about unknown attributes while loading a spec.
def method_missing(sym, *a, &b) # :nodoc:
+ if REMOVED_METHODS.include?(sym)
+ removed_method_calls << sym
+ return
+ end
+
if @specification_version > CURRENT_SPECIFICATION_VERSION and
sym.to_s =~ /=$/
warn "ignoring #{sym} loading #{full_name}" if $DEBUG
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index c3c496db9b..b7fb2cfa1a 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -75,6 +75,8 @@ class Gem::SpecificationPolicy
validate_dependencies
+ validate_removed_attributes
+
if @warnings > 0
if strict
error "specification has warnings"
@@ -408,6 +410,12 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
warning "#{executable_path} is missing #! line"
end
+ def validate_removed_attributes # :nodoc:
+ @specification.removed_method_calls.each do |attr|
+ warning("#{attr} is deprecated and ignored. Please remove this from your gemspec to ensure that your gem continues to build in the future.")
+ end
+ end
+
def warning(statement) # :nodoc:
@warnings += 1
@@ -421,7 +429,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
end
def help_text # :nodoc:
- "See http://guides.rubygems.org/specification-reference/ for help"
+ "See https://guides.rubygems.org/specification-reference/ for help"
end
end
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 206497c651..89403206f9 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -96,6 +96,8 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
TEST_PATH = ENV.fetch('RUBYGEMS_TEST_PATH', File.expand_path('../../../test/rubygems', __FILE__))
+ SPECIFICATIONS = File.expand_path(File.join(TEST_PATH, "specifications"), __FILE__)
+
def assert_activate(expected, *specs)
specs.each do |spec|
case spec
@@ -169,20 +171,24 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni
# original value when the block ends
#
def bindir(value)
- bindir = RbConfig::CONFIG['bindir']
+ with_clean_path_to_ruby do
+ bindir = RbConfig::CONFIG['bindir']
- if value
- RbConfig::CONFIG['bindir'] = value
- else
- RbConfig::CONFIG.delete 'bindir'
- end
+ if value
+ RbConfig::CONFIG['bindir'] = value
+ else
+ RbConfig::CONFIG.delete 'bindir'
+ end
- yield
- ensure
- if bindir
- RbConfig::CONFIG['bindir'] = bindir
- else
- RbConfig::CONFIG.delete 'bindir'
+ begin
+ yield
+ ensure
+ if bindir
+ RbConfig::CONFIG['bindir'] = bindir
+ else
+ RbConfig::CONFIG.delete 'bindir'
+ end
+ end
end
end
@@ -1247,6 +1253,16 @@ Also, a list:
end
end
+ def with_clean_path_to_ruby
+ orig_ruby = Gem.ruby
+
+ Gem.instance_variable_set :@ruby, nil
+
+ yield
+ ensure
+ Gem.instance_variable_set :@ruby, orig_ruby
+ end
+
class << self
# :nodoc:
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb
index b5f1408401..7fc239af9a 100644
--- a/lib/rubygems/util.rb
+++ b/lib/rubygems/util.rb
@@ -14,7 +14,13 @@ module Gem::Util
require 'stringio'
data = StringIO.new(data, 'r')
- unzipped = Zlib::GzipReader.new(data).read
+ gzip_reader = begin
+ Zlib::GzipReader.new(data)
+ rescue Zlib::GzipFile::Error => e
+ raise e.class, e.inspect, e.backtrace
+ end
+
+ unzipped = gzip_reader.read
unzipped.force_encoding Encoding::BINARY
unzipped
end
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
index 6524faf5c8..b1faedcda2 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -151,7 +151,7 @@
class Gem::Version
- autoload :Requirement, 'rubygems/requirement'
+ autoload :Requirement, File.expand_path('requirement', __dir__)
include Comparable