Class: Zonesync::Repair
- Inherits:
-
Object
- Object
- Zonesync::Repair
- Defined in:
- lib/zonesync/repair.rb
Instance Method Summary collapse
- #call(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(local, remote) ⇒ Repair
constructor
A new instance of Repair.
Constructor Details
#initialize(local, remote) ⇒ Repair
Returns a new instance of Repair.
5 6 7 8 9 |
# File 'lib/zonesync/repair.rb', line 5 def initialize(local, remote) @local = local @remote = remote @remote_config = remote.config end |
Instance Method Details
#call(input: $stdin, output: $stdout) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/zonesync/repair.rb', line 11 def call(input: $stdin, output: $stdout) differences = compute_differences if differences.empty? output.puts "Already in sync!" return end output.puts "Found #{differences.length} difference#{"s" if differences.length != 1}:\n\n" actions = differences.map.with_index do |diff, i| display_difference(output, i + 1, diff) prompt_action(input, output, diff) end output.puts display_summary(output, actions) return unless confirm_apply?(input, output) apply_actions(actions) update_manifest(output) output.puts "\nRepair complete." end |