Add support for searching by title

References #4
This commit is contained in:
R. Tyler Croy 2014-04-03 18:17:41 -07:00
parent 6cb694779e
commit 484a103604
2 changed files with 15 additions and 1 deletions

View File

@ -18,4 +18,18 @@ Feature: Search for plugins
"""
Scenario: Searching for a plugin by title
Given I have catalog meta-data
When I run `jpm search "AnsiColor Plugin"`
Then the output should contain:
"""
Loading plugin repository data...
- AnsiColor Plugin (ansicolor)
version: v0.3.1
labels: misc
wiki: <https://wiki.jenkins-ci.org/display/JENKINS/AnsiColor+Plugin>
"""

View File

@ -91,7 +91,7 @@ module JPM
def search(term)
results = []
@plugins.each_pair do |name, plugin|
if name.match(term)
if name.match(term) || plugin.title.match(term)
if block_given?
yield plugin
else