Class: Dutiful::Command::Backup

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

Instance Method Summary collapse

Instance Method Details

#executeObject



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

def execute
  Dutiful::Logger.set quiet?, verbose?
  Dutiful::Logger.info "Storage: #{Dutiful::Config.storage.name}\n\n"

  Dutiful::Application.each do |application|
    Dutiful::Logger.info "#{application.name}:\n" if application.exist? || verbose?

    application.backup do |file, result|
      if result
        if result.success?
          Dutiful::Logger.success "  #{file.name} ✔"
        else
          Dutiful::Logger.error "  #{file.name} ✖ - #{result.error}"
        end
      elsif verbose?
        Dutiful::Logger.info "  #{file}"
      end
    end
  end
end