Class: Gem::Commands::GithubCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::GithubCommand
- Defined in:
- lib/gem/commands/github_command.rb
Overview
require ‘gem/prune/version’
Instance Method Summary collapse
- #arguments ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ GithubCommand
constructor
A new instance of GithubCommand.
- #usage ⇒ Object
Constructor Details
#initialize ⇒ GithubCommand
Returns a new instance of GithubCommand.
10 11 12 |
# File 'lib/gem/commands/github_command.rb', line 10 def initialize super 'github', 'Show stats for the various Github versions of a gem' end |
Instance Method Details
#arguments ⇒ Object
14 15 16 |
# File 'lib/gem/commands/github_command.rb', line 14 def arguments "GEMNAME the gem name to search for" end |
#execute ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gem/commands/github_command.rb', line 22 def execute name = get_one_gem_name search = /^.+\-#{name}$/i dep = Gem::Dependency.new search, Gem::Requirement.default specs = Gem::SpecFetcher.fetcher.find_matching dep stats = specs.map do |(gem, source)| next unless source == 'http://gems.github.com' stats_from_github_gem_name(gem.first) end.compact github_stats_sort(stats).each do |stat| say "%-30s fork:%-4s watchers:%-3d updated:%s" % [ stat[:name], stat[:fork] ? 'yes' : 'no', stat[:watchers], stat[:updated] ] end rescue Exception => ex puts "Unhandled Exception: #{ex.}" end |
#usage ⇒ Object
18 19 20 |
# File 'lib/gem/commands/github_command.rb', line 18 def usage "#{program_name} GEMNAME" end |