Sha256: ae1bf7f2af9801504ac0cbf7c9dd147ecb07c3c65f12c3a2a52850569a33df9b
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true require "shopify_cli" module Extension module Tasks class RunExtensionCommand < ShopifyCli::Task include SmartProperties SUPPORTED_EXTENSION_TYPES = [ "checkout_ui_extension", ] SUPPORTED_COMMANDS = [ "create", "build", ] property :root_dir, accepts: String property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES property! :type, accepts: SUPPORTED_EXTENSION_TYPES property! :command, accepts: SUPPORTED_COMMANDS def call ShopifyCli::Result .call(&method(:build_extension)) .then(&method(:build_server_config)) .then(&method(:run_command)) .unwrap do |error| raise error unless error.nil? end end private def build_extension Models::ServerConfig::Extension.build( template: template, type: type, root_dir: root_dir, ) end def build_server_config(extension) Models::ServerConfig::Root.new(extensions: [extension]) end def run_command(server_config) case command when "create" Models::DevelopmentServer.new.create(server_config) when "build" Models::DevelopmentServer.new.build(server_config) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shopify-cli-2.4.0 | lib/project_types/extension/tasks/run_extension_command.rb |