Sha256: 9ae2a34ad2065af75f72c9eea265c45a96697b0f4e5fc227650f85f6db6e930d

Contents?: true

Size: 1.37 KB

Versions: 14

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true
require 'base64'

module Extension
  module Features
    class Argo
      include SmartProperties

      GIT_ADMIN_TEMPLATE = 'https://github.com/Shopify/argo-admin-template.git'
      GIT_CHECKOUT_TEMPLATE = 'https://github.com/Shopify/argo-checkout-template.git'
      SCRIPT_PATH = %w(build main.js).freeze

      class << self
        def admin
          @admin ||= Argo.new(setup: ArgoSetup.new(git_template: GIT_ADMIN_TEMPLATE))
        end

        def checkout
          @checkout ||= Argo.new(
            setup: ArgoSetup.new(
              git_template: GIT_CHECKOUT_TEMPLATE,
              dependency_checks: [ArgoDependencies.node_installed(min_major: 10, min_minor: 16)]
            )
          )
        end
      end

      property! :setup, accepts: Features::ArgoSetup

      def create(directory_name, identifier, context)
        setup.call(directory_name, identifier, context)
      end

      def config(context)
        filepath = File.join(context.root, SCRIPT_PATH)
        context.abort(context.message('features.argo.missing_file_error')) unless File.exist?(filepath)

        begin
          {
            serialized_script: Base64.strict_encode64(File.open(filepath).read.chomp),
          }
        rescue StandardError
          context.abort(context.message('features.argo.script_prepare_error'))
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shopify-cli-1.2.0 lib/project_types/extension/features/argo.rb
shopify-cli-1.1.2 lib/project_types/extension/features/argo.rb
shopify-cli-1.1.1 lib/project_types/extension/features/argo.rb
shopify-cli-1.1.0 lib/project_types/extension/features/argo.rb
shopify-cli-1.0.5 lib/project_types/extension/features/argo.rb
shopify-cli-1.0.4 lib/project_types/extension/features/argo.rb
shopify-cli-1.0.3 lib/project_types/extension/features/argo.rb
shopify-cli-1.0.2 lib/project_types/extension/features/argo.rb
shopify-cli-1.0.1 lib/project_types/extension/features/argo.rb
shopify-cli-1.0.0 lib/project_types/extension/features/argo.rb
shopify-cli-0.9.3 lib/project_types/extension/features/argo.rb
shopify-cli-0.9.2 lib/project_types/extension/features/argo.rb
shopify-cli-0.9.1 lib/project_types/extension/features/argo.rb
shopify-cli-0.9.0 lib/project_types/extension/features/argo.rb