lib/keepitsafe.rb in keepitsafe-0.2.5 vs lib/keepitsafe.rb in keepitsafe-0.2.6

- old
+ new

@@ -204,23 +204,31 @@ def do_the_stuff @log_buffer = StringIO.new @start_time = Time.now - create_backups_dir - @free_before = free_disk_space - trigger('before_backup') - begin STDCapture.capture(@log_buffer) do + + create_backups_dir + @free_before = free_disk_space + trigger('before_backup') + check_disk_left create_backup_target_dir create_pending_file yield self remove_pending_file + + upload_log + + @end_time = Time.now + @free_after = free_disk_space + set_backup_size(backup_target_dir) unless @backup_size + trigger('after_backup') end rescue StandardError => e @error = e puts e.message puts e.inspect @@ -230,15 +238,8 @@ @log_buffer.puts e.inspect @log_buffer.puts e.backtrace trigger('on_error',{:error => e}) end - - upload_log - - @end_time = Time.now - @free_after = free_disk_space - set_backup_size(backup_target_dir) unless @backup_size - trigger('after_backup') end end