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
|
# File 'lib/lighthouse-release-notes.rb', line 6
def generate(options={})
Lighthouse.account = options[:account]
Lighthouse.authenticate options[:email], options[:password]
project = Lighthouse::Project.find options[:project_id]
tickets = []
i = 1
while true
ts = project.tickets(:q => "milestone:#{options[:milestone]}", :page => i)
break if ts.size <= 0
tickets << ts
i = i + 1
end
puts "Release notes for #{options[:milestone]}"
prev_state = nil
tickets.flatten.sort {|a,b| b.state <=> a.state }.each do |f|
if f.state != prev_state
puts ""
puts f.state.capitalize
end
puts "- #{f.title} [##{f.number}]"
prev_state = f.state
end
nil
end
|