Sha256: 4d9d9b8953efacee98a4edb8c9530b87918ebd55daea4cfe344fe839457b1903

Contents?: true

Size: 1.2 KB

Versions: 10

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

module Script
  module Commands
    class Push < ShopifyCli::Command
      options do |parser, flags|
        parser.on('--force') { |t| flags[:force] = t }
      end

      def call(_args, _name)
        ShopifyCli::Tasks::EnsureEnv.call(@ctx, required: [:api_key, :secret, :shop])
        project = ScriptProject.current
        api_key = project.env[:api_key]
        return @ctx.puts(self.class.help) unless api_key &&
          ScriptProject::SUPPORTED_LANGUAGES.include?(project.language)
        Layers::Application::PushScript.call(
          ctx: @ctx,
          language: project.language,
          extension_point_type: project.extension_point_type,
          script_name: project.script_name,
          source_file: project.source_file,
          api_key: api_key,
          force: options.flags.key?(:force)
        )
        @ctx.puts(@ctx.message('script.push.script_pushed', api_key: api_key))
      rescue StandardError => e
        UI::ErrorHandler.pretty_print_and_raise(e, failed_op: @ctx.message('script.push.error.operation_failed'))
      end

      def self.help
        ShopifyCli::Context.message('script.push.help', ShopifyCli::TOOL_NAME)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shopify-cli-1.5.0 lib/project_types/script/commands/push.rb
shopify-cli-1.4.1 lib/project_types/script/commands/push.rb
shopify-cli-1.4.0 lib/project_types/script/commands/push.rb
shopify-cli-1.3.1 lib/project_types/script/commands/push.rb
shopify-cli-1.3.0 lib/project_types/script/commands/push.rb
shopify-cli-1.2.0 lib/project_types/script/commands/push.rb
shopify-cli-1.1.2 lib/project_types/script/commands/push.rb
shopify-cli-1.1.1 lib/project_types/script/commands/push.rb
shopify-cli-1.1.0 lib/project_types/script/commands/push.rb
shopify-cli-1.0.5 lib/project_types/script/commands/push.rb