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,34 +45,42 @@ class VirtuosoPlugin::NoosferoHarvest | ||
| 45 | include Rails.application.routes.url_helpers | 45 | include Rails.application.routes.url_helpers |
| 46 | 46 | ||
| 47 | def triplify_comments(article) | 47 | def triplify_comments(article) |
| 48 | + total = article.comments.count | ||
| 49 | + count = 0 | ||
| 48 | article.comments.each do |comment| | 50 | article.comments.each do |comment| |
| 49 | subject_identifier = url_for(comment.url) | 51 | subject_identifier = url_for(comment.url) |
| 50 | - puts "triplify #{subject_identifier} comment" | 52 | + puts "triplify #{subject_identifier} comment (#{count+=1}/#{total})" |
| 51 | triplify_mappings(COMMENT_MAPPING, subject_identifier, article, comment) | 53 | triplify_mappings(COMMENT_MAPPING, subject_identifier, article, comment) |
| 52 | end | 54 | end |
| 53 | end | 55 | end |
| 54 | 56 | ||
| 55 | def triplify_articles(profile) | 57 | def triplify_articles(profile) |
| 58 | + total = profile.articles.count | ||
| 59 | + count = 0 | ||
| 56 | profile.articles.public.each do |article| | 60 | profile.articles.public.each do |article| |
| 57 | subject_identifier = url_for(article.url) | 61 | subject_identifier = url_for(article.url) |
| 58 | - puts "triplify #{subject_identifier} article" | 62 | + puts "triplify #{subject_identifier} article (#{count+=1}/#{total})" |
| 59 | triplify_mappings(ARTICLE_MAPPING, subject_identifier, profile, article) | 63 | triplify_mappings(ARTICLE_MAPPING, subject_identifier, profile, article) |
| 60 | triplify_comments(article) | 64 | triplify_comments(article) |
| 61 | end | 65 | end |
| 62 | end | 66 | end |
| 63 | 67 | ||
| 64 | def triplify_friendship(person) | 68 | def triplify_friendship(person) |
| 69 | + total = person.friends.count | ||
| 70 | + count = 0 | ||
| 65 | person.friends.each do |friend| | 71 | person.friends.each do |friend| |
| 66 | subject_identifier = url_for(person.url) | 72 | subject_identifier = url_for(person.url) |
| 67 | - puts "triplify #{subject_identifier} friendship" | 73 | + puts "triplify #{subject_identifier} friendship (#{count+=1}/#{total})" |
| 68 | triplify_mappings(FRIENDSHIP_MAPPING, subject_identifier, person, friend) | 74 | triplify_mappings(FRIENDSHIP_MAPPING, subject_identifier, person, friend) |
| 69 | end | 75 | end |
| 70 | end | 76 | end |
| 71 | 77 | ||
| 72 | def triplify_profiles | 78 | def triplify_profiles |
| 79 | + total = environment.profiles.count | ||
| 80 | + count = 0 | ||
| 73 | environment.profiles.each do |profile| | 81 | environment.profiles.each do |profile| |
| 74 | subject_identifier = url_for(profile.url) | 82 | subject_identifier = url_for(profile.url) |
| 75 | - puts "triplify #{subject_identifier} profile" | 83 | + puts "triplify #{subject_identifier} profile (#{count+=1}/#{total})" |
| 76 | triplify_mappings(PROFILE_MAPPING, subject_identifier, environment, profile) | 84 | triplify_mappings(PROFILE_MAPPING, subject_identifier, environment, profile) |
| 77 | triplify_articles(profile) if profile.public? | 85 | triplify_articles(profile) if profile.public? |
| 78 | triplify_friendship(profile) if profile.person? | 86 | triplify_friendship(profile) if profile.person? |