Sha256: d32db7e49a7859e3169ffdf2db641a4ec228fb4763c2d7debbe1464707d2c84e

Contents?: true

Size: 844 Bytes

Versions: 29

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

module ShopifyCLI
  module Theme
    module DevServer
      class ReloadMode
        MODES = [:"hot-reload", :"full-page", :off]

        class << self
          def default
            :"hot-reload"
          end

          def get!(mode)
            MODES.find { |m| m == mode.to_sym } || raise_error(mode)
          end

          private

          def raise_error(invalid_mode)
            error_message = ShopifyCLI::Context.message("theme.serve.reload_mode_is_not_valid", invalid_mode)
            help_message = ShopifyCLI::Context.message("theme.serve.try_a_valid_reload_mode", valid_modes)

            ShopifyCLI::Context.abort(error_message, help_message)
          end

          def valid_modes
            MODES.map { |v| "`#{v}`" }.join(", ")
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
shopify-cli-2.13.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.12.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.11.2 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.11.1 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.11.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.10.2 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.10.1 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.10.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.9.0 lib/shopify_cli/theme/dev_server/reload_mode.rb