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.
@@ -67,7 +67,8 @@ class Gem::Commands::ManCommand < Gem::Command
67
67
  end
68
68
 
69
69
  # Try to read manpages.
70
- read_manpage(get_spec(name), section)
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 block_given?
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} is not available"
118
+ say "Can't find any manpages for '#{name.inspect}"
118
119
  nil
119
120
  end
120
121
  elsif specs.length == 1 || options[:latest]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath