-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathversionone.rb
59 lines (57 loc) · 2.29 KB
/
versionone.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def versiononeformat(board, filenamestub="productbacklogbackup", includecomments=true)
lists = board.lists
filename = "transform/#{DateTime.now.strftime "%Y%m%dT%H%M"}_#{filenamestub}.xslx"
puts filename
SimpleXlsx::Serializer.new(filename) do |doc|
doc.add_sheet("Backlog Items") do |sheet|
sheet.add_row(%w{AssetType Name Scope Description Estimate Priority})
lists.each do |list|
puts list.name
cards = list.cards
if (list.name != "Done") && (list.name != "Ready for Final QA")
regex = /\[BUG\]/
estimate_regex = /\((\w*)\)/
cards.each do |card|
puts "#{card.name.match regex} Exporting card: #{card.name}"
assettype = (card.name.match regex) ? "Defect" : "Story"
estimate = (card.name =~ estimate_regex) ? $1 : ""
sheet.add_row([assettype, card.name, "Engineering", card.description, estimate, ""])
end
end
end
end
end
end
def rallyformat(board, filenamestub="productbacklogbackup", includecomments=true)
lists = board.lists
filename = "transform/#{DateTime.now.strftime "%Y%m%dT%H%M"}_#{filenamestub}.xslx"
SimpleXlsx::Serializer.new(filename) do |doc|
doc.add_sheet("Backlog Items") do |sheet|
sheet.add_row(%w{Display Ready Name Description Notes Owner Schedule State Estimate Blocked})
lists.each do |list|
puts list.name
cards = list.cards
if (list.name != "Done") && (list.name != "Ready for Final QA")
regex = /\[BUG\]/
estimate_regex = /\((\w*)\)/
cards.each do |card|
puts card.name
if includecomments
actions = card.actions
commentslist = ""
actions.each do |action|
if action.type=="commentCard"
commentslist += "#{Member.find(action.member_creator_id).full_name} says: #{action.data['text']} \n\n"
end
end
end
assettype = (card.name.match regex) ? "Defect" : "Story"
color = ""
estimate = (card.name =~ estimate_regex) ? $1 : ""
sheet.add_row([color, "FALSE", card.name, card.description, commentslist, "[email protected]", "", "", estimate, "FALSE"])
end
end
end
end
end
end