Skip to content

Commit

Permalink
[#177] Added --extended option
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed Mar 23, 2012
1 parent dd3fe0b commit 5ca0920
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cocoapods/command/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ def self.banner
end

def self.options
" --extended Show details that require network access (like GitHub stats)\n" +
" --full Search by name, summary, and description\n" +
super
end

def initialize(argv)
@extended = argv.option('--extended')
@full_text_search = argv.option('--full')
unless @query = argv.arguments.first
super
Expand All @@ -33,14 +35,14 @@ def run
puts " #{wrap_text(set.specification.summary).strip}"
puts " - Homepage: #{set.specification.homepage}"

source = set.specification.source
if source
if @extended && (source = set.specification.source)
url = source[:git] || source[:hg] || source[:svn] || source[:local]
puts " - Source: #{url}" if url
if url =~ /github.com/
original_url, username, reponame = *(url.match(/[:\/](\w+)\/(\w+).git/).to_a)
if original_url
repo_info = `curl -s -m 2 http://github.com/api/v2/json/repos/show/#{username}/#{reponame}`
puts repo_info
watchers = repo_info.match(/\"watchers\"\W*:\W*([0-9]+)/).to_a[1]
forks = repo_info.match(/\"forks\"\W*:\W*([0-9]+)/).to_a[1]
puts " - Watchers: " + watchers if watchers
Expand Down

0 comments on commit 5ca0920

Please sign in to comment.