Sha256: 5edf2917f2c76d4ddf68e03ac0d0b07a262e76133051a4fc6e96dee1de495c1a

Contents?: true

Size: 995 Bytes

Versions: 7

Compression:

Stored size: 995 Bytes

Contents

require 'rubygems'

require 'librarian/helpers/debug'

module Librarian
  class Dependency

    class Requirement < Gem::Requirement
    end

    include Helpers::Debug

    attr_reader :name, :requirement, :source

    def initialize(name, requirement, source)
      @name = name
      @requirement = Requirement.create(requirement)
      @source = source
      @manifests = nil
    end

    def manifests
      @manifests ||= cache_manifests!
    end

    def cache_manifests!
      source.cache!([self])
      source.manifests(self)
    end

    def satisfied_by?(manifest)
      manifest.satisfies?(self)
    end

    def to_s
      "#{name} (#{requirement}) <#{source}>"
    end

    def ==(other)
      !other.nil? &&
      self.class        == other.class        &&
      self.name         == other.name         &&
      self.requirement  == other.requirement  &&
      self.source       == other.source
    end

  private

    def root_module
      source.root_module
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
librarian-0.0.9 lib/librarian/dependency.rb
librarian-0.0.8 lib/librarian/dependency.rb
librarian-0.0.7 lib/librarian/dependency.rb
librarian-0.0.6 lib/librarian/dependency.rb
librarian-0.0.5 lib/librarian/dependency.rb
librarian-0.0.4 lib/librarian/dependency.rb
librarian-0.0.3 lib/librarian/dependency.rb