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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c72d8d8cb527ede3b858a34ef086ff08923c5ce
4
- data.tar.gz: b9b44d3380cad5990be22693ec8d9a893710a344
3
+ metadata.gz: 2723954973050f79daf590c2e6bf89eb4e9ce5c5
4
+ data.tar.gz: 7fb6a189a4da82657e8e3d3b15479ddc64019391
5
5
  SHA512:
6
- metadata.gz: b7dabb8214a7b0be3ca9bb2046e373168ed07a3fdec12dbdd0b6f46fc1d9f44e8c3328b17bf037f142752d60a2ad85f1bf845f1fb38dd4354090cf17bca7a92f
7
- data.tar.gz: 2609a9e2aae72c0d82fb8d187077858986da0fd1781b9f52e05ecebfed27cb9cf7662b88f697b97154f510aa9590a4cbcd03e7c07162baf2706a93065d5a4b3f
6
+ metadata.gz: 03964f8df7868553af58152f452bdddd6ce83271be6de420c8795dfa4c67d8387bb783dae22aced5f8d9bf3977a8fc80a721033e9700cae9614067de13f2bc56
7
+ data.tar.gz: 1c6c79564734ad3a2c159ad942f68b8156bf10ae404fb45879271a953f54faf257b7d33a939fc41c48ab11a4ed75bce00639f9c162705d86e3b268094a7e819e
@@ -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
- # [gem1, 2],
35
- # [gem2, 1]
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.inject({}) do |summary, (gem, repos)|
39
- summary[gem] = repos.count
40
- summary
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 { |gem, count| count }.reverse
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
@@ -1,3 +1,3 @@
1
1
  module Gigest
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -1,60 +1,60 @@
1
1
  [
2
- ["uglifier", 4],
3
- ["sass-rails", 3],
4
- ["jquery-rails", 3],
5
- ["rails", 3],
6
- ["heroku", 3],
7
- ["rspec-rails", 2],
8
- ["capybara", 2],
9
- ["google_visualr", 2],
10
- ["bourbon", 2],
11
- ["mocha", 2],
12
- ["nokogiri", 2],
13
- ["haml", 2],
14
- ["mysql", 1],
15
- ["rdiscount", 1],
16
- ["sass", 1],
17
- ["jquery-ui-themes", 1],
18
- ["sinatra", 1],
19
- ["thin", 1],
20
- ["ruby-debug", 1],
21
- ["rspec", 1],
22
- ["ibm_db", 1],
23
- ["activerecord-oracle_enhanced-adapter", 1],
24
- ["ruby-oci8", 1],
25
- ["activerecord-jdbcpostgresql-adapter", 1],
26
- ["activerecord-jdbcmysql-adapter", 1],
27
- ["jruby-openssl", 1],
28
- ["activerecord-jdbcsqlite3-adapter", 1],
29
- ["mysql2", 1],
30
- ["foreman", 1],
31
- ["pg", 1],
32
- ["sqlite3", 1],
33
- ["rest-client", 1],
34
- ["yajl-ruby", 1],
35
- ["json", 1],
36
- ["ruby-prof", 1],
37
- ["memcache-client", 1],
38
- ["w3c_validators", 1],
39
- ["RedCloth", 1],
40
- ["sdoc", 1],
41
- ["pivotal_git_scripts", 1],
42
- ["rake", 1],
43
- ["journey", 1],
44
- ["bcrypt-ruby", 1],
45
- ["arel", 1],
46
- ["awesome_print", 1],
47
- ["compass-rails", 1],
48
- ["turn", 1],
49
- ["pry", 1],
50
- ["cactus", 1],
51
- ["webmock", 1],
52
- ["evergreen", 1],
53
- ["ruby-debug19", 1],
54
- ["factory_girl_rails", 1],
55
- ["coffee-rails", 1],
56
- ["timecop", 1],
57
- ["haml-rails", 1],
58
- ["rcov", 1],
59
- ["simplecov", 1]
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) { JSON.parse File.read(File.join(Dir.pwd, "spec", "fixtures", "summary.json")) }
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) { JSON.parse File.read(File.join(Dir.pwd, "spec", "fixtures", "statistics.json")) }
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: 1.0.0
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-27 00:00:00.000000000 Z
11
+ date: 2013-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit