lib/paperclip/storage.rb in thoughtbot-paperclip-2.2.7 vs lib/paperclip/storage.rb in thoughtbot-paperclip-2.2.8

- old
+ new

@@ -34,26 +34,24 @@ @queued_for_write[style] || (File.new(path(style), 'rb') if exists?(style)) end alias_method :to_io, :to_file def flush_writes #:nodoc: - logger.info("[paperclip] Writing files for #{name}") @queued_for_write.each do |style, file| file.close FileUtils.mkdir_p(File.dirname(path(style))) - logger.info("[paperclip] -> #{path(style)}") + logger.info("[paperclip] saving #{path(style)}") FileUtils.mv(file.path, path(style)) FileUtils.chmod(0644, path(style)) end @queued_for_write = {} end def flush_deletes #:nodoc: - logger.info("[paperclip] Deleting files for #{name}") @queued_for_delete.each do |path| begin - logger.info("[paperclip] -> #{path}") + logger.info("[paperclip] deleting #{path}") FileUtils.rm(path) if File.exist?(path) rescue Errno::ENOENT => e # ignore file-not-found, let everything else pass end begin @@ -149,11 +147,10 @@ "#{attachment.s3_protocol}://s3.amazonaws.com/#{attachment.bucket_name}/#{attachment.path(style).gsub(%r{^/}, "")}" end base.class.interpolations[:s3_domain_url] = lambda do |attachment, style| "#{attachment.s3_protocol}://#{attachment.bucket_name}.s3.amazonaws.com/#{attachment.path(style).gsub(%r{^/}, "")}" end - ActiveRecord::Base.logger.info("[paperclip] S3 Storage Initalized.") end def s3 @s3 ||= RightAws::S3.new(@s3_credentials[:access_key_id], @s3_credentials[:secret_access_key], @@ -191,14 +188,13 @@ @queued_for_write[style] || s3_bucket.key(path(style)) end alias_method :to_io, :to_file def flush_writes #:nodoc: - logger.info("[paperclip] Writing files for #{name}") @queued_for_write.each do |style, file| begin - logger.info("[paperclip] -> #{path(style)}") + logger.info("[paperclip] saving #{path(style)}") key = s3_bucket.key(path(style)) key.data = file key.put(nil, @s3_permissions, {'Content-type' => instance_read(:content_type)}.merge(@s3_headers)) rescue RightAws::AwsError => e raise @@ -206,13 +202,12 @@ end @queued_for_write = {} end def flush_deletes #:nodoc: - logger.info("[paperclip] Writing files for #{name}") @queued_for_delete.each do |path| begin - logger.info("[paperclip] -> #{path}") + logger.info("[paperclip] deleting #{path}") if file = s3_bucket.key(path) file.delete end rescue RightAws::AwsError # Ignore this.