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
|
# File 'lib/rtrac-utils/rtrac_cards.rb', line 12
def self.write!(file, options={})
file = File.new(file, "w") if file.is_a? String
message 'Retreiving tickets...'
if !options[:milestone] || options[:milestone] == :all
tickets = Rtrac::Base.get_tickets(MAX_FIXNUM)
else
milestone = options[:milestone]
tickets = Rtrac::Base.get_by_milestone(milestone)
end
if options[:paper] == :is_3x5
paper = [ 12.7, 7.62 ]
else
paper = [ 15.24, 10.16 ]
end
pdf = PDF::Writer.new(:paper => paper)
message 'Exporting pages...'
tickets.each do |id|
ticket = Rtrac::Ticket.new(id)
puts ">> #{ticket.summary}"
pdf.text "##{id}", :font_size => 12, :justification => :right
pdf.text ticket.summary, :font_size => 14, :justification => :left
pdf.start_new_page
end
pdf.save_as(file.path)
end
|