gigest 3.1.0 → 3.2.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 +10 -10
- data/lib/gigest/version.rb +1 -1
- data/spec/gigest/analytics_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 867fe3f7ede61b0db226f3f6d517f72eb29b0e16
|
4
|
+
data.tar.gz: a8106c53c5c6e29de80a3645e0a23611184acb0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e832cf9056408fccd3e3516f3bbd9ebd988624c7440987f338b0fde071b520b4b5f4ea44cd6cb8ad10d36680af867fcb935fd93f2026fbf535a3239290e3d8f3
|
7
|
+
data.tar.gz: 1c3e6347fda934799f5f15fc7a262dba484198c4c510dec88aff1db9a8445cbb8b120598692b4594824d46d967431c0df153140f9fdb2097f6a18249b7708656
|
data/lib/gigest/analytics.rb
CHANGED
@@ -15,16 +15,16 @@ module Gigest
|
|
15
15
|
@repositories = @connection.repositories_for(account)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def all_repositories
|
19
19
|
@repositories
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
|
22
|
+
def all_repositories_with_gemfile
|
23
|
+
all_repositories.select(&:has_gemfile?)
|
24
24
|
end
|
25
25
|
|
26
26
|
def source_repositories
|
27
|
-
|
27
|
+
all_repositories.reject(&:fork?)
|
28
28
|
end
|
29
29
|
|
30
30
|
def source_repositories_with_gemfile
|
@@ -32,7 +32,7 @@ module Gigest
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def fork_repositories
|
35
|
-
|
35
|
+
all_repositories.select(&:fork?)
|
36
36
|
end
|
37
37
|
|
38
38
|
def fork_repositories_with_gemfile
|
@@ -45,8 +45,8 @@ module Gigest
|
|
45
45
|
# gem1: [repo1, repo2],
|
46
46
|
# gem2: [repo1, repo2]
|
47
47
|
# }
|
48
|
-
def summary(type
|
49
|
-
raise "Please specify GitHub account to analyse by invoking #process_for(account) method first!" if
|
48
|
+
def summary(type=:all)
|
49
|
+
raise "Please specify GitHub account to analyse by invoking #process_for(account) method first!" if all_repositories.nil?
|
50
50
|
|
51
51
|
get_repositories(type).reduce({}) do |summary, repository|
|
52
52
|
repository.gems.each do |gem|
|
@@ -63,8 +63,8 @@ module Gigest
|
|
63
63
|
# {gem_name: gem1, repositories: ["repo1", "repo2"], count: 2, percentage: 100.0},
|
64
64
|
# {gem_name: gem2, repositories: ["repo1"], count: 1, percentage: 50.0}
|
65
65
|
# ]
|
66
|
-
def statistics(type
|
67
|
-
raise "Please specify GitHub account to analyse by invoking #process_for(account) method first!" if
|
66
|
+
def statistics(type=:all)
|
67
|
+
raise "Please specify GitHub account to analyse by invoking #process_for(account) method first!" if all_repositories.nil?
|
68
68
|
|
69
69
|
repos_summary = summary(type)
|
70
70
|
repo_type_count = get_repositories(type).count
|
@@ -83,7 +83,7 @@ module Gigest
|
|
83
83
|
private
|
84
84
|
|
85
85
|
def get_repositories(type)
|
86
|
-
|
86
|
+
send("#{type}_repositories_with_gemfile")
|
87
87
|
end
|
88
88
|
|
89
89
|
def percentage(numerator, denominator)
|
data/lib/gigest/version.rb
CHANGED
@@ -39,11 +39,11 @@ describe Gigest::Analytics do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "inits repositories" do
|
42
|
-
expect(analytics.
|
42
|
+
expect(analytics.all_repositories).to eq(repositories)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "inits repositories_with_gemfile" do
|
46
|
-
expect(analytics.
|
46
|
+
expect(analytics.all_repositories_with_gemfile).to eq(expected)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -53,7 +53,7 @@ describe Gigest::Analytics do
|
|
53
53
|
let(:repo1) { double(:repo1, fork?: false) }
|
54
54
|
let(:repo2) { double(:repo2, fork?: true) }
|
55
55
|
|
56
|
-
before { analytics.stub(:
|
56
|
+
before { analytics.stub(:all_repositories) { repositories } }
|
57
57
|
|
58
58
|
it { expect(analytics.source_repositories).to eq expected }
|
59
59
|
end
|
@@ -75,7 +75,7 @@ describe Gigest::Analytics do
|
|
75
75
|
let(:repo1) { double(:repo1, fork?: false) }
|
76
76
|
let(:repo2) { double(:repo2, fork?: true) }
|
77
77
|
|
78
|
-
before { analytics.stub(:
|
78
|
+
before { analytics.stub(:all_repositories) { repositories } }
|
79
79
|
|
80
80
|
it { expect(analytics.fork_repositories).to eq expected }
|
81
81
|
end
|