fief 0.0.3 → 0.0.4

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: dd7cfda79ea5621c170b61d14f8199b428edc5ce90616852dcb48922094a493d
4
- data.tar.gz: 7ee986cdc8e252af997416c4ae8a25f82f9fae413334c570d4612a93112d832f
3
+ metadata.gz: 8283e5cbb1075fb17ae4ee598290b94836df887ef58f00f25a369128afd3f469
4
+ data.tar.gz: ed4fe0314ef1b4cc6bd591ad7eec31da037642dac59d5834c11fadd43900098e
5
5
  SHA512:
6
- metadata.gz: 3a265b21ebbe73254a3f1f252237a9524e18dada7ccdf6a77eaa6574d9533e266378bfb7d7287e9e6f85c0a3d6b130eb83101e0be1f86cf11d13423f9f397ea9
7
- data.tar.gz: 1a5db3381cc3bc6d2bf4594c10400b0a32c73b9bd9e2cd039fef934348ac679875ee0f3588a355fa8675fd641447bea2469c986837f1cbb7590dbf6bf68326c0
6
+ metadata.gz: 690bb54a315e20c3519411fabeb34aa0a49948a710e840c4b28c84d857b1148d52e022cf7433e6ab4262ed969c634f3701ede8c03a15761282b0b9ed2cfc54f9
7
+ data.tar.gz: bb116efa704b8e4f8eec845d84649eff42fec4582e93992c07756f6e79460634c3f935e17ccabccaf8772fa47d2cbede16aa461ddbf8f5a868f2565a0abd4a28
@@ -2,7 +2,7 @@
2
2
  name: cron
3
3
  on:
4
4
  schedule:
5
- - cron: "13 */4 * * *"
5
+ - cron: "13 4 * * 1,3,5"
6
6
  concurrency:
7
7
  group: cron
8
8
  cancel-in-progress: true
@@ -16,7 +16,7 @@ jobs:
16
16
  ruby-version: 2.7
17
17
  - run: bundle install
18
18
  - run: |
19
- bin/fief --token ${{ secrets.TOKEN }} --delay 1000 \
19
+ bin/fief --token ${{ secrets.TOKEN }} --delay 1500 \
20
20
  --include jcabi/* \
21
21
  --include yegor256/* \
22
22
  --include sttc/* \
@@ -26,7 +26,9 @@ jobs:
26
26
  --include zold-io/* \
27
27
  --exclude jcabi/.github \
28
28
  --exclude yegor256/quiz \
29
- --excluce yegor256/hangman \
29
+ --exclude yegor256/hangman \
30
+ --exclude objectionary/.github \
31
+ --exclude polystat/.github \
30
32
  --to gh-pages
31
33
  - run: mkdir -p gh-pages/$(date +'%Y/%m/%d')
32
34
  - run: cp gh-pages/index.xml gh-pages/$(date +'%Y/%m/%d')/index.xml
data/Gemfile CHANGED
@@ -25,7 +25,7 @@ gem 'cucumber', '8.0.0', require: false
25
25
  gem 'minitest', '5.15.0', require: false
26
26
  gem 'rake', '13.0.6', require: false
27
27
  gem 'rdoc', '6.5.0', require: false
28
- gem 'rubocop', '1.52.0', require: false
28
+ gem 'rubocop', '1.52.1', require: false
29
29
  gem 'rubocop-rspec', '2.22.0', require: false
30
30
  gem 'simplecov', '0.22.0', require: false
31
31
  gem 'xcop', '0.7.1', require: false
data/assets/index.xsl CHANGED
@@ -110,7 +110,15 @@ SOFTWARE.
110
110
  </thead>
111
111
  <xsl:apply-templates select="fief/repositories"/>
112
112
  <tfoot>
113
- <!-- nothing yet -->
113
+ <tr>
114
+ <td>Total:</td>
115
+ <xsl:for-each select="fief/titles/title">
116
+ <xsl:variable name="title" select="."/>
117
+ <td class="num">
118
+ <xsl:value-of select="sum(//m[@id=$title])"/>
119
+ </td>
120
+ </xsl:for-each>
121
+ </tr>
114
122
  </tfoot>
115
123
  </table>
116
124
  </article>
@@ -131,6 +139,18 @@ SOFTWARE.
131
139
  </xsl:for-each>
132
140
  <xsl:text>.</xsl:text>
133
141
  </p>
142
+ <p>
143
+ <xsl:for-each select="fief/legend/column">
144
+ <xsl:if test="position() &gt; 1">
145
+ <xsl:text>, </xsl:text>
146
+ </xsl:if>
147
+ <xsl:text>"</xsl:text>
148
+ <xsl:value-of select="@title"/>
149
+ <xsl:text>" is </xsl:text>
150
+ <xsl:value-of select="."/>
151
+ </xsl:for-each>
152
+ <xsl:text>.</xsl:text>
153
+ </p>
134
154
  <p>
135
155
  <xsl:text>The page was generated by </xsl:text>
136
156
  <a href="https://github.com/yegor256/fief">
@@ -143,7 +163,7 @@ SOFTWARE.
143
163
  <xsl:text>. </xsl:text>
144
164
  <br/>
145
165
  <xsl:text>It took </xsl:text>
146
- <xsl:variable name="sec" select="round(fief/@msec) div 1000"/>
166
+ <xsl:variable name="sec" select="round(fief/@sec)"/>
147
167
  <xsl:choose>
148
168
  <xsl:when test="$sec &lt; 60">
149
169
  <xsl:value-of select="$sec"/>
data/bin/fief CHANGED
@@ -57,7 +57,7 @@ opts = Slop.parse(args, strict: true, help: true) do |o|
57
57
  o.array '--exclude', 'Mask of GitHub repo to exclude'
58
58
  end
59
59
 
60
- if opts.help? || opts[:include].empty?
60
+ if opts.help?
61
61
  puts opts
62
62
  exit
63
63
  end
@@ -89,6 +89,7 @@ def build_xml(opts, loog)
89
89
  repos = Fief::Repos.new(opts, api, loog).all
90
90
  end
91
91
  data = []
92
+ legend = {}
92
93
  repos.each do |repo|
93
94
  Dir[File.join(__dir__, '../lib/fief/metrics/*.rb')].each do |f|
94
95
  name = File::basename(f).split('.')[0]
@@ -101,18 +102,23 @@ def build_xml(opts, loog)
101
102
  require_relative f
102
103
  m = type.split('::').reduce(Module, :const_get).new(api, repo, opts)
103
104
  if opts.dry?
104
- measures = [{ title: 'Open Pull Requests', value: 42 }, { title: 'Open Issues', value: 42 }]
105
+ measures = [{ title: 'Pulls+', value: 42, legend: 'Open pulls' }, { title: 'Issues', value: 42 }]
105
106
  else
106
107
  measures = m.take(loog)
107
108
  end
109
+ measures.each do |m|
110
+ legend[m[:title]] = m[:legend]
111
+ end
108
112
  if data.find { |d| d[:name] == repo }.nil?
109
113
  data << {name: repo, metrics: []}
110
114
  end
111
115
  data.find { |d| d[:name] == repo }[:metrics] += measures
116
+ loog.info("Read from '#{name}': #{measures.map { |m| "#{m[:title]}=#{m[:value]}" }.join(', ')}")
112
117
  end
113
118
  end
119
+ p data
114
120
  builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
115
- xml.fief(time: Time.now, msec: Time.now - start) do
121
+ xml.fief(time: Time.now, sec: Time.now - start) do
116
122
  xml.titles do
117
123
  data.map { |r| r[:metrics].map { |ms| ms[:title] } }.flatten.uniq.each do |t|
118
124
  xml.title do
@@ -120,6 +126,13 @@ def build_xml(opts, loog)
120
126
  end
121
127
  end
122
128
  end
129
+ xml.legend do
130
+ legend.each do |t, text|
131
+ xml.column(title: t) do
132
+ xml.text text
133
+ end
134
+ end
135
+ end
123
136
  xml.repositories do
124
137
  data.each do |r|
125
138
  xml.repository(id: r[:name]) do
@@ -141,6 +154,7 @@ def build_xml(opts, loog)
141
154
  xml
142
155
  end
143
156
  begin
157
+ raise 'At least one --include is required' if opts[:include].empty?
144
158
  home = File.absolute_path(opts[:to])
145
159
  loog.debug("All files generated will be saved to #{home}")
146
160
  if File.exist?(home)
@@ -39,31 +39,44 @@ class Fief::Issues
39
39
  json.each do |issue|
40
40
  num = issue[:number]
41
41
  data = @api.issue(@repo, num)
42
- if data[:created_at] < Time.now - (60 * 60 * 24 * 28)
42
+ if data[:created_at] < Time.now - (60 * 60 * 24 * old_days)
43
43
  loog.debug("Issue #{@repo}/##{num} is old")
44
44
  old += 1
45
45
  end
46
- if data[:created_at] < Time.now - (60 * 60 * 24 * 112)
46
+ if data[:created_at] < Time.now - (60 * 60 * 24 * older_days)
47
47
  loog.debug("Issue #{@repo}/##{num} is very old")
48
48
  older += 1
49
49
  end
50
50
  end
51
51
  [
52
52
  {
53
- title: 'Open Issues',
53
+ title: 'Issues',
54
54
  value: total,
55
- alert: false
55
+ alert: false,
56
+ legend: 'сurrently unresolved issues'
56
57
  },
57
58
  {
58
- title: 'Old Issues',
59
+ title: 'Issues+',
59
60
  value: old,
60
- alert: older > total * 0.4
61
+ alert: older > total * 0.4,
62
+ legend: "issues unresolved for more than #{old_days} days"
61
63
  },
62
64
  {
63
- title: 'Older Issues',
65
+ title: 'Issues++',
64
66
  value: older,
65
- alert: older > total * 0.4
67
+ alert: older > total * 0.4,
68
+ legend: "issues unresolved for more than #{older_days} days"
66
69
  }
67
70
  ]
68
71
  end
72
+
73
+ private
74
+
75
+ def old_days
76
+ 28
77
+ end
78
+
79
+ def older_days
80
+ 112
81
+ end
69
82
  end
@@ -38,31 +38,44 @@ class Fief::Pulls
38
38
  json.each do |pr|
39
39
  num = pr[:number]
40
40
  data = @api.pull_request(@repo, num)
41
- if data[:created_at] < Time.now - (60 * 60 * 24 * 28)
41
+ if data[:created_at] < Time.now - (60 * 60 * 24 * old_days)
42
42
  loog.debug("PR #{@repo}/##{num} is old")
43
43
  old += 1
44
44
  end
45
- if data[:created_at] < Time.now - (60 * 60 * 24 * 112)
45
+ if data[:created_at] < Time.now - (60 * 60 * 24 * older_days)
46
46
  loog.debug("PR #{@repo}/##{num} is very old")
47
47
  older += 1
48
48
  end
49
49
  end
50
50
  [
51
51
  {
52
- title: 'Open PRs',
52
+ title: 'Pulls',
53
53
  value: total,
54
- alert: false
54
+ alert: false,
55
+ legend: 'currently open pull requests'
55
56
  },
56
57
  {
57
- title: 'Old PRs',
58
+ title: 'Pulls+',
58
59
  value: old,
59
- alert: older > total * 0.4
60
+ alert: older > total * 0.4,
61
+ legend: "pull requests open for more than #{old_days} days"
60
62
  },
61
63
  {
62
- title: 'Older PRs',
64
+ title: 'Pulls++',
63
65
  value: older,
64
- alert: older > total * 0.2
66
+ alert: older > total * 0.2,
67
+ legend: "pull requests open for more than #{older_days} days"
65
68
  }
66
69
  ]
67
70
  end
71
+
72
+ private
73
+
74
+ def old_days
75
+ 28
76
+ end
77
+
78
+ def older_days
79
+ 112
80
+ end
68
81
  end
data/lib/fief/version.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2023 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Fief
26
- VERSION = '0.0.3'.freeze
26
+ VERSION = '0.0.4'.freeze
27
27
  end
@@ -33,7 +33,6 @@ class TestIssues < Minitest::Test
33
33
  m = Fief::Issues.new(api, 'yegor256/fief', {})
34
34
  ms = m.take(Loog::VERBOSE)
35
35
  assert !ms.empty?
36
- p ms
37
36
  rescue Octokit::TooManyRequests => e
38
37
  puts e.message
39
38
  skip
@@ -33,7 +33,6 @@ class TestPulls < Minitest::Test
33
33
  m = Fief::Pulls.new(api, 'yegor256/fief', {})
34
34
  ms = m.take(Loog::VERBOSE)
35
35
  assert !ms.empty?
36
- p ms
37
36
  rescue Octokit::TooManyRequests => e
38
37
  puts e.message
39
38
  skip
@@ -33,7 +33,6 @@ class TestRuns < Minitest::Test
33
33
  m = Fief::Runs.new(api, 'yegor256/debate', {})
34
34
  ms = m.take(Loog::VERBOSE)
35
35
  assert !ms.empty?
36
- p ms
37
36
  rescue Octokit::TooManyRequests => e
38
37
  puts e.message
39
38
  skip
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fief
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
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-05 00:00:00.000000000 Z
11
+ date: 2023-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace