Class: Dutiful::Command::Sync

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/dutiful/commands/sync.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dutiful/commands/sync.rb', line 4

def execute
  puts "Storage: #{Dutiful::Config.storage.name}\n\n"

  Dutiful::Application.each do |application|
    puts "#{application.name}:\n" if application.should_sync? || verbose?

    application.sync do |file, result|
      if result
        if result.success?
          puts "  #{file.path}".green
        else
          puts "  #{file.path} ✖ - #{result.error}".red
        end
      elsif verbose?
        puts "  #{file}"
      end
    end
  end
end