cobench 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/index.xsl +38 -16
- data/bin/cobench +2 -2
- data/features/cli.feature +1 -1
- data/lib/cobench/metrics/issues.rb +54 -0
- data/lib/cobench/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03f64d2bab112d3e2663ce29f626720973a29b8441004e786e2f8f99c641d7ce
|
4
|
+
data.tar.gz: 5174681a991740e8502d65b5c5ae25b1f8371390e0ce0eb381968f6424a8616e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e685a2a0d1a9a58a06976ebb2df9bbf0a29a5e93a06c1b057f64b4b067c7a4a2d73b9fa9d8cdef6246ee829efbcc70fafc7febc5177e6e12cd04a5b5ea89d0b
|
7
|
+
data.tar.gz: 51b84eb3a9436a79836a580c1579cb49cebc01062ab305fabe30c261ff0ca28324f26b84df3c39fc33859e3fb7f2f2eac8e20693fcfac379facd27d669adbbe4
|
data/assets/index.xsl
CHANGED
@@ -42,23 +42,45 @@ SOFTWARE.
|
|
42
42
|
$("#metrics").tablesorter();
|
43
43
|
});
|
44
44
|
</script>
|
45
|
+
<style>
|
46
|
+
td, th { text-align: right; font-family: monospace; font-size: 18px; }
|
47
|
+
.left { border-bottom: 0; }
|
48
|
+
header { text-align: center; }
|
49
|
+
footer { text-align: center; font-size: 0.8em; }
|
50
|
+
article { width: 60em; border: 0; }
|
51
|
+
.sorter { cursor: pointer; }
|
52
|
+
</style>
|
45
53
|
</head>
|
46
54
|
<body>
|
47
|
-
<
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
</
|
53
|
-
<
|
54
|
-
|
55
|
-
|
56
|
-
<
|
57
|
-
<
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
55
|
+
<section>
|
56
|
+
<header>
|
57
|
+
<p>
|
58
|
+
<img src="https://raw.githubusercontent.com/yegor256/cobench/master/logo.svg" style="width:64px"/>
|
59
|
+
</p>
|
60
|
+
</header>
|
61
|
+
<article>
|
62
|
+
<xsl:apply-templates select="cobench/coders"/>
|
63
|
+
</article>
|
64
|
+
<footer>
|
65
|
+
<p>
|
66
|
+
<xsl:text>The page was generated by </xsl:text>
|
67
|
+
<a href="https://github.com/yegor256/cobench">
|
68
|
+
<xsl:text>cobench</xsl:text>
|
69
|
+
</a>
|
70
|
+
<xsl:text> on </xsl:text>
|
71
|
+
<xsl:value-of select="cobench/@time"/>
|
72
|
+
<xsl:text>.</xsl:text>
|
73
|
+
</p>
|
74
|
+
<p>
|
75
|
+
<xsl:text>The numbers you see reflect the activity of the last </xsl:text>
|
76
|
+
<b>
|
77
|
+
<xsl:value-of select="cobench/@days"/>
|
78
|
+
<xsl:text> days</xsl:text>
|
79
|
+
</b>
|
80
|
+
<xsl:text>.</xsl:text>
|
81
|
+
</p>
|
82
|
+
</footer>
|
83
|
+
</section>
|
62
84
|
</body>
|
63
85
|
</html>
|
64
86
|
</xsl:template>
|
@@ -68,7 +90,7 @@ SOFTWARE.
|
|
68
90
|
<tr>
|
69
91
|
<th/>
|
70
92
|
<xsl:for-each select="coder/metrics/m[generate-id() = generate-id(key('metrics', @id)[1])]">
|
71
|
-
<th>
|
93
|
+
<th class="sorter">
|
72
94
|
<xsl:value-of select="@id"/>
|
73
95
|
</th>
|
74
96
|
</xsl:for-each>
|
data/bin/cobench
CHANGED
@@ -47,8 +47,8 @@ opts = Slop.parse(args, strict: true, help: true) do |o|
|
|
47
47
|
o.bool '--verbose', 'Print as much log messages as possible'
|
48
48
|
o.bool '--dry', 'Make no real round trips to GitHub'
|
49
49
|
o.integer '--days', 'How many days to measure', default: 7
|
50
|
-
o.
|
51
|
-
o.
|
50
|
+
o.string '--to', 'Directory where to save all files to', default: './cobench'
|
51
|
+
o.string '--token', 'GitHub authentication token'
|
52
52
|
o.array '--coder', 'GitHub nickname of a coder to track'
|
53
53
|
o.array '--include', 'Mask of GitHub repo to include, e.g. yegor256/*'
|
54
54
|
o.array '--exclude', 'Mask of GitHub repo to exclude'
|
data/features/cli.feature
CHANGED
@@ -11,7 +11,7 @@ Feature: Simple Reporting
|
|
11
11
|
Then Exit code is zero
|
12
12
|
|
13
13
|
Scenario: Simple report
|
14
|
-
When I run bin/cobench with "--coder yegor256 --verbose --dry"
|
14
|
+
When I run bin/cobench with "--coder yegor256 --verbose --dry --to foo"
|
15
15
|
Then Stdout contains "XML saved to"
|
16
16
|
And Exit code is zero
|
17
17
|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (c) 2022 Yegor Bugayenko
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
require 'iri'
|
22
|
+
require_relative '../mask'
|
23
|
+
|
24
|
+
# Issues in GitHub API.
|
25
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
26
|
+
# Copyright:: Copyright (c) 2022 Yegor Bugayenko
|
27
|
+
# License:: MIT
|
28
|
+
class Cobench::Issues
|
29
|
+
def initialize(api, user, opts)
|
30
|
+
@api = api
|
31
|
+
@user = user
|
32
|
+
@opts = opts
|
33
|
+
end
|
34
|
+
|
35
|
+
def take(loog)
|
36
|
+
from = (Time.now - (60 * 60 * 24 * @opts[:days])).strftime('%Y-%m-%d')
|
37
|
+
q = "#{@user} in:comments type:issue author:#{@user} created:>#{from}"
|
38
|
+
json = @api.search_issues(q)
|
39
|
+
total = json.items.count do |p|
|
40
|
+
pr = p.url.split('/')[-1]
|
41
|
+
repo = p.repository_url.split('/')[-2..-1].join('/')
|
42
|
+
if @opts[:include].none? { |m| Cobench::Mask.new(m).matches?(repo) }
|
43
|
+
loog.debug("Excluding #{repo}##{pr} due to lack of --include")
|
44
|
+
next
|
45
|
+
end
|
46
|
+
if @opts[:exclude].any? { |m| Cobench::Mask.new(m).matches?(repo) }
|
47
|
+
loog.debug("Excluding #{repo}##{pr} due to --exclude")
|
48
|
+
next
|
49
|
+
end
|
50
|
+
loog.debug("Including #{repo}#{pr}")
|
51
|
+
end
|
52
|
+
[total, Iri.new('https://github.com/search').add(q: q)]
|
53
|
+
end
|
54
|
+
end
|
data/lib/cobench/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobench
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
@@ -237,6 +237,7 @@ files:
|
|
237
237
|
- features/step_definitions/steps.rb
|
238
238
|
- features/support/env.rb
|
239
239
|
- lib/cobench/mask.rb
|
240
|
+
- lib/cobench/metrics/issues.rb
|
240
241
|
- lib/cobench/metrics/pulls.rb
|
241
242
|
- lib/cobench/version.rb
|
242
243
|
- logo.svg
|