Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Remove unnecessary mv/unlink from Filesystem#flush_writes, complicate…
Browse files Browse the repository at this point in the history
…s some failure modes
  • Loading branch information
Kelley Reynolds committed Feb 6, 2012
1 parent 772c8e9 commit f8c2444
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 1 addition & 6 deletions lib/paperclip/storage/filesystem.rb
Expand Up @@ -38,12 +38,7 @@ def flush_writes #:nodoc:
file.close
FileUtils.mkdir_p(File.dirname(path(style_name)))
log("saving #{path(style_name)}")
begin
FileUtils.mv(file.path, path(style_name))
rescue SystemCallError
FileUtils.cp(file.path, path(style_name))
FileUtils.rm(file.path)
end
FileUtils.cp(file.path, path(style_name))
FileUtils.chmod(0666&~File.umask, path(style_name))
end

Expand Down
2 changes: 0 additions & 2 deletions test/integration_test.rb
Expand Up @@ -81,8 +81,6 @@ class IntegrationTest < Test::Unit::TestCase
original.close
tf.rewind

File.expects(:unlink).with(tf.instance_variable_get(:@tmpname))

@d2.avatar.expects(:to_file).with(:original).returns(tf)

@d2.avatar.reprocess!
Expand Down

0 comments on commit f8c2444

Please sign in to comment.