new rake task to bake uncooked posts

This commit is contained in:
Arpit Jalan 2017-09-12 12:40:18 +05:30
parent c06c88b479
commit 18142d8abf
1 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,20 @@ task 'posts:rebake' => :environment do
ENV['RAILS_DB'] ? rebake_posts : rebake_posts_all_sites ENV['RAILS_DB'] ? rebake_posts : rebake_posts_all_sites
end end
task 'posts:rebake_uncooked_posts' => :environment do
uncooked = Post.where(baked_version: nil)
rebaked = 0
total = uncooked.count
uncooked.find_each do |post|
rebake_post(post)
print_status(rebaked += 1, total)
end
puts "", "#{rebaked} posts done!", ""
end
desc 'Update each post with latest markdown and refresh oneboxes' desc 'Update each post with latest markdown and refresh oneboxes'
task 'posts:refresh_oneboxes' => :environment do task 'posts:refresh_oneboxes' => :environment do
ENV['RAILS_DB'] ? rebake_posts(invalidate_oneboxes: true) : rebake_posts_all_sites(invalidate_oneboxes: true) ENV['RAILS_DB'] ? rebake_posts(invalidate_oneboxes: true) : rebake_posts_all_sites(invalidate_oneboxes: true)