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.6.2 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.6.1 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.6.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.5.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.4.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.3.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.2.2 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.2.1 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.2.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.1.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.0.2 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.0.1 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-2.0.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-1.14.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-1.13.1 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-1.13.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-1.12.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-1.11.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-1.10.0 lib/project_types/script/layers/infrastructure/extension_point_repository.rb
shopify-cli-1.9.1 lib/project_types/script/layers/infrastructure/extension_point_repository.rb