shiftzilla 0.2.26 → 0.2.27

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: cecae2d90020a501778d287e70fa660c766e91c5acb9f14fdffa6a80c86260ed
4
- data.tar.gz: 5c31148722ce6bf81823b23a7188ff9e0779337059c728fa0f3fc1203c02b99a
3
+ metadata.gz: 589ec96b78faea1cff179d940c14be44c291d37c9b743efcac0305de6bfc1b69
4
+ data.tar.gz: a24c4a1a2956a7f8b78e8b68c52f78cec07881cf2aedfd64e59b48ff7cf8080b
5
5
  SHA512:
6
- metadata.gz: d5f74bf58dee2608735e0724402990d207314e7e5009b66acc33caaabe06c8aa8e05dd1fa5a11ee8d0e4308d4c45371b3e54a4dbb73d71d8a65a2307d8baa113
7
- data.tar.gz: 061fc2bc9251a635dd19392e13f68dd2c357fada8c54a543ec4d40320ff1bbea272d12055243a66e7314acd62fe2bde15a094f5f785d402a78064b069c7224b1
6
+ metadata.gz: d793b8af0e96001403bf3d93fcf4433c43efdd87d6120e6d787bc9122cc788f63daa78bad982387b89a46b7a9770fd3971d6a2cca85be34af0ba9f3725d528ed
7
+ data.tar.gz: '0396764eafc9142ebf5cfb793db4fd473d94d6f6c53f38d1cbd5694c2e3b7717a8409b4163970cbdcbd20a762efbf70d47baa8f29cf91683ff62a855f3992ea4'
data/bin/shiftzilla CHANGED
@@ -66,6 +66,7 @@ EOF
66
66
  opt :quiet, "For cron use; don't print anything to STDOUT.", :default => false
67
67
  opt :cfgpath, "Specify a config file for shiftzilla to use.", :default => "#{DEFAULT_DIR}/shiftzilla_cfg.yaml"
68
68
  opt :dbpath, "Specify a database file location for shiftzilla to use.", :default => "#{DEFAULT_DIR}/shiftzilla.sqlite"
69
+ opt :groups, "Enable group aggregation table on main page", :default => false
69
70
  end
70
71
  when 'purge'
71
72
  Optimist::options do
@@ -22,6 +22,7 @@ module Shiftzilla
22
22
  cfg_file['Teams'].each do |team|
23
23
  @teams << Shiftzilla::Team.new(team,group_map)
24
24
  end
25
+ set_group_components
25
26
  cfg_file['Sources'].each do |sid,sinfo|
26
27
  @sources << Shiftzilla::Source.new(sid,sinfo)
27
28
  end
@@ -50,6 +51,10 @@ module Shiftzilla
50
51
  @teams.select{ |t| t.name == tname }[0]
51
52
  end
52
53
 
54
+ def group(gname)
55
+ @groups.select{ |g| g.id == gname[0] }[0]
56
+ end
57
+
53
58
  def add_ad_hoc_team(tinfo)
54
59
  @teams << Shiftzilla::Team.new(tinfo,{},true)
55
60
  end
@@ -95,5 +100,18 @@ module Shiftzilla
95
100
  boundaries
96
101
  end
97
102
  end
103
+
104
+ def set_group_components
105
+ @groups.each do |g|
106
+ components = []
107
+ @teams.each do |t|
108
+ if t.group and (t.group.id == g.id)
109
+ components += t.components
110
+ end
111
+ end
112
+ g.set_components(components)
113
+ end
114
+ end
115
+
98
116
  end
99
117
  end
@@ -113,7 +113,7 @@ module Shiftzilla
113
113
  org_data = Shiftzilla::OrgData.new(shiftzilla_config)
114
114
  org_data.populate_releases
115
115
  org_data.build_series
116
- org_data.generate_reports
116
+ org_data.generate_reports(options[:groups])
117
117
  if options[:local_preview]
118
118
  org_data.show_local_reports
119
119
  else
@@ -1,10 +1,16 @@
1
1
  module Shiftzilla
2
2
  class Group
3
- attr_reader :id, :lead
3
+ attr_reader :name, :id, :lead, :components
4
4
 
5
5
  def initialize(ginfo)
6
- @id = ginfo['id']
7
- @lead = ginfo['lead']
6
+ @name = "Group " + ginfo['id']
7
+ @id = ginfo['id']
8
+ @lead = ginfo['lead']
8
9
  end
10
+
11
+ def set_components(component_list)
12
+ @components ||= component_list
13
+ end
14
+
9
15
  end
10
- end
16
+ end
@@ -249,6 +249,8 @@ module Shiftzilla
249
249
  errors << "Team at index #{list_idx} is missing the 'name' key."
250
250
  elsif not valid_config_string?(team['name'])
251
251
  errors << "Team at index #{list_idx} has a nil or zero-length 'name'."
252
+ elsif team['name'].start_with?("Group")
253
+ errors << "Team at index #{list_idx} begins with the string 'Group'."
252
254
  else
253
255
  tnm = team['name']
254
256
  if seen_tnms.has_key?(tnm)
@@ -13,6 +13,8 @@ module Shiftzilla
13
13
  def initialize(config)
14
14
  @config = config
15
15
  @teams = config.teams
16
+ @groups = config.groups
17
+ @group_teams = []
16
18
  @releases = config.releases
17
19
  @tmp_dir = Shiftzilla::Helpers.tmp_dir
18
20
  @org_data = { '_overall' => Shiftzilla::TeamData.new('_overall',config) }
@@ -62,29 +64,42 @@ module Shiftzilla
62
64
  all_release = @config.release('All')
63
65
 
64
66
  # If this component isn't mapped to a team, stub out a fake team.
65
- tname = comp_map.has_key?(comp) ? comp_map[comp] : "(?) #{comp}"
67
+ tname = team_comp_map.has_key?(comp) ? team_comp_map[comp] : "(?) #{comp}"
66
68
  unless @org_data.has_key?(tname)
67
69
  @config.add_ad_hoc_team({ 'name' => tname, 'components' => [comp] })
68
70
  @org_data[tname] = Shiftzilla::TeamData.new(tname)
69
71
  end
70
72
 
73
+ # Generate TeamData objects for each group
74
+ gname = group_comp_map.has_key?(comp) ? group_comp_map[comp] : nil
75
+ if not gname.nil? and not @org_data.has_key?(gname)
76
+ @org_data[gname] = Shiftzilla::TeamData.new(gname)
77
+ end
78
+
71
79
  team_rdata = tgt_release.nil? ? nil : @org_data[tname].get_release_data(tgt_release)
72
80
  team_adata = @org_data[tname].get_release_data(all_release)
73
81
  over_rdata = tgt_release.nil? ? nil : @org_data['_overall'].get_release_data(tgt_release)
74
82
  over_adata = @org_data['_overall'].get_release_data(all_release)
83
+ unless gname.nil?
84
+ group_rdata = tgt_release.nil? ? nil : @org_data[gname].get_release_data(tgt_release)
85
+ group_adata = @org_data[gname].get_release_data(all_release)
86
+ else
87
+ group_rdata = nil
88
+ group_adata = nil
89
+ end
75
90
 
76
91
  # Do some bean counting
77
- [over_rdata,team_rdata,over_adata,team_adata].each do |group|
78
- next if group.nil?
79
- snapdata = group.get_snapdata(snapshot)
80
- if group.first_snap.nil?
81
- group.first_snap = snapshot
82
- group.first_snapdate = snapdate
92
+ [over_rdata,team_rdata,over_adata,team_adata,group_rdata,group_adata].each do |grouping|
93
+ next if grouping.nil?
94
+ snapdata = grouping.get_snapdata(snapshot)
95
+ if grouping.first_snap.nil?
96
+ grouping.first_snap = snapshot
97
+ grouping.first_snapdate = snapdate
83
98
  end
84
- group.latest_snap = snapshot
85
- group.latest_snapdate = snapdate
99
+ grouping.latest_snap = snapshot
100
+ grouping.latest_snapdate = snapdate
86
101
 
87
- bug = group.add_or_update_bug(bzid,binfo)
102
+ bug = grouping.add_or_update_bug(bzid,binfo)
88
103
 
89
104
  # Add info to the snapshot
90
105
  snapdata.bug_ids << bzid
@@ -131,6 +146,18 @@ module Shiftzilla
131
146
  end
132
147
  end
133
148
  end
149
+
150
+ # Create a "team" for each group here
151
+ @groups.each do |g|
152
+ ginfo = {
153
+ 'name' => g.name,
154
+ 'lead' => g.lead,
155
+ 'group' => g.id,
156
+ 'components' => g.components,
157
+ }
158
+ @group_teams << Shiftzilla::Team.new(ginfo, {g.id => g})
159
+ end
160
+
134
161
  @all_teams = @teams.map{ |t| t.name }.concat(@org_data.keys).uniq
135
162
  @ordered_teams = ['_overall'].concat(@all_teams.select{ |t| t != '_overall'}.sort)
136
163
  end
@@ -159,6 +186,7 @@ module Shiftzilla
159
186
  :tname => tdata.title,
160
187
  :file => tdata.file,
161
188
  :releases => {},
189
+ :is_group => (not @group_teams.detect{|g| g.name == tdata.title}.nil?),
162
190
  }
163
191
 
164
192
  @releases.each do |release|
@@ -182,9 +210,10 @@ module Shiftzilla
182
210
  end
183
211
  end
184
212
 
185
- def generate_reports
213
+ def generate_reports(include_groups)
186
214
  build_time = timestamp
187
215
  all_release = @config.release('All')
216
+
188
217
  @ordered_teams.each do |tname|
189
218
  tinfo = @config.team(tname)
190
219
  tdata = @org_data[tname]
@@ -200,8 +229,17 @@ module Shiftzilla
200
229
  :releases => [],
201
230
  :latest_snapshot => latest_snapshot,
202
231
  :all_bugs => [],
232
+ :include_groups => include_groups,
233
+ :is_group => false,
203
234
  }
204
235
 
236
+ # Check if this is actually a group "team"
237
+ group_match = @group_teams.detect{|g| g.name == tname}
238
+ unless group_match.nil?
239
+ team_pinfo[:tinfo] = group_match
240
+ team_pinfo[:is_group] = true
241
+ end
242
+
205
243
  @releases.each do |release|
206
244
  rname = release.name
207
245
  rdata = tdata.has_release_data?(release) ? tdata.get_release_data(release) : nil
@@ -245,7 +283,7 @@ module Shiftzilla
245
283
  :data => rdata.series[:closed_bugs],
246
284
  },
247
285
  ]),
248
- :blockers => chartify('Test / Ops Blockers',rdata.series[:date],[
286
+ :blockers => chartify('Blockers',rdata.series[:date],[
249
287
  {
250
288
  :label => 'Total',
251
289
  :data => rdata.series[:total_tb],
@@ -270,6 +308,7 @@ module Shiftzilla
270
308
  team_page = haml_engine.render(Object.new,team_pinfo)
271
309
  File.write(File.join(@tmp_dir,tdata.file), team_page)
272
310
  end
311
+
273
312
  # Copy flot library to build area
274
313
  jsdir = File.join(@tmp_dir,'js')
275
314
  Dir.mkdir(jsdir)
@@ -294,18 +333,33 @@ module Shiftzilla
294
333
 
295
334
  private
296
335
 
297
- def comp_map
298
- @comp_map ||= begin
299
- comp_map = {}
336
+ def team_comp_map
337
+ @team_comp_map ||= begin
338
+ team_comp_map = {}
300
339
  @teams.each do |team|
301
340
  team.components.each do |comp|
302
- comp_map[comp] = team.name
341
+ team_comp_map[comp] = team.name
303
342
  end
304
343
  end
305
- comp_map
344
+ team_comp_map
306
345
  end
307
346
  end
308
347
 
348
+ # Creates group component mapping
349
+ def group_comp_map
350
+ @group_comp_map ||= begin
351
+ group_comp_map = {}
352
+ @groups.each do |group|
353
+ group.components.each do |comp|
354
+ group_comp_map[comp] = group.name
355
+ end
356
+ end
357
+ group_comp_map
358
+ end
359
+ end
360
+
361
+
362
+
309
363
  def chartify(title,dates,series)
310
364
  modulo = label_modulo(dates.length)
311
365
  tlist = []
@@ -349,4 +403,4 @@ module Shiftzilla
349
403
  end
350
404
  end
351
405
  end
352
- end
406
+ end
@@ -1,3 +1,3 @@
1
1
  module Shiftzilla
2
- VERSION = "0.2.26"
2
+ VERSION = "0.2.27"
3
3
  end
data/template.haml CHANGED
@@ -45,7 +45,8 @@
45
45
  - if tname != '_overall' and not tinfo.nil? and not tinfo.ad_hoc?
46
46
  %h5 Team Info
47
47
  %ul
48
- %li= "Team Lead: #{tinfo.lead}"
48
+ - unless is_group
49
+ %li= "Team Lead: #{tinfo.lead}"
49
50
  - if not tinfo.group.nil? and not tinfo.group.lead.nil?
50
51
  %li= "Group Lead: #{tinfo.group.lead}"
51
52
  - if tinfo.components.length > 0
@@ -69,7 +70,7 @@
69
70
  - releases.each do |r|
70
71
  %td.text-right= r[:bug_avg_age]
71
72
  %tr
72
- %td Avg. Test Blocker Age
73
+ %td Avg. Blocker Age
73
74
  - releases.each do |r|
74
75
  %td.text-right= r[:tb_avg_age]
75
76
  %tr
@@ -81,7 +82,7 @@
81
82
  - releases.each do |r|
82
83
  %td.text-right= r[:snapdata].closed_bugs
83
84
  %tr
84
- %td Test / Ops Blockers
85
+ %td Blockers
85
86
  - releases.each do |r|
86
87
  %td.text-right= r[:snapdata].total_tb
87
88
  %tr
@@ -92,6 +93,26 @@
92
93
  %td Closed Blockers Yesterday
93
94
  - releases.each do |r|
94
95
  %td.text-right= r[:snapdata].closed_tb
96
+
97
+ - if tname == '_overall' and include_groups
98
+ %h5 Totals By Group
99
+ %table.table.table-hover.table-sm
100
+ %tr
101
+ %td Group
102
+ - releases.each do |r|
103
+ %td.text-right= r[:release].name
104
+ - team_files.each do |tm|
105
+ - unless tm[:is_group]
106
+ - next
107
+ %tr
108
+ %td
109
+ - if tm[:tname] == tdisp
110
+ = tdisp
111
+ - else
112
+ %a{ :href => tm[:file] }= tm[:tname]
113
+ - releases.each do |r|
114
+ %td.text-right= tm[:releases][r[:release].name]
115
+
95
116
  - if tname == '_overall'
96
117
  %h5 Totals By Team
97
118
  %table.table.table-hover.table-sm
@@ -100,6 +121,8 @@
100
121
  - releases.each do |r|
101
122
  %td.text-right= r[:release].name
102
123
  - team_files.each do |tm|
124
+ - if tm[:is_group]
125
+ - next
103
126
  %tr
104
127
  %td
105
128
  - if tm[:tname] == tdisp
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.26
4
+ version: 0.2.27
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-19 00:00:00.000000000 Z
11
+ date: 2019-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler