Sha256: fd6ef67243eaa634e54bfe5c4a5b268bd345b023fc16e3f9e0858beb0f7a8ced

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true
module SewingKit
  class Configuration
    attr_accessor :build_options, :dev_server_sewing_kit_bin, :manifest_name,
      :manifest_path
    attr_reader :test_manifest_mode, :log_level

    def test_manifest_mode=(mode)
      valid_modes = [:return_no_assets, :use_precompiled_assets]
      raise "Unknown mode '#{mode}' (valid modes are: #{valid_modes})" unless valid_modes.include?(mode)

      @test_manifest_mode = mode
    end

    def log_level=(level)
      valid_log_levels = [:inherit, :info, :debug, :warn, :error]

      if valid_log_levels.include?(level)
        @log_level = level
      else
        raise "Unknown log_level '#{level}' (valid log_levels are: #{valid_log_levels})"
      end
    end

    def initialize
      @build_options = nil
      @manifest_name = 'sewing-kit-manifest.json'
      @manifest_path = nil
      @dev_server_sewing_kit_bin = 'node_modules/.bin/sewing-kit'
      @log_level = :inherit
      self.test_manifest_mode = :return_no_assets
    end
  end

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.configure
    yield(configuration)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sewing_kit-0.95.4 lib/sewing_kit/configuration.rb
sewing_kit-0.95.3 lib/sewing_kit/configuration.rb
sewing_kit-0.95.2 lib/sewing_kit/configuration.rb
sewing_kit-0.95.1 lib/sewing_kit/configuration.rb
sewing_kit-0.95.0 lib/sewing_kit/configuration.rb