Class: Extension::Command::ExtensionCommand

Inherits:
ShopifyCLI::Command::SubCommand show all
Defined in:
lib/project_types/extension/commands/extension_command.rb

Direct Known Subclasses

Build, Check, Connect, Info, Register, Serve, Tunnel

Instance Attribute Summary

Attributes inherited from ShopifyCLI::Command

#ctx, #options

Instance Method Summary collapse

Methods inherited from ShopifyCLI::Command::SubCommand

call

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

#hidden?, #hidden_feature

Constructor Details

This class inherits a constructor from ShopifyCLI::Command

Instance Method Details

#projectObject



7
8
9
# File 'lib/project_types/extension/commands/extension_command.rb', line 7

def project
  @project ||= ExtensionProject.current
end

#specification_handlerObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/project_types/extension/commands/extension_command.rb', line 11

def specification_handler
  @specification_handler ||= begin
    identifier = project.specification_identifier
    Models::LazySpecificationHandler.new(identifier) do
      specifications = Models::Specifications.new(
        fetch_specifications: Tasks::FetchSpecifications.new(api_key: project.app.api_key, context: @ctx)
      )

      unless specifications.valid?(identifier)
        @ctx.abort(@ctx.message("errors.unknown_type", project.specification_identifier))
      end

      specifications[identifier]
    end
  end
end