Merge branch 'master' into 'master'
rake task for remove preview bulletins add a Ruby scheduler process (not a cronjob) to remove bulletins generated by preview See merge request !3
This commit is contained in:
commit
2208f76337
|
@ -16,4 +16,6 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||
s.test_files = Dir["test/**/*"]
|
||||
|
||||
s.add_dependency "rufus-scheduler", "~> 3.6.0"
|
||||
end
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
require 'rufus-scheduler'
|
||||
|
||||
scheduler = Rufus::Scheduler.new
|
||||
|
||||
#return if defined?(Rails::Console) || Rails.env.test? || File.split($0).last == 'rake'
|
||||
|
||||
scheduler.cron '43 2 * * *' do
|
||||
system('bundle exec rake bulletin:remove_preview_bulletins')
|
||||
end
|
|
@ -1,4 +1,8 @@
|
|||
# desc "Explaining what the task does"
|
||||
# task :bulletin do
|
||||
# # Task goes here
|
||||
# end
|
||||
desc 'Remove duplicated bulletins (announcements) created by preview'
|
||||
|
||||
namespace :bulletin do
|
||||
task :remove_preview_bulletins => [:environment] do
|
||||
bulletins = Bulletin.where(is_preview: true)
|
||||
bulletins.destroy_all
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue