Class: BooticCli::Themes::ThemeDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/bootic_cli/themes/theme_diff.rb

Instance Method Summary collapse

Constructor Details

#initialize(source:, target:, force_update: false) ⇒ ThemeDiff

Returns a new instance of ThemeDiff.



7
8
9
10
# File 'lib/bootic_cli/themes/theme_diff.rb', line 7

def initialize(source:, target:, force_update: false)
  @source, @target = source, target
  @force_update = force_update
end

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/bootic_cli/themes/theme_diff.rb', line 22

def any?
  updated_in_source.any? || updated_in_target.any? || missing_in_target.any? || missing_in_source.any?
end

#missing_in_sourceObject



38
39
40
# File 'lib/bootic_cli/themes/theme_diff.rb', line 38

def missing_in_source
  @missing_in_source ||= MissingItemsTheme.new(source: target, target: source)
end

#missing_in_targetObject



34
35
36
# File 'lib/bootic_cli/themes/theme_diff.rb', line 34

def missing_in_target
  @missing_in_target ||= MissingItemsTheme.new(source: source, target: target)
end

#summaryObject



12
13
14
15
16
17
18
19
20
# File 'lib/bootic_cli/themes/theme_diff.rb', line 12

def summary
  msg = []
  msg.push(" - Updated in source: #{updated_in_source.count}") if updated_in_source.any?
  msg.push(" - Updated in target: #{updated_in_target.count}") if updated_in_target.any?
  msg.push(" - Missing in target: #{missing_in_target.count}") if missing_in_target.any?
  msg.push(" - Missing in source: #{missing_in_source.count}") if missing_in_source.any?
  msg.unshift("Summary:") if msg.any?
  msg.join("\n")
end

#updated_in_sourceObject



26
27
28
# File 'lib/bootic_cli/themes/theme_diff.rb', line 26

def updated_in_source
  @updated_in_source ||= UpdatedTheme.new(source: source, target: target, force_update: force_update)
end

#updated_in_targetObject



30
31
32
# File 'lib/bootic_cli/themes/theme_diff.rb', line 30

def updated_in_target
  @updated_in_target ||= UpdatedTheme.new(source: target, target: source, force_update: force_update)
end