Commit 77d816a34f65a05f3bcf0e951f51c115cb8fd288

Authored by Antonio Terceiro
1 parent bfe2766c

ActionItem1165: generating two rewrite files

Showing 1 changed file with 8 additions and 6 deletions   Show diff stats
script/import-cooperation.net
@@ -140,12 +140,8 @@ for username in ARGV @@ -140,12 +140,8 @@ for username in ARGV
140 140
141 orig_article_number = File.basename(xml).sub(/\.xml$/, '') 141 orig_article_number = File.basename(xml).sub(/\.xml$/, '')
142 142
143 - File.open("tmp/rewrite.txt", 'a') do |file|  
144 - [ '', '.html' ].each do |ext|  
145 - [ '', '/[a-z.]*'].each do |prefix|  
146 - file.puts("Redirect #{prefix}/info/#{orig_article_number}#{ext} #{url_for(article.url)}")  
147 - end  
148 - end 143 + File.open("tmp/rewrite-articles.txt", 'a') do |file|
  144 + file.puts("#{orig_article_number}\t\t\t#{url_for(article.url)}")
149 Progress.say "I: Article with id = #{article.id} redirected to #{url_for(article.url)}" 145 Progress.say "I: Article with id = #{article.id} redirected to #{url_for(article.url)}"
150 end 146 end
151 147
@@ -177,6 +173,12 @@ for username in ARGV @@ -177,6 +173,12 @@ for username in ARGV
177 end 173 end
178 file.parent.save 174 file.parent.save
179 175
  176 + orig_file_number = File.basename(attachment_xml).gsub(/\.xml$/, '')
  177 + File.open('tmp/rewrite-files.txt', 'a') do |outfile|
  178 + outfile.puts("#{orig_file_number}\t\t\t#{url_for(file.url)}")
  179 + Progress.say "I: Attachment with id = #{orig_article_number} redirected to #{url_for(file.url)}"
  180 + end
  181 +
180 end 182 end
181 end 183 end
182 184