mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Don't pass regexp to Gem::Dependency.new
during gem dependency
https://github.com/rubygems/rubygems/commit/89dd5158a4
This commit is contained in:
parent
1d530ae27a
commit
0dd8c6157d
1 changed files with 20 additions and 22 deletions
|
@ -53,41 +53,41 @@ use with other commands.
|
|||
"#{program_name} REGEXP"
|
||||
end
|
||||
|
||||
def fetch_remote_specs(dependency) # :nodoc:
|
||||
def fetch_remote_specs(name, requirement, prerelease) # :nodoc:
|
||||
fetcher = Gem::SpecFetcher.fetcher
|
||||
|
||||
ss, = fetcher.spec_for_dependency dependency
|
||||
specs_type = prerelease ? :complete : :released
|
||||
|
||||
ss.map {|spec, _| spec }
|
||||
ss = if name.nil?
|
||||
fetcher.detect(specs_type) { true }
|
||||
else
|
||||
fetcher.detect(specs_type) do |name_tuple|
|
||||
name === name_tuple.name && requirement.satisfied_by?(name_tuple.version)
|
||||
end
|
||||
end
|
||||
|
||||
ss.map {|tuple, source| source.fetch_spec(tuple) }
|
||||
end
|
||||
|
||||
def fetch_specs(name_pattern, dependency) # :nodoc:
|
||||
def fetch_specs(name_pattern, requirement, prerelease) # :nodoc:
|
||||
specs = []
|
||||
|
||||
if local?
|
||||
specs.concat Gem::Specification.stubs.find_all {|spec|
|
||||
name_pattern =~ spec.name and
|
||||
dependency.requirement.satisfied_by? spec.version
|
||||
name_matches = name_pattern ? name_pattern =~ spec.name : true
|
||||
version_matches = requirement.satisfied_by?(spec.version)
|
||||
|
||||
name_matches and version_matches
|
||||
}.map(&:to_spec)
|
||||
end
|
||||
|
||||
specs.concat fetch_remote_specs dependency if remote?
|
||||
specs.concat fetch_remote_specs name_pattern, requirement, prerelease if remote?
|
||||
|
||||
ensure_specs specs
|
||||
|
||||
specs.uniq.sort
|
||||
end
|
||||
|
||||
def gem_dependency(pattern, version, prerelease) # :nodoc:
|
||||
dependency = Gem::Deprecate.skip_during do
|
||||
Gem::Dependency.new pattern, version
|
||||
end
|
||||
|
||||
dependency.prerelease = prerelease
|
||||
|
||||
dependency
|
||||
end
|
||||
|
||||
def display_pipe(specs) # :nodoc:
|
||||
specs.each do |spec|
|
||||
unless spec.dependencies.empty?
|
||||
|
@ -119,11 +119,9 @@ use with other commands.
|
|||
ensure_local_only_reverse_dependencies
|
||||
|
||||
pattern = name_pattern options[:args]
|
||||
requirement = Gem::Requirement.new options[:version]
|
||||
|
||||
dependency =
|
||||
gem_dependency pattern, options[:version], options[:prerelease]
|
||||
|
||||
specs = fetch_specs pattern, dependency
|
||||
specs = fetch_specs pattern, requirement, options[:prerelease]
|
||||
|
||||
reverse = reverse_dependencies specs
|
||||
|
||||
|
@ -197,7 +195,7 @@ use with other commands.
|
|||
private
|
||||
|
||||
def name_pattern(args)
|
||||
args << '' if args.empty?
|
||||
return if args.empty?
|
||||
|
||||
if args.length == 1 and args.first =~ /\A(.*)(i)?\z/m
|
||||
flags = $2 ? Regexp::IGNORECASE : nil
|
||||
|
|
Loading…
Reference in a new issue