lib/understudy/cli.rb in understudy-0.0.9 vs lib/understudy/cli.rb in understudy-0.0.10

- old
+ new

@@ -1,7 +1,8 @@ require 'ostruct' require 'fileutils' +require 'logger' module Understudy class CLI < Thor desc "perform [job]", "Perform backup [job]" @@ -77,27 +78,27 @@ command << config.source command << config.dest run command, log - - log.info "Backup successful" end private def run(command, log) friendly = nil if command.is_a? Array friendly = command.map { |i| i =~ /[^-=\/\.\w]/ ? "#{i}" : i }.join ' ' log.info "Running: #{friendly}" - RdiffSimple.execute( friendly ) or log.error "Could not run #{friendly}" + RdiffSimple::RdiffBackup.execute( friendly ) or log.error "Could not run #{friendly}" else friendly = command log.info "Running: #{friendly}" - RdiffSimple.execute( friendly ) or log.error "Could not run #{friendly}" + RdiffSimple::RdiffBackup.execute( friendly ) or log.error "Could not run #{friendly}" end if $? != 0 log.error "Could not run #{friendly}" + else + log.info "Backup successful" end end end end