Skip to content

Commit

Permalink
Solara
Browse files Browse the repository at this point in the history
  • Loading branch information
IdeaS0ft committed Sep 10, 2024
1 parent 45eb40e commit 43c6a0c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
24 changes: 22 additions & 2 deletions solara/lib/core/scripts/brand_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions solara/lib/solara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 43c6a0c

Please sign in to comment.