[rubygems/rubygems] [build, rebuild] Split common find_gemspec() out to GemspecHelpers.

2f80a595c4
This commit is contained in:
Ellen Marie Dash 2024-02-29 18:38:40 -05:00 committed by git
parent d916dbcb84
commit d19744fbd6
3 changed files with 25 additions and 22 deletions

View file

@ -4,9 +4,12 @@ require "date"
require "digest"
require "fileutils"
require "tmpdir"
require_relative "../gemspec_helpers"
require_relative "../package"
class Gem::Commands::RebuildCommand < Gem::Command
include Gem::GemspecHelpers
DATE_FORMAT = "%Y-%m-%d %H:%M:%S.%N Z"
def initialize
@ -223,17 +226,6 @@ Please install RubyGems v#{rg_version} and try again.
ENV["SOURCE_DATE_EPOCH"] = old_sde
end
def find_gemspec(glob = "*.gemspec")
gemspecs = Dir.glob(glob).sort
if gemspecs.size > 1
alert_error "Multiple gemspecs found: #{gemspecs}, please specify one"
terminate_interaction(1)
end
gemspecs.first
end
def error_message(gem_name)
if gem_name
"Couldn't find a gemspec file matching '#{gem_name}' in #{Dir.pwd}"