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
|
# File 'lib/aspire/cli/cache_builder.rb', line 12
def execute
unless (env_file.nil? || env_file.empty?)
Dotenv.load(env_file)
end
@json_api = json_api
@linked_data_api = linked_data_api
@logger = create_logger log_to_file?
@cache_path = ENV['ASPIRE_CACHE_PATH']
@list_report = ENV['ASPIRE_LIST_REPORT']
@mode = ENV['ASPIRE_CACHE_MODE']
@mode = @mode.nil? || @mode.empty? ? 0o700 : @mode.to_i(8)
cache = Aspire::Caching::Cache.new(@linked_data_api, @json_api, @cache_path,
logger: @logger)
@builder = Aspire::Caching::Builder.new(cache)
if list_uri.nil? || list_uri.empty?
raise ArgumentError if privacy_control.nil? || privacy_control.empty?
puts "Caching all lists that match arguments"
lists = list_enumerator time_period_list, status, privacy_control
@builder.build(lists)
puts "Finished caching all lists that match arguments"
else
puts "Caching list #{list_uri}"
@builder.write_list(list_uri)
puts "Finished caching list"
end
end
|