Commit bccbb818d59451e985245fa9b9cd2d51690f23e8
1 parent
374888e8
Exists in
master
and in
29 other branches
ActionItem305: mapping id to new URL
Showing
1 changed file
with
7 additions
and
0 deletions
Show diff stats
script/import-cooperation.net
1 | 1 | #!/usr/bin/ruby |
2 | 2 | require File.dirname(__FILE__) + '/../config/environment' |
3 | 3 | |
4 | +include ActionController::UrlWriter | |
5 | + | |
4 | 6 | IMPORT_DIR = '/home/terceiro/src/cooperation-migration/data/export' |
5 | 7 | |
6 | 8 | if ARGV.size == 0 |
... | ... | @@ -85,6 +87,11 @@ for username in ARGV |
85 | 87 | puts "I: Article #{article.name.inspect} is #{username}'s homepage!" |
86 | 88 | end |
87 | 89 | |
90 | + File.open("tmp/rewrite.txt", 'w+') do |file| | |
91 | + file.puts("#{article.id} #{url_for(article.url)}") | |
92 | + puts "I: Article with id = #{article.id} redirected to #{url_for(article.url)}" | |
93 | + end | |
94 | + | |
88 | 95 | # import attachments |
89 | 96 | attachments_dir = xml.gsub(/\.xml$/, '') |
90 | 97 | Dir.glob(File.join(attachments_dir, 'attachments', '*.xml')).each do |attachment_xml| | ... | ... |