Sha256: 62a19b12edb28066e1eae64173b61eaca32426ab17073f548b5b2d9d9b21b5e9

Contents?: true

Size: 927 Bytes

Versions: 17

Compression:

Stored size: 927 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  module Model
    class PluginOrigin < RepoOrigin
      class << self
        def handle_scheme?(scheme)
          scheme == "plugin"
        end
      end

      def manifest
        @manifest ||= begin
          manifest_origin = Addressable::URI.unescape(url.path.delete_prefix("/")).split("/").first
          site.config.source_manifests.find do |manifest|
            manifest.origin.to_s == manifest_origin
          end.tap do |manifest|
            raise "Unable to locate a source manifest for #{manifest_origin}" unless manifest
          end
        end
      end

      def relative_path
        @relative_path ||= Pathname.new(
          Addressable::URI.unescape(url.path.delete_prefix("/")).split("/")[1..].join("/")
        )
      end

      def original_path
        @original_path ||= relative_path.expand_path(manifest.content)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bridgetown-core-2.0.0.beta3 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-2.0.0.beta2 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-2.0.0.beta1 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.3.4 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.3.3 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.3.2 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.3.1 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.3.0 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.3.0.beta3 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.3.0.beta2 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.3.0.beta1 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.2.0 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.2.0.beta5 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.2.0.beta4 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.2.0.beta3 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.2.0.beta2 lib/bridgetown-core/model/plugin_origin.rb
bridgetown-core-1.2.0.beta1 lib/bridgetown-core/model/plugin_origin.rb