# File lib/librarian/dependency.rb, line 102 def initialize(name, requirement, source) assert_name_valid! name self.name = name self.requirement = Requirement.new(requirement) self.source = source @manifests = nil end
# File lib/librarian/dependency.rb, line 128 def ==(other) !other.nil? && self.class == other.class && self.name == other.name && self.requirement == other.requirement && self.source == other.source end
# File lib/librarian/dependency.rb, line 116 def cache_manifests! source.manifests(name) end
# File lib/librarian/dependency.rb, line 136 def consistent_with?(other) name != other.name || requirement.consistent_with?(other.requirement) end
# File lib/librarian/dependency.rb, line 140 def inconsistent_with?(other) !consistent_with?(other) end
# File lib/librarian/dependency.rb, line 112 def manifests @manifests ||= cache_manifests! end
# File lib/librarian/dependency.rb, line 120 def satisfied_by?(manifest) manifest.satisfies?(self) end
# File lib/librarian/dependency.rb, line 124 def to_s "#{name} (#{requirement}) <#{source}>" end
# File lib/librarian/dependency.rb, line 146 def assert_name_valid!(name) name =~ /\A\S(?:.*\S)?\z/ and return raise ArgumentError, "name (#{name.inspect}) must be sensible" end