From b9125baf3ca374a3477f0eabf65bbfde213dd7f8 Mon Sep 17 00:00:00 2001 From: Steven Farlie Date: Mon, 1 Jan 2024 23:53:02 +0000 Subject: [PATCH] fix: skip missing files instead of failing --- lib/tasks/bsb_tasks.rake | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/tasks/bsb_tasks.rake b/lib/tasks/bsb_tasks.rake index 2a732d4..5cbdb33 100644 --- a/lib/tasks/bsb_tasks.rake +++ b/lib/tasks/bsb_tasks.rake @@ -13,12 +13,22 @@ namespace :bsb do file_format: '.txt' ) - require 'bsb/bank_list_generator' - bsb_bl_gen = BSB::BankListGenerator.load_file(bank_list_filename) - File.write('config/bsb_bank_list.json', bsb_bl_gen.json) + raise 'No bank list or bsb found' unless bank_list_filename || db_list_filename - require 'bsb/database_generator' - bsb_db_gen = BSB::DatabaseGenerator.load_file(db_list_filename) - File.write('config/bsb_db.json', bsb_db_gen.json) + if bank_list_filename + require 'bsb/bank_list_generator' + bsb_bl_gen = BSB::BankListGenerator.load_file(bank_list_filename) + File.write('config/bsb_bank_list.json', bsb_bl_gen.json) + else + $stderr.puts 'Missing bank list "KEY TO ABBREVIATIONS AND BSB NUMBERS"' + end + + if db_list_filename + require 'bsb/database_generator' + bsb_db_gen = BSB::DatabaseGenerator.load_file(db_list_filename) + File.write('config/bsb_db.json', bsb_db_gen.json) + else + $stderr.puts 'Missing bsb db "BSBDirectory"' + end end end