Class: Bosh::Director::Models::ReleaseVersion
- Defined in:
- lib/bosh/director/models/release_version.rb
Instance Method Summary collapse
- #dependencies(package_name) ⇒ Object
- #package_by_name(package_name) ⇒ Object
- #package_cache_key(package_name, stemcell) ⇒ Object
- #package_dependency_key(package_name) ⇒ Object
- #validate ⇒ Object
Instance Method Details
#dependencies(package_name) ⇒ Object
14 15 16 17 18 |
# File 'lib/bosh/director/models/release_version.rb', line 14 def dependencies(package_name) package_by_name(package_name).dependency_set.map do |package_name| package_by_name(package_name) end end |
#package_by_name(package_name) ⇒ Object
20 21 22 |
# File 'lib/bosh/director/models/release_version.rb', line 20 def package_by_name(package_name) packages_by_name.fetch(package_name) end |
#package_cache_key(package_name, stemcell) ⇒ Object
32 33 34 35 36 |
# File 'lib/bosh/director/models/release_version.rb', line 32 def package_cache_key(package_name, stemcell) dependency_fingerprints = dependencies(package_name).sort_by(&:name).map {|p| p.fingerprint } hash_input = ([package_by_name(package_name).fingerprint, stemcell.sha1]+dependency_fingerprints).join("") Digest::SHA1.hexdigest(hash_input) end |
#package_dependency_key(package_name) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/bosh/director/models/release_version.rb', line 24 def package_dependency_key(package_name) key = dependencies(package_name).sort { |a, b| a.name <=> b.name }.map { |p| [p.name, p.version]} Yajl::Encoder.encode(key) end |