-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
79 lines (68 loc) · 2.21 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# frozen_string_literal: true
require('rake')
require('rspec/core/rake_task')
load('environment.rb')
desc "Run all tasks"
task :test do
Rake::Task['test:unit'].execute
Rake::Task['test:integration'].execute
end
namespace :test do
RSpec::Core::RakeTask.new(:unit) do |t|
t.pattern = Dir.glob('spec/**/*_test.rb').reject{|t| t.include?("_integration_test.rb")}
end
RSpec::Core::RakeTask.new(:integration) do |t|
t.pattern = Dir.glob('spec/**/*_test.rb').select{|t| t.include?("_integration_test.rb")}
end
end
task :init_index do
puts "ElasticSearch host is #{Settings.get('es_host')} and index is #{Settings.get('es_index_name')}"
puts "Creating index..."
ClaimReviewRepository.new.create_index!(force: true)
puts "Trying to find index..."
puts %x[curl #{Settings.get('es_host')}/#{Settings.get('es_index_name')}]
end
task :schedule_stale_parser_check do
Sidekiq::Cron::Job.create(name: 'Stale Parser Check', cron: '0 0 * * *', class: 'CheckForStaleParsers')
end
task :list_datasources do
puts ClaimReviewParser.subclasses.map(&:service)
end
# bundle exec rake collect_datasource some_service 2020-01-01 true
task :collect_datasource do
ARGV.each do |a|
task a.to_sym do
end
end
datasource = ARGV[1]
cursor_back_to_date = ARGV[2]
overwrite_existing_claims = ARGV[3] == "true"
RunClaimReviewParser.perform_async(datasource, cursor_back_to_date, overwrite_existing_claims)
end
# bundle exec rake collect_datasource 2020-01-01 true
task :collect_all do
ARGV.each do |a|
task a.to_sym do
end
end
cursor_back_to_date = ARGV[1]
overwrite_existing_claims = ARGV[2] == "true"
ClaimReviewParser.enabled_subclasses.map(&:service).each do |datasource|
puts "Updating #{datasource}..."
RunClaimReviewParser.perform_async(datasource, cursor_back_to_date, overwrite_existing_claims)
end
end
task :init_index do
ClaimReviewRepository.init_index
ClaimReviewSocialDataRepository.init_index
StoredSubscriptionRepository.init_index
end
task :safe_init_index do
ClaimReviewRepository.safe_init_index
ClaimReviewSocialDataRepository.safe_init_index
StoredSubscriptionRepository.safe_init_index
end
task :requeue do
ClaimReviewParser.requeue_all
end
task(default: [:test])