Sha256: f8432218a385731f9f008048024cf80385745af1615b81bffa43a0a9b2e7d8e0

Contents?: true

Size: 943 Bytes

Versions: 3

Compression:

Stored size: 943 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  module Commands
    module ConfigurationOverridable
      def self.included(klass)
        desc = "The environment used for this command (aka development, test, production, etc.)"
        klass.class_option :environment,
                           aliases: "-e",
                           desc:
      end

      # Create a full Bridgetown configuration with the options passed in as overrides
      #
      # @param options [Hash] the configuration overrides
      # @param preloaded [Bridgetown::Configuration, Bridgetown::Configuration::Preflight]
      #   a preloaded config or preflight
      # @return [Bridgetown::Configuration] a full Bridgetown configuration
      def configuration_with_overrides(options, preloaded = nil)
        return preloaded.merge!(options) if preloaded.is_a?(Bridgetown::Configuration)

        Bridgetown.configuration(options)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bridgetown-core-2.0.0.beta3 lib/bridgetown-core/commands/concerns/configuration_overridable.rb
bridgetown-core-2.0.0.beta2 lib/bridgetown-core/commands/concerns/configuration_overridable.rb
bridgetown-core-2.0.0.beta1 lib/bridgetown-core/commands/concerns/configuration_overridable.rb