Commit 313fc8ca0b2b77bf92ea1313ad054e04b85b1273
1 parent
a05ec074
Exists in
master
and in
29 other branches
ActionItem862: more upgrade testing
Showing
1 changed file
with
15 additions
and
5 deletions
Show diff stats
script/apply-template
| ... | ... | @@ -8,14 +8,22 @@ env = Environment.default |
| 8 | 8 | |
| 9 | 9 | def move_articles_to_blog(profile) |
| 10 | 10 | profile.articles.each { |article| |
| 11 | - puts 'including ' + article.path + ' in the blog' | |
| 12 | - if !article.blog? && !article.is_a?(RssFeed) | |
| 13 | - article.parent_id = profile.blog.id | |
| 11 | + if !article.blog? && !article.is_a?(RssFeed) && article.public_article | |
| 12 | + puts 'including ' + article.path + ' in the blog' | |
| 13 | + article.parent = profile.blog | |
| 14 | 14 | article.save! |
| 15 | 15 | end |
| 16 | 16 | } |
| 17 | 17 | end |
| 18 | 18 | |
| 19 | +def report_doing(n, text) | |
| 20 | + puts "#{n} - #{text} ..." | |
| 21 | +end | |
| 22 | + | |
| 23 | +def report_done | |
| 24 | + puts "[done]" | |
| 25 | +end | |
| 26 | + | |
| 19 | 27 | case $ARGV[0] |
| 20 | 28 | when 'inactive-enterprise' |
| 21 | 29 | offset = 0 |
| ... | ... | @@ -47,9 +55,10 @@ when 'community' |
| 47 | 55 | offset = 0 |
| 48 | 56 | while community = Community.find(:first, :order => :id, :offset => offset) |
| 49 | 57 | if community != template && !excluded.include?(community.identifier) |
| 58 | + report_doing offset, profile.name | |
| 50 | 59 | community.apply_template(template) |
| 51 | 60 | move_articles_to_blog(community) |
| 52 | - puts "#{offset} - #{community.identifier}" | |
| 61 | + report_done | |
| 53 | 62 | end |
| 54 | 63 | offset = offset + 1 |
| 55 | 64 | end |
| ... | ... | @@ -58,9 +67,10 @@ when 'person' |
| 58 | 67 | offset = 0 |
| 59 | 68 | while person = Person.find(:first, :order => :id, :offset => offset) |
| 60 | 69 | if person != template |
| 70 | + report_doing offset, person.identifier | |
| 61 | 71 | person.apply_template(template) |
| 62 | 72 | move_articles_to_blog(person) |
| 63 | - puts "#{offset} - #{person.identifier}" | |
| 73 | + report_done | |
| 64 | 74 | end |
| 65 | 75 | offset = offset + 1 |
| 66 | 76 | end | ... | ... |