Sha256: 8111ac255be209f91c5f53777655990359be27a675336fe184075b49468f3f6a

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

require 'librarian/helpers/debug'
require 'librarian/support/abstract_method'

module Librarian
  module Source
    # Requires that the including source class have methods:
    #   #path
    #   #environment
    module Local

      include Helpers::Debug
      include Support::AbstractMethod

      abstract_method :path, :fetch_version, :fetch_dependencies

      def manifests(name)
        manifest = Manifest.new(self, name)
        [manifest].compact
      end

      def manifest(name, version, dependencies)
        manifest = Manifest.new(self, name)
        manifest.version = version
        manifest.dependencies = dependencies
        manifest
      end

      def manifest_search_paths(name)
        @manifest_search_paths ||= { }
        @manifest_search_paths[name] ||= begin
          cache!
          paths = [filesystem_path, filesystem_path.join(name)]
          paths.select{|s| s.exist?}
        end
      end

      def found_path(name)
        @_found_paths ||= { }
        @_found_paths[name] ||= begin
          paths = manifest_search_paths(name)
          paths.find{|p| manifest?(name, p)}
        end
      end

    private

      abstract_method :manifest? # (name, path) -> boolean

    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
librarian-0.0.24 lib/librarian/source/local.rb
librarian-puppet-0.9.1 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.9.0 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.0.1.pre2 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.0.1.pre vendor/librarian/lib/librarian/source/local.rb
librarian-0.0.23 lib/librarian/source/local.rb