Defect #3254 ยป migrate_from_trac.diff
| lib/tasks/migrate_from_trac.rake (working copy) | ||
|---|---|---|
|
File.file? trac_fullpath
|
||
|
end
|
||
|
def read
|
||
|
File.open("#{trac_fullpath}", 'rb').read
|
||
|
def open
|
||
|
File.open("#{trac_fullpath}", 'rb') {|f|
|
||
|
@file = f
|
||
|
yield self
|
||
|
}
|
||
|
end
|
||
|
def read(*args)
|
||
|
@file.read(*args)
|
||
|
end
|
||
|
def description
|
||
|
read_attribute(:description).to_s.slice(0,255)
|
||
|
end
|
||
| ... | ... | |
|
# Attachments
|
||
|
ticket.attachments.each do |attachment|
|
||
|
next unless attachment.exist?
|
||
|
a = Attachment.new :created_on => attachment.time
|
||
|
a.file = attachment
|
||
|
a.author = find_or_create_user(attachment.author)
|
||
|
a.container = i
|
||
|
a.description = attachment.description
|
||
|
migrated_ticket_attachments += 1 if a.save
|
||
|
attachment.open {
|
||
|
a = Attachment.new :created_on => attachment.time
|
||
|
a.file = attachment
|
||
|
a.author = find_or_create_user(attachment.author)
|
||
|
a.container = i
|
||
|
a.description = attachment.description
|
||
|
migrated_ticket_attachments += 1 if a.save
|
||
|
}
|
||
|
end
|
||
|
# Custom fields
|
||