Class: Extension::Command::Check

Inherits:
ExtensionCommand show all
Defined in:
lib/project_types/extension/commands/check.rb

Defined Under Namespace

Classes: CheckOptions

Instance Attribute Summary

Attributes inherited from ShopifyCLI::Command

#ctx, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ExtensionCommand

#project, #specification_handler

Methods inherited from ShopifyCLI::Command::SubCommand

call

Methods inherited from ShopifyCLI::Command

call, call_help, check_node_version, check_ruby_version, check_version, 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

#initializeCheck

Returns a new instance of Check.



25
26
27
28
29
30
31
# File 'lib/project_types/extension/commands/check.rb', line 25

def initialize(*)
  super
  if project.specification_identifier == "THEME_APP_EXTENSION"
    @theme_check = ThemeCheck::Cli.new
    self.options = CheckOptions.new(@ctx, @theme_check)
  end
end

Class Method Details

.helpObject



46
47
48
# File 'lib/project_types/extension/commands/check.rb', line 46

def self.help
  ShopifyCLI::Context.message("check.help", ShopifyCLI::TOOL_NAME)
end

Instance Method Details

#callObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/project_types/extension/commands/check.rb', line 33

def call(*)
  if project.specification_identifier == "THEME_APP_EXTENSION"
    begin
      @theme_check.run!
    rescue ThemeCheck::Cli::Abort, ThemeCheck::ThemeCheckError => e
      raise ShopifyCLI::Abort,
        ShopifyCLI::Context.message("theme.check.error", e.full_message)
    end
  else
    @ctx.abort(@ctx.message("check.unsupported", project.specification_identifier))
  end
end