Sha256: 9e00b82723e0d12145e307fc6b970c8bd1a171d941f8dab55b8fb1daff271505

Contents?: true

Size: 994 Bytes

Versions: 2

Compression:

Stored size: 994 Bytes

Contents

class BrandConfigurationsManager

    def initialize(brand_key)
        @brand_key = brand_key
    end

    def template_with_key(key)
        templates.select { |section| section[:key] === key }.first
    end

    def templates
        configurations = JSON.parse(File.read(FilePath.brand_configurations))['configurations']
        configurations.map do |config|
            {
                key: config['key'],
                name: config['name'],
                path: "#{FilePath.brand(@brand_key)}/#{config['filePath']}"
            }
        end
    end

    def create
        config_templates = templates

        config_templates.map do |template|
            create_config_item(
                template[:key],
                template[:name],
                template[:path]
            )
        end
    end

    def create_config_item(key, name, path)
        {
            key: key,
            name: name,
            content: JSON.parse(File.read(path)),
        }
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solara-0.6.0 solara/lib/core/scripts/brand_configurations_manager.rb
solara-0.5.0 solara/lib/core/scripts/brand_configurations_manager.rb