shiftzilla 0.2.27 → 0.2.28

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: 589ec96b78faea1cff179d940c14be44c291d37c9b743efcac0305de6bfc1b69
4
- data.tar.gz: a24c4a1a2956a7f8b78e8b68c52f78cec07881cf2aedfd64e59b48ff7cf8080b
3
+ metadata.gz: 56f266589322ef96d40237c0e55372228faf4e228196aa27c75f7982041e234f
4
+ data.tar.gz: 3dff610f59c918d39dc3ccdca5b4f3261c66c4ff1f31dfa3595a156882a22b06
5
5
  SHA512:
6
- metadata.gz: d793b8af0e96001403bf3d93fcf4433c43efdd87d6120e6d787bc9122cc788f63daa78bad982387b89a46b7a9770fd3971d6a2cca85be34af0ba9f3725d528ed
7
- data.tar.gz: '0396764eafc9142ebf5cfb793db4fd473d94d6f6c53f38d1cbd5694c2e3b7717a8409b4163970cbdcbd20a762efbf70d47baa8f29cf91683ff62a855f3992ea4'
6
+ metadata.gz: 39951d877c9e252396229c0f9cd08ecfdc72aaf1045393a2b4b96faac9065bcf7b21db8d41d2adae36a9c945d5cb5cff5e0c8744a8f592bd6e46dad161f3a96a
7
+ data.tar.gz: a4241ab5f9b78cec206b8b758a57b2c33bbf1bd5f03ea70e85cc6463a656d1f628d52f1be93b4c25545ddfc601e9b3ab07980701349f4067f1a823ad0fe0fcdb
@@ -331,10 +331,14 @@ module Shiftzilla
331
331
  if not milestones.has_key?(ms)
332
332
  errors << "Release at index #{list_idx} is missing the '#{ms}' milestone."
333
333
  else
334
+ if milestones[ms] == 'today' or !!(milestones[ms] =~ /today[+-]\d+[dwms]/)
335
+ # Matches the variable date format
336
+ next
337
+ end
334
338
  ms_date = milestones[ms].split('-')
335
339
  if ms_date.length == 3 and ms_date[0].length == 4 and ms_date[1].length == 2 and ms_date[2].length == 2
336
340
  else
337
- errors << "Release at index #{list_idx}: milestone '#{ms}' is not formatted correctly (YYYY-MM-DD)."
341
+ errors << "Release at index #{list_idx}: milestone '#{ms}' is not formatted correctly - (YYYY-MM-DD) or (today[+-]X[dwms])."
338
342
  end
339
343
  end
340
344
  end
@@ -1,9 +1,14 @@
1
+ require 'date'
2
+
1
3
  module Shiftzilla
2
4
  class Milestone
3
5
  def initialize(mtxt)
4
6
  @date = nil
5
7
  @stamp = ''
6
- unless (mtxt.nil? or mtxt == '')
8
+ if mtxt.start_with?('today')
9
+ @date = variable_date(mtxt)
10
+ @stamp = @date.strftime('%Y-%m-%d')
11
+ elsif not (mtxt.nil? or mtxt == '')
7
12
  @date = Date.parse(mtxt)
8
13
  @stamp = mtxt
9
14
  end
@@ -16,5 +21,42 @@ module Shiftzilla
16
21
  def stamp
17
22
  @stamp
18
23
  end
24
+
25
+ private
26
+
27
+ def variable_date(d)
28
+ # Takes a variable date string and returns the appropriate date object
29
+ # Variable dates of the form today[+,-]#[d,w,m,s]
30
+ today = Date.today
31
+
32
+ if d.length < 8
33
+ return today
34
+ end
35
+
36
+ operation = d[5]
37
+ val = d[6..-2].to_i
38
+ unit = d[-1]
39
+ days = 0
40
+
41
+ # Convert to days for simple addition
42
+ case unit
43
+ when 'd'
44
+ days = val
45
+ when 'w'
46
+ days = 7*val
47
+ when 'm'
48
+ days = 30*val
49
+ when 's' # Sprints
50
+ days = 21*val
51
+ else
52
+ days = val
53
+ end
54
+
55
+ if operation == '-'
56
+ days = days * -1
57
+ end
58
+
59
+ return today+days
60
+ end
19
61
  end
20
62
  end
@@ -1,5 +1,6 @@
1
1
  require 'fileutils'
2
2
  require 'json'
3
+ require 'uri'
3
4
  require 'shiftzilla/bug'
4
5
  require 'shiftzilla/helpers'
5
6
  require 'shiftzilla/team_data'
@@ -40,7 +41,7 @@ module Shiftzilla
40
41
 
41
42
  # TODO: REMOVE BUSINESS LOGIC EMBEDDED IN CODE
42
43
  if comp == 'Security' and keyw.include?('Unconfirmed')
43
- puts "NB: This report has a hardcoded exclusion of 'Security' component bugs with the 'Unconfirmed' keyword."
44
+ # This report has a hardcoded exclusion of 'Security' component bugs with the 'Unconfirmed' keyword."
44
45
  next
45
46
  end
46
47
 
@@ -213,6 +214,7 @@ module Shiftzilla
213
214
  def generate_reports(include_groups)
214
215
  build_time = timestamp
215
216
  all_release = @config.release('All')
217
+ redirects = {}
216
218
 
217
219
  @ordered_teams.each do |tname|
218
220
  tinfo = @config.team(tname)
@@ -235,9 +237,14 @@ module Shiftzilla
235
237
 
236
238
  # Check if this is actually a group "team"
237
239
  group_match = @group_teams.detect{|g| g.name == tname}
238
- unless group_match.nil?
240
+ if not group_match.nil?
239
241
  team_pinfo[:tinfo] = group_match
240
242
  team_pinfo[:is_group] = true
243
+ elsif not tinfo.nil?
244
+ # Generate component -> team redirects
245
+ tinfo.components.each do |component|
246
+ redirects[component] = tdata.file
247
+ end
241
248
  end
242
249
 
243
250
  @releases.each do |release|
@@ -309,6 +316,23 @@ module Shiftzilla
309
316
  File.write(File.join(@tmp_dir,tdata.file), team_page)
310
317
  end
311
318
 
319
+ # Create component->team redirects
320
+ redirects.each do |component, team_file|
321
+ redirect_html = <<-HTML
322
+ <!DOCTYPE html>
323
+ <html>
324
+ <head>
325
+ <meta http-equiv="Refresh" content="0; url=#{team_file}" />
326
+ </head>
327
+ <body>
328
+ <p>Redirecting to <a href="#{team_file}">team page</a>...</p>
329
+ </body>
330
+ </html>
331
+ HTML
332
+ File.write(File.join(@tmp_dir, "component_#{component}.html"), redirect_html)
333
+ end
334
+
335
+
312
336
  # Copy flot library to build area
313
337
  jsdir = File.join(@tmp_dir,'js')
314
338
  Dir.mkdir(jsdir)
@@ -1,3 +1,3 @@
1
1
  module Shiftzilla
2
- VERSION = "0.2.27"
2
+ VERSION = "0.2.28"
3
3
  end
data/template.haml CHANGED
@@ -50,7 +50,7 @@
50
50
  - if not tinfo.group.nil? and not tinfo.group.lead.nil?
51
51
  %li= "Group Lead: #{tinfo.group.lead}"
52
52
  - if tinfo.components.length > 0
53
- %li= "BZ Component(s): #{tinfo.components.join(', ')}"
53
+ %li= "BZ Component(s): " + tinfo.components.map{ |c| "<a href='component_#{c}.html'>#{c}</a>"}.join(', ')
54
54
  %h5= "#{tdisp} Summary"
55
55
  %table.table.table-hover.table-sm
56
56
  %tr
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiftzilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.27
4
+ version: 0.2.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - N. Harrison Ripps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-28 00:00:00.000000000 Z
11
+ date: 2020-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  - !ruby/object:Gem::Version
205
205
  version: '0'
206
206
  requirements: []
207
- rubygems_version: 3.0.1
207
+ rubygems_version: 3.0.3
208
208
  signing_key:
209
209
  specification_version: 4
210
210
  summary: Shiftzilla is a tool for providing historical reports based on Bugzilla data