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
60
61
62
63
64
65
66
67
|
# File 'lib/gen-tj/genbuglist.rb', line 28
def GenBuglist.run query
DataMapper::Logger.new(STDOUT, :debug)
keeper = DataMapper.setup(:default, :adapter => 'bugzilla',
:url => 'https://bugzilla.novell.com')
require 'bugzilla/named_query'
DataMapper.finalize
f = NamedQuery.get(query)
bugs = f.bugs
prios = []
bugs.each do |bug|
pval = 0 if bug.priority =~ /P([\d]+).*/
pval = $1.to_i + 1
end
prios[pval] ||= []
prios[pval] << bug
end
puts "task bugs \"Bugs\" {"
prio = 900
((1..(prios.size-1)).to_a << 0).each do |i|
bugs = prios[i]
next if bugs.nil? || bugs.empty?
puts "task p#{(i==0)?'none':i}_bugs \"Bugs with prio #{bugs.first.priority}\" {"
puts "priority #{prio}"
bugs.each do |bug|
puts bug.to_tj
end
puts "}"
prio -= 100
end
puts "}"
end
|