Sha256: 0c886cda0cedf82204dde2eb37d89235105e55b639b75cab12cc4077cc3b69e8

Contents?: true

Size: 981 Bytes

Versions: 64

Compression:

Stored size: 981 Bytes

Contents

# frozen_string_literal: true

module Script
  module Layers
    module Infrastructure
      class ExtensionPointRepository
        def get_extension_point(type)
          Domain::ExtensionPoint.new(type, fetch_extension_point(type))
        end

        def extension_points
          extension_point_configs.map do |type, extension_point_config|
            Domain::ExtensionPoint.new(type, extension_point_config)
          end
        end

        def extension_point_types
          extension_point_configs.keys
        end

        private

        def fetch_extension_point(type)
          raise Domain::Errors::InvalidExtensionPointError, type unless extension_point_configs[type]
          extension_point_configs[type]
        end

        def extension_point_configs
          @extension_points ||= begin
            require "yaml"
            YAML.load_file(Project.project_filepath("config/extension_points.yml"))
          end
        end
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
shopify-cli-2.25.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.24.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.23.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.22.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.21.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.20.1 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.20.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.19.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.18.1 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.18.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.17.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.16.1 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.16.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.15.6 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.15.5 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.15.4 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.15.3 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.15.2 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.15.1 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.15.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb