carrierwave 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of carrierwave might be problematic. Click here for more details.
- data/README.md +716 -0
- data/lib/carrierwave.rb +7 -0
- data/lib/carrierwave/mount.rb +38 -11
- data/lib/carrierwave/orm/activerecord.rb +5 -2
- data/lib/carrierwave/orm/mongoid.rb +40 -5
- data/lib/carrierwave/processing/image_science.rb +0 -4
- data/lib/carrierwave/processing/mime_types.rb +58 -0
- data/lib/carrierwave/processing/mini_magick.rb +7 -16
- data/lib/carrierwave/sanitized_file.rb +21 -4
- data/lib/carrierwave/uploader/cache.rb +13 -4
- data/lib/carrierwave/uploader/configuration.rb +9 -9
- data/lib/carrierwave/uploader/download.rb +1 -1
- data/lib/carrierwave/uploader/processing.rb +20 -14
- data/lib/carrierwave/uploader/proxy.rb +16 -1
- data/lib/carrierwave/uploader/store.rb +11 -0
- data/lib/carrierwave/uploader/versions.rb +79 -21
- data/lib/carrierwave/version.rb +1 -1
- metadata +55 -136
- data/README.rdoc +0 -647
- data/lib/carrierwave/orm/datamapper.rb +0 -37
- data/lib/carrierwave/orm/sequel.rb +0 -45
@@ -1,37 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'dm-core'
|
4
|
-
|
5
|
-
module CarrierWave
|
6
|
-
module DataMapper
|
7
|
-
|
8
|
-
include CarrierWave::Mount
|
9
|
-
|
10
|
-
##
|
11
|
-
# See +CarrierWave::Mount#mount_uploader+ for documentation
|
12
|
-
#
|
13
|
-
def mount_uploader(column, uploader, options={}, &block)
|
14
|
-
super
|
15
|
-
|
16
|
-
alias_method :read_uploader, :attribute_get
|
17
|
-
alias_method :write_uploader, :attribute_set
|
18
|
-
after :save, "store_#{column}!".to_sym
|
19
|
-
pre_hook = ::DataMapper.const_defined?(:Validate) ? :valid? : :save
|
20
|
-
before pre_hook, "write_#{column}_identifier".to_sym
|
21
|
-
after :destroy, "remove_#{column}!".to_sym
|
22
|
-
|
23
|
-
# FIXME: Hack to work around Datamapper not triggering callbacks
|
24
|
-
# for objects that are not dirty. By explicitly calling
|
25
|
-
# attribute_set we are marking the record as dirty.
|
26
|
-
class_eval <<-RUBY
|
27
|
-
def remove_#{column}=(value)
|
28
|
-
_mounter(:#{column}).remove = value
|
29
|
-
attribute_set(:#{column}, '') if _mounter(:#{column}).remove?
|
30
|
-
end
|
31
|
-
RUBY
|
32
|
-
end
|
33
|
-
|
34
|
-
end # DataMapper
|
35
|
-
end # CarrierWave
|
36
|
-
|
37
|
-
DataMapper::Model.send(:include, CarrierWave::DataMapper)
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'sequel'
|
4
|
-
|
5
|
-
module CarrierWave
|
6
|
-
module Sequel
|
7
|
-
include CarrierWave::Mount
|
8
|
-
|
9
|
-
def mount_uploader(column, uploader)
|
10
|
-
raise "You need to use Sequel 3.0 or higher. Please upgrade." unless ::Sequel::Model.respond_to?(:plugin)
|
11
|
-
super
|
12
|
-
|
13
|
-
alias_method :read_uploader, :[]
|
14
|
-
alias_method :write_uploader, :[]=
|
15
|
-
|
16
|
-
include CarrierWave::Sequel::Hooks
|
17
|
-
include CarrierWave::Sequel::Validations
|
18
|
-
end
|
19
|
-
|
20
|
-
end # Sequel
|
21
|
-
end # CarrierWave
|
22
|
-
|
23
|
-
# Instance hook methods for the Sequel 3.x
|
24
|
-
module CarrierWave::Sequel::Hooks
|
25
|
-
def after_save
|
26
|
-
return false if super == false
|
27
|
-
self.class.uploaders.each_key {|column| self.send("store_#{column}!") }
|
28
|
-
end
|
29
|
-
|
30
|
-
def before_save
|
31
|
-
return false if super == false
|
32
|
-
self.class.uploaders.each_key {|column| self.send("write_#{column}_identifier") }
|
33
|
-
end
|
34
|
-
|
35
|
-
def before_destroy
|
36
|
-
return false if super == false
|
37
|
-
self.class.uploaders.each_key {|column| self.send("remove_#{column}!") }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# Instance validation methods for the Sequel 3.x
|
42
|
-
module CarrierWave::Sequel::Validations
|
43
|
-
end
|
44
|
-
|
45
|
-
Sequel::Model.send(:extend, CarrierWave::Sequel)
|