carrierwave 0.3.5.2 → 0.4.0

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.

Files changed (43) hide show
  1. data/Generators +1 -1
  2. data/History.txt +11 -0
  3. data/Manifest.txt +7 -5
  4. data/README.rdoc +67 -26
  5. data/Rakefile +4 -1
  6. data/features/grid_fs_storage.feature +32 -0
  7. data/features/step_definitions/general_steps.rb +6 -1
  8. data/features/support/env.rb +5 -16
  9. data/lib/carrierwave.rb +30 -61
  10. data/lib/carrierwave/compatibility/paperclip.rb +2 -2
  11. data/lib/carrierwave/core_ext/inheritable_attributes.rb +3 -3
  12. data/lib/carrierwave/mount.rb +34 -27
  13. data/lib/carrierwave/orm/activerecord.rb +2 -2
  14. data/lib/carrierwave/processing/rmagick.rb +1 -1
  15. data/lib/carrierwave/storage/abstract.rb +0 -2
  16. data/lib/carrierwave/storage/file.rb +3 -5
  17. data/lib/carrierwave/storage/grid_fs.rb +88 -0
  18. data/lib/carrierwave/storage/s3.rb +37 -69
  19. data/lib/carrierwave/uploader.rb +1 -2
  20. data/lib/carrierwave/uploader/cache.rb +21 -18
  21. data/lib/carrierwave/uploader/configuration.rb +59 -0
  22. data/lib/carrierwave/uploader/remove.rb +0 -1
  23. data/lib/carrierwave/uploader/store.rb +3 -30
  24. data/lib/carrierwave/uploader/url.rb +1 -1
  25. data/lib/carrierwave/uploader/versions.rb +1 -4
  26. data/{lib/generators → merb_generators}/uploader_generator.rb +0 -0
  27. data/rails_generators/uploader/templates/uploader.rb +3 -3
  28. data/spec/compatibility/paperclip_spec.rb +11 -2
  29. data/spec/mount_spec.rb +0 -25
  30. data/spec/orm/datamapper_spec.rb +1 -1
  31. data/spec/spec_helper.rb +3 -3
  32. data/spec/storage/grid_fs_spec.rb +76 -0
  33. data/spec/storage/s3_spec.rb +75 -0
  34. data/spec/uploader/cache_spec.rb +1 -13
  35. data/spec/uploader/configuration_spec.rb +71 -0
  36. data/spec/uploader/paths_spec.rb +1 -1
  37. data/spec/uploader/store_spec.rb +0 -16
  38. data/spec/uploader/versions_spec.rb +0 -8
  39. metadata +40 -8
  40. data/carrierwave.gemspec +0 -63
  41. data/lib/carrierwave/uploader/default_path.rb +0 -24
  42. data/lib/carrierwave/uploader/paths.rb +0 -27
  43. 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