Sha256: 60c68fbda28508f638429ce8bcbf8157ed48d57f1fabff8467d4cd5a40aa4858

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module SewingKit
  class Configuration
    attr_accessor :development_options, :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
      @development_options = {}
      @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

1 entries across 1 versions & 1 rubygems

Version Path
sewing_kit-0.130.1 lib/sewing_kit/configuration.rb