cobench 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f3a1a6856a67aa8c46b3bf47c2b19abd991c4562c58dcbc5bd5b86c464604d3
4
- data.tar.gz: '069ac173f4ae3ed224648588e4d70f730d7f8cf37a6068556624cc83b7cc8a2b'
3
+ metadata.gz: 03f64d2bab112d3e2663ce29f626720973a29b8441004e786e2f8f99c641d7ce
4
+ data.tar.gz: 5174681a991740e8502d65b5c5ae25b1f8371390e0ce0eb381968f6424a8616e
5
5
  SHA512:
6
- metadata.gz: a59d4d61f23d7841ce61fc34286e29c7eb9db272f8e75529fd8bbc8c997b6cf587f710e6d5914d0883a7bfa498ae9fa0a1f8eb04fd029e112d5108968726ad2b
7
- data.tar.gz: 7fd0c617e5f8ba1ee4d375a14bd4d771e209c7dd3986558916e232397bdd67602360ee2eadc5aa2663fe51c01fc53594770aabbd5f0fe4437bfd56934cf205b7
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
- <xsl:apply-templates select="cobench/coders"/>
48
- <p>
49
- <xsl:text>The page was generated by on </xsl:text>
50
- <a href="https://github.com/yegor256/cobench">
51
- <xsl:text>cobench</xsl:text>
52
- </a>
53
- <xsl:text> on </xsl:text>
54
- <xsl:value-of select="cobench/@time"/>
55
- <xsl:text>. The numbers you see reflect the activity of the last </xsl:text>
56
- <b>
57
- <xsl:value-of select="cobench/@days"/>
58
- <xsl:text> days</xsl:text>
59
- </b>
60
- <xsl:text>.</xsl:text>
61
- </p>
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>
@@ -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
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2022 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Cobench
26
- VERSION = '0.0.3'.freeze
26
+ VERSION = '0.0.4'.freeze
27
27
  end
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.3
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