blob: 9362b7a84c05d5873b49c7eb4a32ee1c2affb0c0 (
plain)
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
|
namespace :kkuleomi do
namespace :index do
desc '(Re-)Initializes the ElasticSearch index'
task init: :environment do
Kkuleomi::Store.create_index true
end
end
namespace :update do
desc 'Updates all data'
task all: :environment do
run_update(false)
end
desc 'Update global USE and USE_EXPAND flags'
task use: :environment do
UseflagsUpdateJob.perform_later
end
desc 'Update internal mask cache in the delayed job runner process'
task masks: :environment do
MasksUpdateJob.perform_later
end
end
namespace :seed do
desc 'Initially seeds all data'
task all: :environment do
run_update(true)
end
end
end
def run_update(no_change_objects)
initialize_caches
fail 'Invalid work dir!' unless File.directory? KKULEOMI_PORTDIR
repo = Portage::Repository::Model.new KKULEOMI_PORTDIR
options = {
suppress_change_objects: no_change_objects
}
Rails.cache.write(KK_CACHE_LAST_IMPORT, Time.now)
repo.categories.each do |category|
CategoryUpdateJob.perform_later(category.path, options)
end
end
def initialize_caches
MasksUpdateJob.perform_later
UseflagsUpdateJob.perform_later
CommitsUpdateJob.perform_later
end
|