Sha256: 22a003822e3ac18743e7b093942f206030f0087c3ecb038106175c1f075148b6
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
require 'json' require 'fileutils' class BrandExporter def start(brand_keys, path) if !path.nil? && !path.strip.empty? && !File.directory?(path) Solara.logger.failure("#{path} is not a directory. Please specify a valid directory.") return end directory = path || FilePath.project_root brand_keys.each do |brand_key| export(brand_key, directory) end end private def export(brand_key, directory) if BrandsManager.instance.find(brand_key).nil? Solara.logger.failure("#{brand_key} doesn't exist!") return end brand = BrandsManager.instance.brand_with_configurations(brand_key) json = JSON.pretty_generate(brand) json_file_path = File.join(directory, "#{brand_key}-solara-configurations.json") # Create the file if it does not exist File.open(json_file_path, 'w') do |file| file.write(json) end Solara.logger.success("Successfully exported brand #{brand_key} to: #{json_file_path}") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solara-0.2.0 | solara/lib/core/scripts/brand_exporter.rb |
solara-0.1.0 | solara/lib/core/scripts/brand_exporter.rb |