Class: BooticCli::Themes::ThemeDiff
- Inherits:
-
Object
- Object
- BooticCli::Themes::ThemeDiff
- Defined in:
- lib/bootic_cli/themes/theme_diff.rb
Instance Method Summary collapse
- #any? ⇒ Boolean
-
#initialize(source:, target:, force_update: false) ⇒ ThemeDiff
constructor
A new instance of ThemeDiff.
- #missing_in_source ⇒ Object
- #missing_in_target ⇒ Object
- #summary ⇒ Object
- #updated_in_source ⇒ Object
- #updated_in_target ⇒ Object
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
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_source ⇒ Object
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_target ⇒ Object
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 |
#summary ⇒ Object
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_source ⇒ Object
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_target ⇒ Object
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 |