blob: 006945c077f5e04bf67ebe87d665789bd859c383 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
namespace :import do
desc "Notify parent imports when children finish"
task notify_parent: :environment do
ParentNotifier.new(Import).notify_when_finished
end
desc "Mark old unfinished Netex imports as 'aborted'"
task netex_abort_old: :environment do
NetexImport.abort_old
end
desc "import the given file with the corresponding importer"
task :import, [:configuration_name, :filepath] => :environment do |t, args|
importer = SimpleImporter.create configuration_name: args[:configuration_name], filepath: args[:filepath]
puts "\e[33m***\e[0m Start importing"
importer.import(verbose: true)
puts "\n\e[33m***\e[0m Import done, status: " + (importer.status == "success" ? "\e[32m" : "\e[31m" ) + importer.status + "\e[0m"
end
end
|