gem-man 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rubygems/commands/man_command.rb +7 -6
- metadata +1 -1
@@ -67,7 +67,8 @@ class Gem::Commands::ManCommand < Gem::Command
|
|
67
67
|
end
|
68
68
|
|
69
69
|
# Try to read manpages.
|
70
|
-
|
70
|
+
spec = get_spec(name) { |s| s.has_manpage?(section) }
|
71
|
+
read_manpage(spec, section)
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
@@ -100,21 +101,21 @@ class Gem::Commands::ManCommand < Gem::Command
|
|
100
101
|
File.join(spec.installation_path, "gems", spec.full_name)
|
101
102
|
end
|
102
103
|
|
103
|
-
def get_spec(name)
|
104
|
+
def get_spec(name, &block)
|
104
105
|
dep = Gem::Dependency.new(name, options[:version])
|
105
106
|
specs = Gem.source_index.search(dep)
|
106
107
|
|
107
|
-
if
|
108
|
-
specs = specs.select { |spec| yield spec}
|
108
|
+
if block
|
109
|
+
specs = specs.select { |spec| yield spec }
|
109
110
|
end
|
110
111
|
|
111
112
|
if specs.length == 0
|
112
113
|
# If we have not tried to do a pattern match yet, fall back on it.
|
113
114
|
if !options[:exact] && !name.is_a?(Regexp)
|
114
115
|
pattern = /#{Regexp.escape name}/
|
115
|
-
get_spec(pattern)
|
116
|
+
get_spec(pattern, &block)
|
116
117
|
else
|
117
|
-
say "#{name.inspect}
|
118
|
+
say "Can't find any manpages for '#{name.inspect}"
|
118
119
|
nil
|
119
120
|
end
|
120
121
|
elsif specs.length == 1 || options[:latest]
|