Sha256: 310d5e58bb97b2620fecab1e1012f740c3049863905f58c77eb2d4936aad0599
Contents?: true
Size: 1.88 KB
Versions: 2
Compression:
Stored size: 1.88 KB
Contents
# frozen_string_literal: true module Script module Layers module Infrastructure class PushPackageRepository include SmartProperties property! :ctx, accepts: ShopifyCli::Context def create_push_package(script_project:, script_content:, compiled_type:, metadata:, config_ui:) build_file_path = file_path(script_project.script_name, compiled_type) write_to_path(build_file_path, script_content) Domain::PushPackage.new( id: build_file_path, extension_point_type: script_project.extension_point_type, script_name: script_project.script_name, description: script_project.description, script_content: script_content, compiled_type: compiled_type, metadata: metadata, config_ui: config_ui, ) end def get_push_package(script_project:, compiled_type:, metadata:, config_ui:) build_file_path = file_path(script_project.script_name, compiled_type) raise Domain::PushPackageNotFoundError unless ctx.file_exist?(build_file_path) script_content = File.read(build_file_path) Domain::PushPackage.new( id: build_file_path, extension_point_type: script_project.extension_point_type, script_name: script_project.script_name, description: script_project.description, script_content: script_content, compiled_type: compiled_type, metadata: metadata, config_ui: config_ui, ) end private def write_to_path(path, content) ctx.mkdir_p(File.dirname(path)) ctx.write(path, content) end def file_path(script_name, compiled_type) "#{ScriptProject.current.directory}/build/#{script_name}.#{compiled_type}" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shopify-cli-1.8.0 | lib/project_types/script/layers/infrastructure/push_package_repository.rb |
shopify-cli-1.7.1 | lib/project_types/script/layers/infrastructure/push_package_repository.rb |