[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
This commit is contained in:
parent
8b6a02de2f
commit
0350c179ea
@ -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
|
||||
|
@ -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',
|
||||
|
@ -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
|
||||
|
@ -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|
|
||||
|
@ -252,7 +252,7 @@ class TestGemCommandManager < Gem::TestCase
|
||||
Gem::Deprecate.skip_during do
|
||||
@command_manager.process_args %w[query]
|
||||
end
|
||||
assert_equal(//, check_options[:name])
|
||||
assert_nil(check_options[:name])
|
||||
assert_equal :local, check_options[:domain]
|
||||
assert_equal false, check_options[:details]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user