Class: FluidCLI::Commands::Theme::Dev

Inherits:
FluidCLI::Command show all
Includes:
Common::RootHelper
Defined in:
lib/fluid_cli/commands/theme/dev.rb

Constant Summary collapse

DEFAULT_HTTP_HOST =

recommend_default_ruby_range

"127.0.0.1"

Constants included from Common::RootHelper

Common::RootHelper::REQUIRED_FOLDERS

Instance Attribute Summary

Attributes inherited from FluidCLI::Command

#ctx, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common::RootHelper

#exist_and_not_empty?, #root_value, #valid_theme_directory?

Methods inherited from FluidCLI::Command

call, call_help, #initialize, options, subcommand, subcommand_registry

Constructor Details

This class inherits a constructor from FluidCLI::Command

Class Method Details

.as_reload_mode(mode) ⇒ Object



44
45
46
# File 'lib/fluid_cli/commands/theme/dev.rb', line 44

def self.as_reload_mode(mode)
  FluidCLI::Theme::DevServer::ReloadMode.get!(mode)
end

.helpObject



48
49
50
# File 'lib/fluid_cli/commands/theme/dev.rb', line 48

def self.help
  FluidCLI::Context.message("theme.serve.help", FluidCLI::TOOL_NAME)
end

Instance Method Details

#call(_args, name) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fluid_cli/commands/theme/dev.rb', line 30

def call(_args, name)
  valid_authentication_method!

  root = root_value(options, name)
  return unless valid_theme_directory?(root)

  flags = options.flags.dup
  host = flags[:host] || DEFAULT_HTTP_HOST

  FluidCLI::Theme::DevServer.start(@ctx, root, host: host, **flags) do |syncer|
    FluidCLI::Theme::UI::SyncProgressBar.new(syncer).progress(:upload_theme!, delay_low_priority_files: true)
  end
end