Class: Extension::Command::Serve
- Inherits:
-
ExtensionCommand
- Object
- CLI::Kit::BaseCommand
- ShopifyCLI::Command
- ShopifyCLI::Command::SubCommand
- ExtensionCommand
- Extension::Command::Serve
- Defined in:
- lib/project_types/extension/commands/serve.rb
Defined Under Namespace
Classes: RuntimeConfiguration
Constant Summary collapse
- DEFAULT_PORT =
39351
Instance Attribute Summary
Attributes inherited from ShopifyCLI::Command
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ExtensionCommand
Methods inherited from ShopifyCLI::Command::SubCommand
Methods inherited from ShopifyCLI::Command
call, call_help, check_node_version, check_ruby_version, check_version, #initialize, options, prerequisite_task, recommend_default_node_range, recommend_default_ruby_range, recommend_node, recommend_ruby, run_prerequisites, subcommand, subcommand_registry
Methods included from ShopifyCLI::Feature::Set
Constructor Details
This class inherits a constructor from ShopifyCLI::Command
Class Method Details
.help ⇒ Object
83 84 85 |
# File 'lib/project_types/extension/commands/serve.rb', line 83 def self.help ShopifyCLI::Context.new.("serve.help", ShopifyCLI::TOOL_NAME) end |
Instance Method Details
#call(args, _command_name) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/project_types/extension/commands/serve.rb', line 59 def call(args, _command_name) @ctx.root = args.first || @ctx.root config = RuntimeConfiguration.new( tunnel_requested: tunnel_requested?, resource_url: .flags[:resource_url], port: .flags[:port], theme: .flags[:theme], generate_tmp_theme: generate_tmp_theme?, api_key: .flags[:api_key], api_secret: .flags[:api_secret], registration_id: .flags[:registration_id], extension_title: .flags[:extension_title], extension_type: .flags[:extension_type], ) ShopifyCLI::Result .success(config) .then(&method(:find_available_port)) .then(&method(:start_tunnel_if_required)) .then(&method(:serve)) .unwrap { |error| raise error } end |