carrierwave 0.3.5.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of carrierwave might be problematic. Click here for more details.
- data/Generators +1 -1
- data/History.txt +11 -0
- data/Manifest.txt +7 -5
- data/README.rdoc +67 -26
- data/Rakefile +4 -1
- data/features/grid_fs_storage.feature +32 -0
- data/features/step_definitions/general_steps.rb +6 -1
- data/features/support/env.rb +5 -16
- data/lib/carrierwave.rb +30 -61
- data/lib/carrierwave/compatibility/paperclip.rb +2 -2
- data/lib/carrierwave/core_ext/inheritable_attributes.rb +3 -3
- data/lib/carrierwave/mount.rb +34 -27
- data/lib/carrierwave/orm/activerecord.rb +2 -2
- data/lib/carrierwave/processing/rmagick.rb +1 -1
- data/lib/carrierwave/storage/abstract.rb +0 -2
- data/lib/carrierwave/storage/file.rb +3 -5
- data/lib/carrierwave/storage/grid_fs.rb +88 -0
- data/lib/carrierwave/storage/s3.rb +37 -69
- data/lib/carrierwave/uploader.rb +1 -2
- data/lib/carrierwave/uploader/cache.rb +21 -18
- data/lib/carrierwave/uploader/configuration.rb +59 -0
- data/lib/carrierwave/uploader/remove.rb +0 -1
- data/lib/carrierwave/uploader/store.rb +3 -30
- data/lib/carrierwave/uploader/url.rb +1 -1
- data/lib/carrierwave/uploader/versions.rb +1 -4
- data/{lib/generators → merb_generators}/uploader_generator.rb +0 -0
- data/rails_generators/uploader/templates/uploader.rb +3 -3
- data/spec/compatibility/paperclip_spec.rb +11 -2
- data/spec/mount_spec.rb +0 -25
- data/spec/orm/datamapper_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- data/spec/storage/grid_fs_spec.rb +76 -0
- data/spec/storage/s3_spec.rb +75 -0
- data/spec/uploader/cache_spec.rb +1 -13
- data/spec/uploader/configuration_spec.rb +71 -0
- data/spec/uploader/paths_spec.rb +1 -1
- data/spec/uploader/store_spec.rb +0 -16
- data/spec/uploader/versions_spec.rb +0 -8
- metadata +40 -8
- data/carrierwave.gemspec +0 -63
- data/lib/carrierwave/uploader/default_path.rb +0 -24
- data/lib/carrierwave/uploader/paths.rb +0 -27
- data/spec/uploader/default_path_spec.rb +0 -68
@@ -1,27 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module CarrierWave
|
4
|
-
module Uploader
|
5
|
-
module Paths
|
6
|
-
|
7
|
-
##
|
8
|
-
# === Returns
|
9
|
-
#
|
10
|
-
# [String] the directory that is the root of the application
|
11
|
-
#
|
12
|
-
def root
|
13
|
-
CarrierWave.config[:root]
|
14
|
-
end
|
15
|
-
|
16
|
-
##
|
17
|
-
# === Returns
|
18
|
-
#
|
19
|
-
# [String] the directory where files will be publically accessible
|
20
|
-
#
|
21
|
-
def public
|
22
|
-
CarrierWave.config[:public]
|
23
|
-
end
|
24
|
-
|
25
|
-
end # Paths
|
26
|
-
end # Uploader
|
27
|
-
end # CarrierWave
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
4
|
-
|
5
|
-
describe CarrierWave::Uploader do
|
6
|
-
|
7
|
-
before do
|
8
|
-
@uploader_class = Class.new(CarrierWave::Uploader::Base)
|
9
|
-
@uploader = @uploader_class.new
|
10
|
-
end
|
11
|
-
|
12
|
-
after do
|
13
|
-
FileUtils.rm_rf(public_path)
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'with a default path' do
|
17
|
-
before do
|
18
|
-
@uploader_class.class_eval do
|
19
|
-
def default_path
|
20
|
-
file_path('test.jpg')
|
21
|
-
end
|
22
|
-
end
|
23
|
-
@uploader = @uploader_class.new
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#blank?' do
|
27
|
-
it "should be true by default" do
|
28
|
-
@uploader.should be_blank
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#current_path' do
|
33
|
-
it "should return the default path" do
|
34
|
-
@uploader.current_path.should == file_path('test.jpg')
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe '#cache!' do
|
39
|
-
|
40
|
-
before do
|
41
|
-
CarrierWave.stub!(:generate_cache_id).and_return('20071201-1234-345-2255')
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should cache a file" do
|
45
|
-
@uploader.cache!(File.open(file_path('test.jpg')))
|
46
|
-
@uploader.file.should be_an_instance_of(CarrierWave::SanitizedFile)
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should be cached" do
|
50
|
-
@uploader.cache!(File.open(file_path('test.jpg')))
|
51
|
-
@uploader.should be_cached
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should no longer be blank" do
|
55
|
-
@uploader.cache!(File.open(file_path('test.jpg')))
|
56
|
-
@uploader.should_not be_blank
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should set the current_path" do
|
60
|
-
@uploader.cache!(File.open(file_path('test.jpg')))
|
61
|
-
@uploader.current_path.should == public_path('uploads/tmp/20071201-1234-345-2255/test.jpg')
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|