Sha256: 8f9417217d7fcfcdc72de9bee39927da61ae306572d9100471f49378e159af53
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
# #!/usr/bin/env ruby require 'rubygems' rescue nil require 'aws/s3' require 'active_support' require 'active_support/dependencies' require 'digest/md5' require 'time' unless ActiveSupport::Dependencies.load_paths.include?(File.expand_path(File.dirname(__FILE__) + '/..')) ActiveSupport::Dependencies.load_paths << File.expand_path(File.dirname(__FILE__) + '/..') end module Backs3 autoload :Backup, 'backs3/backup' autoload :FileInfo, 'backs3/file_info' autoload :Storage, 'backs3/storage' def logger logger_output = @options['logger'] || $stdout @logger ||= Logger.new(logger_output) end def md5(filename) Digest::MD5.hexdigest(filename) end def save_backup_info(info) storage.store('s3backup', YAML.dump(info)) logger.info "Backup info has been stored" end def load_backup_info @backups ||= begin backup_info_file = storage.read('s3backup') || '' YAML.load(backup_info_file) || [] rescue Exception => e puts e.to_s [] end unless @backups.respond_to?(:sort) && @backups.respond_to?(:each) && @backups.respond_to?(:reject!) @backups = [] end @backups.reject! do |backup| !backup.respond_to?(:date) end @backups.sort do |a,b| a.date <=> b.date end @backups end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
backs3-0.0.5 | lib/backs3/backs3.rb |