Skip to content

Instantly share code, notes, and snippets.

@jrabbit
Created June 22, 2010 03:10
Show Gist options
  • Save jrabbit/447879 to your computer and use it in GitHub Desktop.
Save jrabbit/447879 to your computer and use it in GitHub Desktop.
def search_gem(pac):
things = []
raw = Popen(['gem', 'search','-b', pac], stdout=PIPE).communicate()[0]
for x in raw.split('\n'):
if x and x != '*** LOCAL GEMS ***' and x != '*** REMOTE GEMS ***':
things.append(x)
if not things:
return
else:
print 'found ' + len(things) + ' results for ' + pac\
+ ' in your configured rubygems sources:'
print things
return things
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment