cobench 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cobench +7 -6
- data/lib/cobench/mask.rb +2 -2
- data/lib/cobench/version.rb +1 -1
- data/test/test_mask.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a36f769e2bd7c22261752671935908e1e9776228406eab462a80e14ec47f5888
|
4
|
+
data.tar.gz: 528467b0d08b48aa958d2bc5eb5d075322f55af081834982a2fc06c02e5c0919
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce12d12d53b6cda30c247125455e7b5b7f9cd256a05df04a99e9871606e6a862436ac802057848068c5d9cd88165baa326d79ebbaee8b1455c124f96e2cbe6fd
|
7
|
+
data.tar.gz: '059a36cb0f76dbfa525a87ac56b38cd1816eedeabeb89389cdd5048ba2ac1d35488655b0adfc7dd01bc4b86abfa78ab55fea4b54a7794db8150b4804eb5fc868'
|
data/bin/cobench
CHANGED
@@ -56,7 +56,7 @@ opts = Slop.parse(args, strict: true, help: true) do |o|
|
|
56
56
|
o.array '--exclude', 'Mask of GitHub repo to exclude'
|
57
57
|
end
|
58
58
|
|
59
|
-
if opts.help?
|
59
|
+
if opts.help? || opts[:coder].empty?
|
60
60
|
puts opts
|
61
61
|
exit
|
62
62
|
end
|
@@ -95,16 +95,17 @@ begin
|
|
95
95
|
loog.info("Reading GitHub data for the last #{opts[:days]} days")
|
96
96
|
titles = {}
|
97
97
|
opts[:coder].each do |u|
|
98
|
-
|
99
|
-
|
98
|
+
user = u.downcase
|
99
|
+
loog.info("Scanning #{user}...")
|
100
|
+
data[user] = {}
|
100
101
|
Dir[File.join(__dir__, '../lib/cobench/metrics/*.rb')].each do |f|
|
101
102
|
name = File::basename(f).split('.')[0]
|
102
103
|
if !opts[:metrics].empty? && !opts[:metrics].include?(name)
|
103
|
-
loog.info("Ignoring #{
|
104
|
+
loog.info("Ignoring #{user}/#{name} due to --metrics")
|
104
105
|
next
|
105
106
|
end
|
106
107
|
type = "Cobench::#{name.capitalize}"
|
107
|
-
loog.info("Reading #{
|
108
|
+
loog.info("Reading #{user}/#{name}...")
|
108
109
|
require_relative f
|
109
110
|
m = type.split('::').reduce(Module, :const_get).new(api, u, opts)
|
110
111
|
if opts.dry?
|
@@ -122,7 +123,7 @@ begin
|
|
122
123
|
before += data[u][d[:title]][:total] if data[u][d[:title]] != nil
|
123
124
|
data[u][d[:title]] = { total: d[:total] + before, href: d[:href] }
|
124
125
|
titles[d[:title]] = d[:title]
|
125
|
-
loog.info("The value of #{
|
126
|
+
loog.info("The value of #{user}/#{d[:title]} is #{d[:total]}")
|
126
127
|
end
|
127
128
|
end
|
128
129
|
end
|
data/lib/cobench/mask.rb
CHANGED
@@ -24,11 +24,11 @@
|
|
24
24
|
# License:: MIT
|
25
25
|
class Cobench::Mask
|
26
26
|
def initialize(txt)
|
27
|
-
@org, @repo = txt.split('/')
|
27
|
+
@org, @repo = txt.downcase.split('/')
|
28
28
|
end
|
29
29
|
|
30
30
|
def matches?(repo)
|
31
|
-
org, repo = repo.split('/')
|
31
|
+
org, repo = repo.downcase.split('/')
|
32
32
|
return false if ['', nil].include?(org)
|
33
33
|
return false if ['', nil].include?(repo)
|
34
34
|
return false if org != @org && @org != '*'
|
data/lib/cobench/version.rb
CHANGED
data/test/test_mask.rb
CHANGED
@@ -28,8 +28,8 @@ require_relative '../lib/cobench/mask'
|
|
28
28
|
class TestMask < Minitest::Test
|
29
29
|
def test_positive
|
30
30
|
assert Cobench::Mask.new('*/*').matches?('foo/bar')
|
31
|
-
assert Cobench::Mask.new('test/*').matches?('
|
32
|
-
assert Cobench::Mask.new('test/hello').matches?('test/
|
31
|
+
assert Cobench::Mask.new('test/*').matches?('Test/one')
|
32
|
+
assert Cobench::Mask.new('test/hello').matches?('test/Hello')
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_negative
|