summaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-05-04 16:48:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-05-04 16:48:27 +0000
commitad1ffa06a070bebb4bc5698577fcaf3e238e72e8 (patch)
treeeb6572f8bb5f704c77c56a0a2843322436cda60a /lib/tasks
parentfa7bd1c71dca1e9c74e6d83277336321393dac9f (diff)
downloadredmine-ad1ffa06a070bebb4bc5698577fcaf3e238e72e8.tar.gz
redmine-ad1ffa06a070bebb4bc5698577fcaf3e238e72e8.zip
Fixed Trac importer broken by r2670 (#3254).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2705 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/migrate_from_trac.rake25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake
index 9b245cd16..a63daae1a 100644
--- a/lib/tasks/migrate_from_trac.rake
+++ b/lib/tasks/migrate_from_trac.rake
@@ -135,8 +135,15 @@ namespace :redmine do
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
@@ -506,12 +513,14 @@ namespace :redmine do
# 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