gigest 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gigest/analytics.rb +17 -7
- data/lib/gigest/version.rb +1 -1
- data/spec/fixtures/statistics.json +58 -58
- data/spec/gigest/analytics_spec.rb +7 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2723954973050f79daf590c2e6bf89eb4e9ce5c5
|
4
|
+
data.tar.gz: 7fb6a189a4da82657e8e3d3b15479ddc64019391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03964f8df7868553af58152f452bdddd6ce83271be6de420c8795dfa4c67d8387bb783dae22aced5f8d9bf3977a8fc80a721033e9700cae9614067de13f2bc56
|
7
|
+
data.tar.gz: 1c6c79564734ad3a2c159ad942f68b8156bf10ae404fb45879271a953f54faf257b7d33a939fc41c48ab11a4ed75bce00639f9c162705d86e3b268094a7e819e
|
data/lib/gigest/analytics.rb
CHANGED
@@ -24,22 +24,32 @@ module Gigest
|
|
24
24
|
summary[gem] ||= []
|
25
25
|
summary[gem] << repository.name unless summary[gem].include?(repository.name)
|
26
26
|
end
|
27
|
-
|
28
27
|
summary
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
31
|
# Returns statistic (sorted desc)
|
32
|
+
# Assuming GitHub user/org only has repo1 and repo2
|
33
33
|
# [
|
34
|
-
#
|
35
|
-
#
|
34
|
+
# {gem_name: gem1, repositories: ["repo1", "repo2"], count: 2, percentage: 100.0},
|
35
|
+
# {gem_name: gem2, repositories: ["repo1"], count: 1, percentage: 50.0}
|
36
36
|
# ]
|
37
37
|
def statistics
|
38
|
-
summary.
|
39
|
-
|
40
|
-
|
38
|
+
summary.map do |gem_name, repositories|
|
39
|
+
{
|
40
|
+
gem_name: gem_name,
|
41
|
+
repositories: repositories,
|
42
|
+
count: repositories.count,
|
43
|
+
percentage: percentage(repositories.count, @repositories_with_gemfile.count)
|
44
|
+
}
|
41
45
|
end
|
42
|
-
.sort_by { |
|
46
|
+
.sort_by { |statistic| statistic[:count] }.reverse
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def percentage(numerator, denominator)
|
52
|
+
(numerator.to_f / denominator.to_f * 100).round(2)
|
43
53
|
end
|
44
54
|
end
|
45
55
|
end
|
data/lib/gigest/version.rb
CHANGED
@@ -1,60 +1,60 @@
|
|
1
1
|
[
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
2
|
+
{"gem_name":"uglifier","repositories":["winston/cactus_app","winston/google_visualr_app","winston/rails","winston/trackerstats"],"count":4,"percentage":26.67},
|
3
|
+
{"gem_name":"sass-rails","repositories":["winston/cactus_app","winston/google_visualr_app","winston/trackerstats"],"count":3,"percentage":20.0},
|
4
|
+
{"gem_name":"jquery-rails","repositories":["winston/cactus_app","winston/rails","winston/trackerstats"],"count":3,"percentage":20.0},
|
5
|
+
{"gem_name":"rails","repositories":["winston/cactus_app","winston/google_visualr_app","winston/trackerstats"],"count":3,"percentage":20.0},
|
6
|
+
{"gem_name":"heroku","repositories":["winston/google_visualr_app","winston/soloistrc_builder","winston/trackerstats"],"count":3,"percentage":20.0},
|
7
|
+
{"gem_name":"rspec-rails","repositories":["winston/cactus_app","winston/trackerstats"],"count":2,"percentage":13.33},
|
8
|
+
{"gem_name":"capybara","repositories":["winston/cactus_app","winston/trackerstats"],"count":2,"percentage":13.33},
|
9
|
+
{"gem_name":"google_visualr","repositories":["winston/google_visualr_app","winston/trackerstats"],"count":2,"percentage":13.33},
|
10
|
+
{"gem_name":"bourbon","repositories":["winston/cactus_app","winston/soloistrc_builder"],"count":2,"percentage":13.33},
|
11
|
+
{"gem_name":"mocha","repositories":["winston/rails","winston/simple_form"],"count":2,"percentage":13.33},
|
12
|
+
{"gem_name":"nokogiri","repositories":["winston/rails","winston/trackerstats"],"count":2,"percentage":13.33},
|
13
|
+
{"gem_name":"haml","repositories":["winston/soloistrc_builder","winston/trackerstats"],"count":2,"percentage":13.33},
|
14
|
+
{"gem_name":"mysql","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
15
|
+
{"gem_name":"rdiscount","repositories":["winston/soloistrc_builder"],"count":1,"percentage":6.67},
|
16
|
+
{"gem_name":"sass","repositories":["winston/soloistrc_builder"],"count":1,"percentage":6.67},
|
17
|
+
{"gem_name":"jquery-ui-themes","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
18
|
+
{"gem_name":"sinatra","repositories":["winston/soloistrc_builder"],"count":1,"percentage":6.67},
|
19
|
+
{"gem_name":"thin","repositories":["winston/soloistrc_builder"],"count":1,"percentage":6.67},
|
20
|
+
{"gem_name":"ruby-debug","repositories":["winston/simple_form"],"count":1,"percentage":6.67},
|
21
|
+
{"gem_name":"rspec","repositories":["winston/set-interview-ruby"],"count":1,"percentage":6.67},
|
22
|
+
{"gem_name":"ibm_db","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
23
|
+
{"gem_name":"activerecord-oracle_enhanced-adapter","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
24
|
+
{"gem_name":"ruby-oci8","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
25
|
+
{"gem_name":"activerecord-jdbcpostgresql-adapter","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
26
|
+
{"gem_name":"activerecord-jdbcmysql-adapter","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
27
|
+
{"gem_name":"jruby-openssl","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
28
|
+
{"gem_name":"activerecord-jdbcsqlite3-adapter","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
29
|
+
{"gem_name":"mysql2","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
30
|
+
{"gem_name":"foreman","repositories":["winston/soloistrc_builder"],"count":1,"percentage":6.67},
|
31
|
+
{"gem_name":"pg","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
32
|
+
{"gem_name":"sqlite3","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
33
|
+
{"gem_name":"rest-client","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
34
|
+
{"gem_name":"yajl-ruby","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
35
|
+
{"gem_name":"json","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
36
|
+
{"gem_name":"ruby-prof","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
37
|
+
{"gem_name":"memcache-client","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
38
|
+
{"gem_name":"w3c_validators","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
39
|
+
{"gem_name":"RedCloth","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
40
|
+
{"gem_name":"sdoc","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
41
|
+
{"gem_name":"pivotal_git_scripts","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
42
|
+
{"gem_name":"rake","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
43
|
+
{"gem_name":"journey","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
44
|
+
{"gem_name":"bcrypt-ruby","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
45
|
+
{"gem_name":"arel","repositories":["winston/rails"],"count":1,"percentage":6.67},
|
46
|
+
{"gem_name":"awesome_print","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
47
|
+
{"gem_name":"compass-rails","repositories":["winston/google_visualr_app"],"count":1,"percentage":6.67},
|
48
|
+
{"gem_name":"turn","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
49
|
+
{"gem_name":"pry","repositories":["winston/evergreen"],"count":1,"percentage":6.67},
|
50
|
+
{"gem_name":"cactus","repositories":["winston/cactus_app"],"count":1,"percentage":6.67},
|
51
|
+
{"gem_name":"webmock","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
52
|
+
{"gem_name":"evergreen","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
53
|
+
{"gem_name":"ruby-debug19","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
54
|
+
{"gem_name":"factory_girl_rails","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
55
|
+
{"gem_name":"coffee-rails","repositories":["winston/cactus_app"],"count":1,"percentage":6.67},
|
56
|
+
{"gem_name":"timecop","repositories":["winston/trackerstats"],"count":1,"percentage":6.67},
|
57
|
+
{"gem_name":"haml-rails","repositories":["winston/cactus_app"],"count":1,"percentage":6.67},
|
58
|
+
{"gem_name":"rcov","repositories":["winston/vestal_versions"],"count":1,"percentage":6.67},
|
59
|
+
{"gem_name":"simplecov","repositories":["winston/vestal_versions"],"count":1,"percentage":6.67}
|
60
60
|
]
|
@@ -35,7 +35,7 @@ describe Gigest::Analytics do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "#summary", :vcr do
|
38
|
-
let(:expected)
|
38
|
+
let(:expected) { JSON.parse File.read(File.join(Dir.pwd, "spec", "fixtures", "summary.json")) }
|
39
39
|
|
40
40
|
context "when repositories exist" do
|
41
41
|
before { analytics.process_for("winston") }
|
@@ -53,7 +53,12 @@ describe Gigest::Analytics do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "#statistics", :vcr do
|
56
|
-
let(:expected)
|
56
|
+
let(:expected) do
|
57
|
+
contents = JSON.parse(File.read(File.join(Dir.pwd, "spec", "fixtures", "statistics.json")))
|
58
|
+
contents.map do |row|
|
59
|
+
row.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
60
|
+
end
|
61
|
+
end
|
57
62
|
|
58
63
|
context "when repositories exist" do
|
59
64
|
before { analytics.process_for("winston") }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gigest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winston Teo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|