summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-01-17 14:10:27 +0100
committergit <svn-admin@ruby-lang.org>2022-01-19 15:56:35 +0900
commit0350c179ea8c303b6f0087b96478b757052321c2 (patch)
treefc3b46c2ab4b6e7e8289bcc4e5fd21ee99fdaff1 /lib
parent8b6a02de2f99bc9670f91757db9bf86edf61f615 (diff)
[rubygems/rubygems] Don't pass regexp to `Gem::Dependeny.new` from list, search, and query commands
It's deprecated functionality. https://github.com/rubygems/rubygems/commit/13d3eb6cb0
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/commands/list_command.rb2
-rw-r--r--lib/rubygems/commands/query_command.rb2
-rw-r--r--lib/rubygems/commands/search_command.rb2
-rw-r--r--lib/rubygems/query_utils.rb16
4 files changed, 10 insertions, 12 deletions
diff --git a/lib/rubygems/commands/list_command.rb b/lib/rubygems/commands/list_command.rb
index dea11111c9..010d968f9c 100644
--- a/lib/rubygems/commands/list_command.rb
+++ b/lib/rubygems/commands/list_command.rb
@@ -10,7 +10,7 @@ class Gem::Commands::ListCommand < Gem::Command
def initialize
super 'list', 'Display local gems whose name matches REGEXP',
- :name => //, :domain => :local, :details => false, :versions => true,
+ :domain => :local, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default
add_query_options
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 5896bec44e..442c4b19bb 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -20,7 +20,7 @@ class Gem::Commands::QueryCommand < Gem::Command
def initialize(name = 'query',
summary = 'Query gem information in local or remote repositories')
super name, summary,
- :name => //, :domain => :local, :details => false, :versions => true,
+ :domain => :local, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default
add_option('-n', '--name-matches REGEXP',
diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb
index 488d777939..75d99986f9 100644
--- a/lib/rubygems/commands/search_command.rb
+++ b/lib/rubygems/commands/search_command.rb
@@ -7,7 +7,7 @@ class Gem::Commands::SearchCommand < Gem::Command
def initialize
super 'search', 'Display remote gems whose name matches REGEXP',
- :name => //, :domain => :remote, :details => false, :versions => true,
+ :domain => :remote, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default
add_query_options
diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb
index 4ea1d241ec..f4cfea3087 100644
--- a/lib/rubygems/query_utils.rb
+++ b/lib/rubygems/query_utils.rb
@@ -54,12 +54,12 @@ module Gem::QueryUtils
end
def defaults_str # :nodoc:
- "--local --name-matches // --no-details --versions --no-installed"
+ "--local --no-details --versions --no-installed"
end
def execute
gem_names = if args.empty?
- Array(options[:name])
+ [options[:name]]
else
options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i }
end
@@ -96,7 +96,7 @@ module Gem::QueryUtils
end
def gem_name?
- !options[:name].source.empty?
+ !options[:name].nil?
end
def prerelease
@@ -129,12 +129,10 @@ module Gem::QueryUtils
display_header("LOCAL")
specs = Gem::Specification.find_all do |s|
- s.name =~ name and req =~ s.version
- end
+ name_matches = name ? s.name =~ name : true
+ version_matches = show_prereleases? || !s.version.prerelease?
- dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }
- specs.select! do |s|
- dep.match?(s.name, s.version, show_prereleases?)
+ name_matches and version_matches
end
spec_tuples = specs.map do |spec|
@@ -149,7 +147,7 @@ module Gem::QueryUtils
fetcher = Gem::SpecFetcher.fetcher
- spec_tuples = if name.respond_to?(:source) && name.source.empty?
+ spec_tuples = if name.nil?
fetcher.detect(specs_type) { true }
else
fetcher.detect(specs_type) do |name_tuple|