lib/new_backup/mys3.rb in new_backup-1.0.3 vs lib/new_backup/mys3.rb in new_backup-1.0.4

- old
+ new

@@ -54,11 +54,12 @@ # *connection*:: S3 connection to use # *bucket_name*:: name of the bucket to use in S3 # *&block*:: block passed to evaluate in context of bucket # (If no block given simply return the bucket pointer.) def connect_bucket(connection, bucket_name, &block) - debug "#{self.class}##{__method__}:#{__LINE__}: connection: #{connection.inspect}" + debug "#{self.class}##{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: connection: #{connection.inspect}" + info "Connecting to #{bucket_name}" buckets = connection.directories raise "No buckets!" if buckets.nil? || buckets.empty? bucket = connection.directories.get(bucket_name) raise "No bucket #{bucket_name}" if bucket.nil? @@ -77,10 +78,11 @@ # Do the heavy lifing to put the file in the appropriate bucket # # bucket:: directory where to put the file # fn:: name of file to upload (gzipped) def put_file(bucket,fn) + info "Saving #{fn} to #{bucket.key}" s3_fn = File.join(@options[:s3][:prefix], File.basename(fn)) options = { :key => s3_fn, :body => File.open(fn,'r'), :acl => 'authenticated-read', @@ -103,9 +105,10 @@ files = bucket.files.all('prefix' => @options[:s3][:prefix]) return if files.nil? || files.empty? if files.count > keep + info "Pruning down to #{keep} files" files.sort {|x,y| x.last_modified <=> y.last_modified}. take(files.count - keep). map(&:destroy) end