Sha256: 3cf99084f5bdaa80fe20783e15317bd1695ea0a010d63b3569c95930e2299f50

Contents?: true

Size: 1.41 KB

Versions: 17

Compression:

Stored size: 1.41 KB

Contents

require 'librarian/support/abstract_method'

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

      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

      def info(*args, &block)
        environment.logger.info(*args, &block)
      end

      def debug(*args, &block)
        environment.logger.debug(*args, &block)
      end

      def relative_path_to(path)
        environment.logger.relative_path_to(path)
      end

    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
librarian-puppet-0.9.10 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.9.9 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.9.8 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-maestrodev-0.9.7.5 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-maestrodev-0.9.7.4 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-maestrodev-0.9.7.3 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-maestrodev-0.9.7.2 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-maestrodev-0.9.7.1 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-maestrodev-0.9.7 vendor/librarian/lib/librarian/source/local.rb
librarian-0.0.25 lib/librarian/source/local.rb
librarian-puppet-0.9.7 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.9.6 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.9.5 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.9.4 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.9.3 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.9.2 vendor/librarian/lib/librarian/source/local.rb
librarian-puppet-0.9.2.pre vendor/librarian/lib/librarian/source/local.rb