Class: Librarian::Manifest
- Inherits:
-
Object
- Object
- Librarian::Manifest
- Defined in:
- lib/librarian/manifest.rb
Defined Under Namespace
Classes: Version
Instance Attribute Summary collapse
-
#extra ⇒ Object
readonly
Returns the value of attribute extra.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #dependencies ⇒ Object
- #dependencies=(dependencies) ⇒ Object
- #dependencies? ⇒ Boolean
-
#initialize(source, name, extra = nil) ⇒ Manifest
constructor
A new instance of Manifest.
- #install! ⇒ Object
- #latest ⇒ Object
- #outdated? ⇒ Boolean
- #satisfies?(dependency) ⇒ Boolean
- #to_s ⇒ Object
- #version ⇒ Object
- #version=(version) ⇒ Object
- #version? ⇒ Boolean
Constructor Details
#initialize(source, name, extra = nil) ⇒ Manifest
Returns a new instance of Manifest.
46 47 48 49 50 51 52 |
# File 'lib/librarian/manifest.rb', line 46 def initialize(source, name, extra = nil) assert_name_valid! name self.source = source self.name = name self.extra = extra end |
Instance Attribute Details
#extra ⇒ Object
Returns the value of attribute extra.
43 44 45 |
# File 'lib/librarian/manifest.rb', line 43 def extra @extra end |
#name ⇒ Object
Returns the value of attribute name.
43 44 45 |
# File 'lib/librarian/manifest.rb', line 43 def name @name end |
#source ⇒ Object
Returns the value of attribute source.
43 44 45 |
# File 'lib/librarian/manifest.rb', line 43 def source @source end |
Instance Method Details
#dependencies ⇒ Object
80 81 82 |
# File 'lib/librarian/manifest.rb', line 80 def dependencies defined_dependencies || fetched_dependencies end |
#dependencies=(dependencies) ⇒ Object
84 85 86 |
# File 'lib/librarian/manifest.rb', line 84 def dependencies=(dependencies) self.defined_dependencies = _normalize_dependencies(dependencies) end |
#dependencies? ⇒ Boolean
88 89 90 91 92 93 94 |
# File 'lib/librarian/manifest.rb', line 88 def dependencies? return unless defined_dependencies defined_dependencies.zip(fetched_dependencies).all? do |(a, b)| a.name == b.name && a.requirement == b.requirement end end |
#install! ⇒ Object
100 101 102 |
# File 'lib/librarian/manifest.rb', line 100 def install! source.install!(self) end |
#latest ⇒ Object
72 73 74 |
# File 'lib/librarian/manifest.rb', line 72 def latest @latest ||= source.manifests(name).first end |
#outdated? ⇒ Boolean
76 77 78 |
# File 'lib/librarian/manifest.rb', line 76 def outdated? latest.version > version end |
#satisfies?(dependency) ⇒ Boolean
96 97 98 |
# File 'lib/librarian/manifest.rb', line 96 def satisfies?(dependency) dependency.requirement.satisfied_by?(version) end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/librarian/manifest.rb', line 54 def to_s "#{name}/#{version} <#{source}>" end |
#version ⇒ Object
58 59 60 |
# File 'lib/librarian/manifest.rb', line 58 def version defined_version || fetched_version end |
#version=(version) ⇒ Object
62 63 64 |
# File 'lib/librarian/manifest.rb', line 62 def version=(version) self.defined_version = _normalize_version(version) end |
#version? ⇒ Boolean
66 67 68 69 70 |
# File 'lib/librarian/manifest.rb', line 66 def version? return unless defined_version defined_version == fetched_version end |