diff --git a/solara/lib/core/scripts/brand_importer.rb b/solara/lib/core/scripts/brand_importer.rb index be304aa..2275fa9 100644 --- a/solara/lib/core/scripts/brand_importer.rb +++ b/solara/lib/core/scripts/brand_importer.rb @@ -3,7 +3,27 @@ class BrandImporter - def start(configurations_path) + def start(configurations_paths) + + configurations_paths.each do |path| + import(path) + end + + end + + private + + def import(configurations_path) + unless File.exist?(configurations_path) + Solara.logger.failure("#{configurations_path} doesn't exist!") + return + end + + unless File.file?(configurations_path) + Solara.logger.failure("#{configurations_path} is not configurations file!") + return + end + validate_json(configurations_path) validate_json_schema(configurations_path) @@ -17,7 +37,7 @@ def start(configurations_path) end update_brand(brand_key, configurations_json) - + message_suffix = exists ? "The existing brand '#{brand_key}' has been updated." : "A new brand with the key '#{brand_key}' has been onboarded." Solara.logger.success("Successfully imported (#{configurations_path}). #{message_suffix}") end diff --git a/solara/lib/solara.rb b/solara/lib/solara.rb index 5cc4445..c5aa6ec 100644 --- a/solara/lib/solara.rb +++ b/solara/lib/solara.rb @@ -78,8 +78,7 @@ def status desc "import -configurations CONFIGURATIONS_JSON_FILE --brand_key YOUR_BRAND_KEY", "Import the brand's configurations. If the brand is existing, it will be updated with these configurations, otherwise, a new brand will be onboarded." - method_option :configurations, :type => :string, :aliases => "-c" - method_option :brand_key, :type => :string, :aliases => "-k" + method_option :configurations, :type => :array, :aliases => "-c" def import check_project_health