gem-github 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +16 -0
- data/Rakefile +57 -0
- data/VERSION +1 -0
- data/gem-github.gemspec +57 -0
- data/lib/gem/commands/github_command.rb +65 -0
- data/lib/rubygems_plugin.rb +3 -0
- data/test/gem-github-stats_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +86 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 David Dollar
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
= gem-github-stats
|
2
|
+
|
3
|
+
== Usage
|
4
|
+
|
5
|
+
$ gem github railroad
|
6
|
+
|
7
|
+
peterhoeg-railroad fork:no watchers:7 updated:2009-05-16
|
8
|
+
factorylabs-railroad fork:yes watchers:8 updated:2009-01-05
|
9
|
+
bryanlarsen-railroad fork:yes watchers:7 updated:2009-06-30
|
10
|
+
nono-railroad fork:yes watchers:7 updated:2009-03-13
|
11
|
+
ddollar-railroad fork:yes watchers:2 updated:2009-03-13
|
12
|
+
terotil-railroad fork:yes watchers:2 updated:2009-02-13
|
13
|
+
|
14
|
+
== Copyright
|
15
|
+
|
16
|
+
Copyright (c) 2009 David Dollar. MIT license.
|
data/Rakefile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "gem-github"
|
8
|
+
gem.summary = %Q{Show Github-related stats of the same gem from different users}
|
9
|
+
gem.description = gem.summary
|
10
|
+
gem.email = "<ddollar@gmail.com>"
|
11
|
+
gem.homepage = "http://github.com/ddollar/gem-github-stats"
|
12
|
+
gem.authors = ["David Dollar"]
|
13
|
+
gem.add_runtime_dependency 'fcoury-octopi', '>= 0.1.0'
|
14
|
+
gem.add_development_dependency "thoughtbot-shoulda"
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
Rake::TestTask.new(:test) do |test|
|
23
|
+
test.libs << 'lib' << 'test'
|
24
|
+
test.pattern = 'test/**/*_test.rb'
|
25
|
+
test.verbose = true
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
require 'rcov/rcovtask'
|
30
|
+
Rcov::RcovTask.new do |test|
|
31
|
+
test.libs << 'test'
|
32
|
+
test.pattern = 'test/**/*_test.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
rescue LoadError
|
36
|
+
task :rcov do
|
37
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
task :test => :check_dependencies
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
if File.exist?('VERSION')
|
48
|
+
version = File.read('VERSION')
|
49
|
+
else
|
50
|
+
version = ""
|
51
|
+
end
|
52
|
+
|
53
|
+
rdoc.rdoc_dir = 'rdoc'
|
54
|
+
rdoc.title = "gem-github-stats #{version}"
|
55
|
+
rdoc.rdoc_files.include('README*')
|
56
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
57
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.4.0
|
data/gem-github.gemspec
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{gem-github}
|
8
|
+
s.version = "0.4.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["David Dollar"]
|
12
|
+
s.date = %q{2009-08-19}
|
13
|
+
s.description = %q{Show Github-related stats of the same gem from different users}
|
14
|
+
s.email = %q{<ddollar@gmail.com>}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"gem-github.gemspec",
|
27
|
+
"lib/gem/commands/github_command.rb",
|
28
|
+
"lib/rubygems_plugin.rb",
|
29
|
+
"test/gem-github-stats_test.rb",
|
30
|
+
"test/test_helper.rb"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/ddollar/gem-github-stats}
|
33
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = %q{1.3.5}
|
36
|
+
s.summary = %q{Show Github-related stats of the same gem from different users}
|
37
|
+
s.test_files = [
|
38
|
+
"test/gem-github-stats_test.rb",
|
39
|
+
"test/test_helper.rb"
|
40
|
+
]
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<fcoury-octopi>, [">= 0.1.0"])
|
48
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
49
|
+
else
|
50
|
+
s.add_dependency(%q<fcoury-octopi>, [">= 0.1.0"])
|
51
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
52
|
+
end
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<fcoury-octopi>, [">= 0.1.0"])
|
55
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'rubygems/command'
|
2
|
+
require 'rubygems/command_manager'
|
3
|
+
require 'octopi'
|
4
|
+
# require 'rubygems/uninstaller'
|
5
|
+
# require 'gem/prune/gem'
|
6
|
+
# require 'gem/prune/version'
|
7
|
+
|
8
|
+
class Gem::Commands::GithubCommand < Gem::Command
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
super 'github', 'Show stats for the various Github versions of a gem'
|
12
|
+
end
|
13
|
+
|
14
|
+
def arguments
|
15
|
+
"GEMNAME the gem name to search for"
|
16
|
+
end
|
17
|
+
|
18
|
+
def usage
|
19
|
+
"#{program_name} GEMNAME"
|
20
|
+
end
|
21
|
+
|
22
|
+
def execute
|
23
|
+
name = get_one_gem_name
|
24
|
+
search = /^.+\-#{name}$/i
|
25
|
+
dep = Gem::Dependency.new search, Gem::Requirement.default
|
26
|
+
specs = Gem::SpecFetcher.fetcher.find_matching dep
|
27
|
+
|
28
|
+
stats = specs.map do |(gem, source)|
|
29
|
+
next unless source == 'http://gems.github.com'
|
30
|
+
stats_from_github_gem_name(gem.first)
|
31
|
+
end
|
32
|
+
|
33
|
+
github_stats_sort(stats).each do |stat|
|
34
|
+
say "%-30s fork:%-4s watchers:%-3d updated:%s" % [
|
35
|
+
stat[:name],
|
36
|
+
stat[:fork] ? 'yes' : 'no',
|
37
|
+
stat[:watchers],
|
38
|
+
stat[:updated]
|
39
|
+
]
|
40
|
+
end
|
41
|
+
rescue Exception => ex
|
42
|
+
puts "Unhandled Exception: #{ex.message}"
|
43
|
+
end
|
44
|
+
|
45
|
+
private ######################################################################
|
46
|
+
|
47
|
+
def stats_from_github_gem_name(name)
|
48
|
+
user_name, repository_name = name.split('-', 2)
|
49
|
+
repository = Octopi::User.find(user_name).repository(repository_name)
|
50
|
+
{
|
51
|
+
:name => name,
|
52
|
+
:user => user_name,
|
53
|
+
:fork => repository.fork?,
|
54
|
+
:watchers => repository.watchers,
|
55
|
+
:updated => repository.commits.first.committed_date.split('T').first
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
def github_stats_sort(stats)
|
60
|
+
stats.partition { |stat| stat[:fork] }.reverse.map do |stats|
|
61
|
+
stats.sort_by { |stat| stat[:watchers] }.reverse
|
62
|
+
end.flatten
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gem-github
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Dollar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-08-19 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: fcoury-octopi
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.1.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: thoughtbot-shoulda
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: Show Github-related stats of the same gem from different users
|
36
|
+
email: <ddollar@gmail.com>
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE
|
43
|
+
- README.rdoc
|
44
|
+
files:
|
45
|
+
- .document
|
46
|
+
- .gitignore
|
47
|
+
- LICENSE
|
48
|
+
- README.rdoc
|
49
|
+
- Rakefile
|
50
|
+
- VERSION
|
51
|
+
- gem-github.gemspec
|
52
|
+
- lib/gem/commands/github_command.rb
|
53
|
+
- lib/rubygems_plugin.rb
|
54
|
+
- test/gem-github-stats_test.rb
|
55
|
+
- test/test_helper.rb
|
56
|
+
has_rdoc: true
|
57
|
+
homepage: http://github.com/ddollar/gem-github-stats
|
58
|
+
licenses: []
|
59
|
+
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options:
|
62
|
+
- --charset=UTF-8
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
version:
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
version:
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 1.3.5
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: Show Github-related stats of the same gem from different users
|
84
|
+
test_files:
|
85
|
+
- test/gem-github-stats_test.rb
|
86
|
+
- test/test_helper.rb
|