Sha256: 61395cea6578c8b2dda2a457536048f080a7dbbace3d0e27e05eec6125870989
Contents?: true
Size: 1.84 KB
Versions: 5
Compression:
Stored size: 1.84 KB
Contents
module Extension module Tasks class ConfigureFeatures include ShopifyCli::MethodObject class Error < RuntimeError; end class UnknownSurfaceArea < Error; end class UnspecifiedSurfaceArea < Error; end def call(specification_attribute_sets) specification_attribute_sets.each do |attributes| argo_configuration = extract_argo_configuration(attributes) next if argo_configuration.nil? surface_area = extract_surface_area(argo_configuration) surface_area_configuration = fetch_surface_area_configuration(surface_area) argo_configuration.merge!(surface_area_configuration) end end private def extract_argo_configuration(attributes) attributes.dig(:features, :argo) end def extract_surface_area(argo_configuration) argo_configuration.fetch(:surface) do raise UnspecifiedSurfaceArea, "Argo configuration does not specify surface area" end end def fetch_surface_area_configuration(surface_area) surface_area_configurations.fetch(surface_area.to_sym) do raise UnknownSurfaceArea, "Unknown surface area: #{surface_area}" end end def surface_area_configurations { admin: { git_template: "https://github.com/Shopify/argo-admin-template.git", renderer_package_name: "@shopify/argo-admin", required_fields: [:shop, :api_key], required_shop_beta_flags: [:argo_admin_beta], cli_package_name: "@shopify/argo-admin-cli", }, checkout: { git_template: "https://github.com/Shopify/argo-checkout-template.git", renderer_package_name: "@shopify/argo-checkout", cli_package_name: "@shopify/argo-run", }, } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems