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.24.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.23.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.22.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.21.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.20.1 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.20.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.19.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.18.1 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.18.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.17.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.16.1 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.16.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.15.6 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.15.5 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.15.4 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.15.3 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.15.2 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.15.1 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.15.0 lib/shopify_cli/theme/dev_server/reload_mode.rb
shopify-cli-2.14.0 lib/shopify_cli/theme/dev_server/reload_mode.rb