diff options
author | Ellen Marie Dash <[email protected]> | 2024-02-29 18:38:40 -0500 |
---|---|---|
committer | git <[email protected]> | 2024-03-29 08:03:40 +0000 |
commit | d19744fbd6e8ede579eb73109e6b2ec936a6ab43 (patch) | |
tree | bf07393f2e2a07fd43c412ea164270147501ad15 /lib/rubygems/gemspec_helpers.rb | |
parent | d916dbcb849b816b15717c64ea0c0ce756c15fb5 (diff) |
[rubygems/rubygems] [build, rebuild] Split common find_gemspec() out to GemspecHelpers.
https://github.com/rubygems/rubygems/commit/2f80a595c4
Diffstat (limited to 'lib/rubygems/gemspec_helpers.rb')
-rw-r--r-- | lib/rubygems/gemspec_helpers.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/rubygems/gemspec_helpers.rb b/lib/rubygems/gemspec_helpers.rb new file mode 100644 index 0000000000..a4ce0756e3 --- /dev/null +++ b/lib/rubygems/gemspec_helpers.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require_relative "../rubygems" + +## +# Mixin methods for commands that work with gemspecs. + +module Gem::GemspecHelpers + 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 + +end |