Sha256: fd3b536eb784ca0fe0e2d06905208f35463b0525eb452d4f410057e1e9b37309

Contents?: true

Size: 1.18 KB

Versions: 16

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

16 entries across 16 versions & 1 rubygems

Version Path
sewing_kit-0.130.0 lib/sewing_kit/configuration.rb
sewing_kit-0.129.0 lib/sewing_kit/configuration.rb
sewing_kit-0.128.0 lib/sewing_kit/configuration.rb
sewing_kit-0.127.0 lib/sewing_kit/configuration.rb
sewing_kit-0.126.0 lib/sewing_kit/configuration.rb
sewing_kit-0.125.0 lib/sewing_kit/configuration.rb
sewing_kit-0.124.0 lib/sewing_kit/configuration.rb
sewing_kit-0.123.0 lib/sewing_kit/configuration.rb
sewing_kit-0.122.1 lib/sewing_kit/configuration.rb
sewing_kit-0.122.0 lib/sewing_kit/configuration.rb
sewing_kit-0.114.2 lib/sewing_kit/configuration.rb
sewing_kit-0.114.0 lib/sewing_kit/configuration.rb
sewing_kit-0.97.2 lib/sewing_kit/configuration.rb
sewing_kit-0.97.1 lib/sewing_kit/configuration.rb
sewing_kit-0.97.0 lib/sewing_kit/configuration.rb
sewing_kit-0.96.0 lib/sewing_kit/configuration.rb