class Omnibus::ManifestDiff
Attributes
first[R]
second[R]
Public Class Methods
new(first, second)
click to toggle source
# File lib/omnibus/manifest_diff.rb, line 21 def initialize(first, second) @first = first @second = second end
Public Instance Methods
added()
click to toggle source
# File lib/omnibus/manifest_diff.rb, line 40 def added @added ||= (second.entry_names - first.entry_names).collect do |name| new_entry(second.entry_for(name)) end end
empty?()
click to toggle source
# File lib/omnibus/manifest_diff.rb, line 47 def empty? updated.empty? && removed.empty? && added.empty? end
removed()
click to toggle source
# File lib/omnibus/manifest_diff.rb, line 33 def removed @removed ||= (first.entry_names - second.entry_names).collect do |name| removed_entry(first.entry_for(name)) end end
updated()
click to toggle source
# File lib/omnibus/manifest_diff.rb, line 26 def updated @updated ||= (first.entry_names & second.entry_names).collect do |name| diff(first.entry_for(name), second.entry_for(name)) end.compact end
Private Instance Methods
diff(a, b)
click to toggle source
# File lib/omnibus/manifest_diff.rb, line 69 def diff(a, b) if a == b nil else { name: b.name, old_version: a.locked_version, new_version: b.locked_version, source_type: b.source_type, source: b.locked_source } end end
new_entry(entry)
click to toggle source
# File lib/omnibus/manifest_diff.rb, line 55 def new_entry(entry) { name: entry.name, new_version: entry.locked_version, source_type: entry.source_type, source: entry.locked_source } end
removed_entry(entry)
click to toggle source
# File lib/omnibus/manifest_diff.rb, line 62 def removed_entry(entry) { name: entry.name, old_version: entry.locked_version, source_type: entry.source_type, source: entry.locked_source } end