cobench 0.0.3 → 0.0.6

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
  SHA256:
3
- metadata.gz: 6f3a1a6856a67aa8c46b3bf47c2b19abd991c4562c58dcbc5bd5b86c464604d3
4
- data.tar.gz: '069ac173f4ae3ed224648588e4d70f730d7f8cf37a6068556624cc83b7cc8a2b'
3
+ metadata.gz: c86ef1d63046d93343152ea0cebea85bd7ff9bd985b2147d8a7320d0a6485980
4
+ data.tar.gz: ef148324cf9faddaa324ecca18629b030f0a29a2c40224005fb5fadd2e49bcca
5
5
  SHA512:
6
- metadata.gz: a59d4d61f23d7841ce61fc34286e29c7eb9db272f8e75529fd8bbc8c997b6cf587f710e6d5914d0883a7bfa498ae9fa0a1f8eb04fd029e112d5108968726ad2b
7
- data.tar.gz: 7fd0c617e5f8ba1ee4d375a14bd4d771e209c7dd3986558916e232397bdd67602360ee2eadc5aa2663fe51c01fc53594770aabbd5f0fe4437bfd56934cf205b7
6
+ metadata.gz: '0229a62e2c9748230de2d0123d16cdf8a25da67f1cdefcd60648df8a15235a84f2a903de9ac1203ecfc1da7fea494105c2f067da93d35b8cb3d73d05c0d2b255'
7
+ data.tar.gz: 85592eeded980ef5b7728ccf79adabe9a85e46333f4cb16b10c864cc3e8a668a3e6c09848b91d6e26e0084d4fb1374ec41188df6c7fd2916ed35d104d13316f9
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>
data/bin/cobench CHANGED
@@ -27,6 +27,7 @@ require 'octokit'
27
27
  require 'nokogiri'
28
28
  require 'backtrace'
29
29
  require 'fileutils'
30
+ require 'obk'
30
31
  require_relative '../lib/cobench/version'
31
32
 
32
33
  loog = Loog::REGULAR
@@ -89,6 +90,7 @@ begin
89
90
  loog.warn("Connecting to GitHub without a token, this may lead to errors, use --token")
90
91
  end
91
92
  api.auto_paginate = true
93
+ api = Obk.new(api, pause: 2000)
92
94
  opts[:coder].each do |u|
93
95
  loog.info("Scanning #{u}...")
94
96
  data[u] = {}
data/cobench.gemspec CHANGED
@@ -44,6 +44,7 @@ Gem::Specification.new do |s|
44
44
  s.add_runtime_dependency 'iri', '~>0.5'
45
45
  s.add_runtime_dependency 'loog', '~>0.2'
46
46
  s.add_runtime_dependency 'nokogiri', '~>1.10'
47
+ s.add_runtime_dependency 'obk', '0.3.0'
47
48
  s.add_runtime_dependency 'octokit', '~>4.0'
48
49
  s.add_runtime_dependency 'rainbow', '~>3.0'
49
50
  s.add_runtime_dependency 'slop', '~>4.4'
@@ -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.6'.freeze
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-09 00:00:00.000000000 Z
11
+ date: 2022-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: obk
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.3.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.3.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: octokit
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -237,6 +251,7 @@ files:
237
251
  - features/step_definitions/steps.rb
238
252
  - features/support/env.rb
239
253
  - lib/cobench/mask.rb
254
+ - lib/cobench/metrics/issues.rb
240
255
  - lib/cobench/metrics/pulls.rb
241
256
  - lib/cobench/version.rb
242
257
  - logo.svg