Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: carrierwaveuploader/carrierwave
...
head fork: agworld/carrierwave
Checking mergeability… Don’t worry, you can still create the pull request.
  • 8 commits
  • 6 files changed
  • 0 commit comments
  • 3 contributors
Commits on Jun 25, 2011
@matpowel matpowel wait until all versions have been stored before deleting the cache di…
…r, otherwise an error is thrown when uploading multiple versions with the delete_cache_id_after_storage setting set to true
47ce078
@matpowel matpowel Merge remote branch 'upstream/master'
Conflicts:
	lib/carrierwave/uploader/store.rb
2506341
Commits on Jun 30, 2011
@matpowel matpowel make fog storage not blow out with nil errors if a file is physically…
… missing in the storage when querying meta-data, .read will still error
e702d97
Commits on Sep 08, 2011
@matpowel matpowel patch to work around the fact that versions defined on a subclass of …
…an Uploader don't get run, there may be some side effects for multiple versions within one Uploader
bd33703
Commits on May 04, 2012
@matpowel matpowel Merge remote-tracking branch 'upstream/master'
Conflicts:
	lib/carrierwave/uploader/store.rb
f04f1c2
@matpowel matpowel update README to remember what the Agworld fixes are c147f42
Commits on Mar 07, 2013
@matpowel matpowel Date require 'date' to gemspec d3d98b8
Commits on Mar 21, 2013
@jasonhutchens jasonhutchens bump the version to force usage of the new gemspec 262259a
View
6 README.md
@@ -5,6 +5,12 @@ It works well with Rack based web applications, such as Ruby on Rails.
[![Build Status](https://secure.travis-ci.org/jnicklas/carrierwave.png)](http://travis-ci.org/jnicklas/carrierwave)
+## Agworld fixes
+
+1. Don't explode with nil exceptions when there's no attachment and size, content_type or attributes are called (simple)
+1. Change the way the cache dir is deleted so it doesn't fail when there are versions
+1. Fix handling of versions for sub-classes of uploaders, this is a complex fix and may actually break when there are multiple versions, needs a spec to test that
+
## Information
* RDoc documentation [available on RubyDoc.info](http://rubydoc.info/gems/carrierwave/frames)
View
1  carrierwave.gemspec
@@ -2,6 +2,7 @@
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
+require 'date'
require 'carrierwave/version'
Gem::Specification.new do |s|
View
6 lib/carrierwave/storage/fog.rb
@@ -126,7 +126,7 @@ class File
# [Hash] attributes from file
#
def attributes
- file.attributes
+ file ? file.attributes : nil
end
##
@@ -162,7 +162,7 @@ def authenticated_url(options = {})
# [String] value of content-type
#
def content_type
- @content_type || file.content_type
+ @content_type || file ? file.content_type : nil
end
##
@@ -225,7 +225,7 @@ def read
# [Integer] size of file body
#
def size
- file.content_length
+ file ? file.content_length : nil
end
##
View
22 lib/carrierwave/uploader/store.rb
@@ -58,31 +58,11 @@ def store!(new_file=nil)
with_callbacks(:store, new_file) do
new_file = storage.store!(@file)
@file.delete if (delete_tmp_file_after_storage && ! move_to_store)
- delete_cache_id
+ # but don't delete the cache dir here because all the version files may be there
@file = new_file
- @cache_id = nil
end
end
end
-
- ##
- # Deletes a cache id (tmp dir in cache)
- #
- def delete_cache_id
- if @cache_id
- path = File.expand_path(File.join(cache_dir, @cache_id), CarrierWave.root)
- begin
- Dir.rmdir(path)
- rescue Errno::ENOENT
- # Ignore: path does not exist
- rescue Errno::ENOTDIR
- # Ignore: path is not a dir
- rescue Errno::ENOTEMPTY, Errno::EEXIST
- # Ignore: dir is not empty
- end
- end
- end
-
##
# Retrieves the file from the storage.
#
View
27 lib/carrierwave/uploader/versions.rb
@@ -84,8 +84,15 @@ def #{name}
RUBY
# as the processors get the output from the previous processors as their
# input we must not stack the processors here
- versions[name][:uploader].processors = versions[name][:uploader].processors.dup
- versions[name][:uploader].processors.clear
+
+ # MP: This code was breaking our ability to have versions defined on a sub class
+ # we need versions defined on a sub-class so they use the store_dir from the
+ # PrivateUploader in that case and so on.
+ # I'm pretty sure that this code is here to try to stop some kind of issue where
+ # versions use the output of previous versions for their input, but I can't
+ # understand how this would be a good solution anyway...
+ #versions[name][:uploader].processors = versions[name][:uploader].processors.dup
+ #versions[name][:uploader].processors.clear
end
versions[name][:uploader].class_eval(&block) if block
versions[name]
@@ -233,8 +240,24 @@ def cache_versions!(new_file)
end
end
+ ##
+ # Deletes a cache id (tmp dir in cache)
+ #
+ def delete_cache_id
+ if @cache_id
+ path = File.join(cache_dir, @cache_id)
+ FileUtils.rm_rf(path) if File.exists?(path) && File.directory?(path)
+ end
+ end
+
def store_versions!(new_file)
active_versions.each { |name, v| v.store!(new_file) }
+ if version_name.nil?
+ # At the base level, once all versions have stored completely,
+ # drop the cache dir if required
+ delete_cache_id if delete_cache_id_after_storage
+ @cache_id = nil
+ end
end
def remove_versions!
View
2  lib/carrierwave/version.rb
@@ -1,3 +1,3 @@
module CarrierWave
- VERSION = "0.6.2"
+ VERSION = "0.6.2.2"
end

No commit comments for this range

Something went wrong with that request. Please try again.