Sha256: afaa92aa7f63bfe7c4b7a2cf529dfec02f4b40737ab8520536926759ff203c23

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

class BrandConfigUpdater

    def update(filename, data, brand_key)
        template = BrandConfigurationsManager.new(brand_key).template_with_filename(filename)
        if template.nil?
            Solara.logger.debug("Can't find tempate for filename: #{filename}, with brand key: #{brand_key}")
            return
        end

        path = template[:path]
        json = JSON.pretty_generate(data)

        begin
            # Check if the file exists
            if File.exist?(path)
                # If it exists, update the file
                File.write(path, json)
                Solara.logger.debug("Updated Config for #{path}: #{data}")
            else
                # If it doesn't exist, create the file with the data
                File.write(path, json)
                Solara.logger.debug("Created Config for #{path}: #{data}")
            end
        rescue StandardError => e
            Solara.logger.failure("Error updating #{brand_key} config file #{path}: #{e.message}")
            raise
        end
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solara-0.7.4 solara/lib/core/scripts/brand_config_updater.rb
solara-0.7.3 solara/lib/core/scripts/brand_config_updater.rb
solara-0.7.2 solara/lib/core/scripts/brand_config_updater.rb
solara-0.7.1 solara/lib/core/scripts/brand_config_updater.rb
solara-0.7.0 solara/lib/core/scripts/brand_config_updater.rb