Commit 5d6d1157e2075d234553991d047bb5a12aa0faea
1 parent
6b09f6b6
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
virtuoso: added some output to noosfero harvest script
Showing
1 changed file
with
12 additions
and
4 deletions
Show diff stats
plugins/virtuoso/lib/virtuoso_plugin/noosfero_harvest.rb
... | ... | @@ -45,34 +45,42 @@ class VirtuosoPlugin::NoosferoHarvest |
45 | 45 | include Rails.application.routes.url_helpers |
46 | 46 | |
47 | 47 | def triplify_comments(article) |
48 | + total = article.comments.count | |
49 | + count = 0 | |
48 | 50 | article.comments.each do |comment| |
49 | 51 | subject_identifier = url_for(comment.url) |
50 | - puts "triplify #{subject_identifier} comment" | |
52 | + puts "triplify #{subject_identifier} comment (#{count+=1}/#{total})" | |
51 | 53 | triplify_mappings(COMMENT_MAPPING, subject_identifier, article, comment) |
52 | 54 | end |
53 | 55 | end |
54 | 56 | |
55 | 57 | def triplify_articles(profile) |
58 | + total = profile.articles.count | |
59 | + count = 0 | |
56 | 60 | profile.articles.public.each do |article| |
57 | 61 | subject_identifier = url_for(article.url) |
58 | - puts "triplify #{subject_identifier} article" | |
62 | + puts "triplify #{subject_identifier} article (#{count+=1}/#{total})" | |
59 | 63 | triplify_mappings(ARTICLE_MAPPING, subject_identifier, profile, article) |
60 | 64 | triplify_comments(article) |
61 | 65 | end |
62 | 66 | end |
63 | 67 | |
64 | 68 | def triplify_friendship(person) |
69 | + total = person.friends.count | |
70 | + count = 0 | |
65 | 71 | person.friends.each do |friend| |
66 | 72 | subject_identifier = url_for(person.url) |
67 | - puts "triplify #{subject_identifier} friendship" | |
73 | + puts "triplify #{subject_identifier} friendship (#{count+=1}/#{total})" | |
68 | 74 | triplify_mappings(FRIENDSHIP_MAPPING, subject_identifier, person, friend) |
69 | 75 | end |
70 | 76 | end |
71 | 77 | |
72 | 78 | def triplify_profiles |
79 | + total = environment.profiles.count | |
80 | + count = 0 | |
73 | 81 | environment.profiles.each do |profile| |
74 | 82 | subject_identifier = url_for(profile.url) |
75 | - puts "triplify #{subject_identifier} profile" | |
83 | + puts "triplify #{subject_identifier} profile (#{count+=1}/#{total})" | |
76 | 84 | triplify_mappings(PROFILE_MAPPING, subject_identifier, environment, profile) |
77 | 85 | triplify_articles(profile) if profile.public? |
78 | 86 | triplify_friendship(profile) if profile.person? | ... | ... |