Sha256: 9d3f2c25f18851c1f07f92fe1e613b74f23bbfb33f897523560d3955071c72df

Contents?: true

Size: 1.29 KB

Versions: 16

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Script
  module Layers
    module Application
      class BuildScript
        class << self
          def call(ctx:, task_runner:, script:)
            return if CLI::UI::Frame.open(ctx.message('script.application.building')) do
              begin
                UI::StrictSpinner.spin(ctx.message('script.application.building_script')) do |spinner|
                  build(ctx, task_runner, script)
                  spinner.update_title(ctx.message('script.application.built'))
                end
                true
              rescue StandardError => e
                CLI::UI::Frame.with_frame_color_override(:red) do
                  ctx.puts("\n{{red:#{e.message}}}")
                end
                false
              end
            end
            raise Infrastructure::Errors::BuildError
          end

          private

          def build(ctx, task_runner, script)
            script_repo = Infrastructure::ScriptRepository.new(ctx: ctx)
            script_content = script_repo.with_temp_build_context do
              task_runner.build
            end
            Infrastructure::PushPackageRepository.new(ctx: ctx)
              .create_push_package(script, script_content, task_runner.compiled_type)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
shopify-cli-1.4.1 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.4.0 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.3.1 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.3.0 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.2.0 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.1.2 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.1.1 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.1.0 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.0.5 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.0.4 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.0.3 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.0.2 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.0.1 lib/project_types/script/layers/application/build_script.rb
shopify-cli-1.0.0 lib/project_types/script/layers/application/build_script.rb
shopify-cli-0.9.3 lib/project_types/script/layers/application/build_script.rb
shopify-cli-0.9.2 lib/project_types/script/layers/application/build_script.rb