将一堆的rake命令变为一条

This commit is contained in:
guange 2016-02-02 19:16:15 +08:00
parent eefb4c86d1
commit eb3644a197
1 changed files with 9 additions and 12 deletions

View File

@ -1,17 +1,11 @@
namespace :importer do
task :import_all => :environment do
Rake::Task["importer:importuser"].execute
Rake::Task["importer:importproject"].execute
Rake::Task["importer:importcourse"].execute
Rake::Task["importer:importattachment"].execute
Rake::Task["importer:importmemo"].execute
end
task :importuser => :environment do
ENV['CLASS']='User'
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].invoke
Rake::Task["elasticsearch:import:model"].execute
end
task :importproject => :environment do
@ -19,27 +13,30 @@ namespace :importer do
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].invoke
Rake::Task["elasticsearch:import:model"].execute
end
task :importcourse => :environment do
ENV['CLASS']='Course'
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].invoke
Rake::Task["elasticsearch:import:model"].execute
end
task :importattachment => :environment do
ENV['CLASS']='Attachment'
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].invoke
Rake::Task["elasticsearch:import:model"].execute
end
task :importmemo => :environment do
ENV['CLASS']='Memo'
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].invoke
Rake::Task["elasticsearch:import:model"].execute
end
desc "Run all tasks"
task :all => [:importuser,:importproject,:importcourse,:importattachment,:importmemo]
end