jnicklas-carrierwave 0.3.2.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/History.txt +68 -0
  2. data/Manifest.txt +89 -0
  3. data/README.rdoc +32 -4
  4. data/Rakefile +5 -2
  5. data/carrierwave.gemspec +63 -0
  6. data/cucumber.yml +2 -0
  7. data/features/caching.feature +28 -0
  8. data/features/file_storage.feature +37 -0
  9. data/features/file_storage_overridden_filename.feature +38 -0
  10. data/features/file_storage_overridden_store_dir.feature +38 -0
  11. data/features/file_storage_reversing_processor.feature +43 -0
  12. data/features/fixtures/bork.txt +1 -0
  13. data/features/fixtures/monkey.txt +1 -0
  14. data/features/mount_activerecord.feature +46 -0
  15. data/features/mount_datamapper.feature +46 -0
  16. data/features/step_definitions/activerecord_steps.rb +22 -0
  17. data/features/step_definitions/caching_steps.rb +14 -0
  18. data/features/step_definitions/datamapper_steps.rb +29 -0
  19. data/features/step_definitions/file_steps.rb +42 -0
  20. data/features/step_definitions/general_steps.rb +80 -0
  21. data/features/step_definitions/mount_steps.rb +19 -0
  22. data/features/step_definitions/store_steps.rb +18 -0
  23. data/features/support/activerecord.rb +30 -0
  24. data/features/support/datamapper.rb +7 -0
  25. data/features/support/env.rb +35 -0
  26. data/features/versions_basics.feature +50 -0
  27. data/features/versions_nested_versions.feature +70 -0
  28. data/features/versions_overridden_filename.feature +51 -0
  29. data/features/versions_overriden_store_dir.feature +41 -0
  30. data/lib/carrierwave.rb +6 -1
  31. data/lib/carrierwave/orm/mongomapper.rb +27 -0
  32. data/script/console +10 -0
  33. data/script/destroy +14 -0
  34. data/script/generate +14 -0
  35. data/spec/orm/mongomapper_spec.rb +184 -0
  36. metadata +153 -33
  37. data/LICENSE +0 -20
@@ -0,0 +1,68 @@
1
+ === Version 0.3.3 2009-08-29
2
+
3
+ * [added] Support for MongoMapper
4
+ * [added] Support for CNamed Bucket URLs for Amazon S3
5
+
6
+ === Version 0.3.2 2009-07-18
7
+
8
+ Incremental upgrade
9
+
10
+ * [added] Ruby 1.9 compatibility
11
+ * [changed] Added Object#blank? implementation into CarrierWave, which removes any dpendencies on external libraries (extlib/activesupport)
12
+ * [fixed] Performance issues with S3 support
13
+ * [fixed] Sequel support for newer verions of Sequel (thanks Pavel!)
14
+
15
+ === Version 0.3.1 2009-07-01
16
+
17
+ A bugfix release. Drop in compatible with 0.3.0.
18
+
19
+ * [fixed] Saving a record with a mounted Uploader no longer removes uploaded file
20
+ * [fixed] The file returned by S3 storage now has the path set to the full store path
21
+ * [added] File returned by S3 storage now responds to S3 specific methods
22
+
23
+ === 0.3 2009-06-20
24
+
25
+ This is a stabilization release. Most features are now working as expected and
26
+ most bugs should be fixed.
27
+
28
+ * [changed] Reworked how storage engines work, some internal API changes
29
+ * [added] Macro-like methods for RMagick, no need to call #process any more!
30
+ * [added] Ability to super to any Mount method
31
+ * [fixed] Sequel support should now work as expected
32
+ * [fixed] ActiveRecord no longer saves the record twice
33
+ * [added] Added convenient macro style class methods to rmagick processing
34
+
35
+ === 0.2.4 2009-06-11
36
+
37
+ * [added] `resize_to_limit` method for rmagick
38
+ * [added] Now deletes files from Amazon S3 when record is destroyed
39
+
40
+ === 0.2.3 2009-05-13
41
+
42
+ * [changed] Mount now no longer returns nil if there is no stored file, it returns a blank uploader instead
43
+ * [added] Possibility to specify a default path
44
+ * [added] Paperclip compatibility module
45
+
46
+ === 0.2.1 2009-05-01
47
+
48
+ * [changed] Url method now optionally takes versions as parameters (like Paperclip)
49
+ * [added] A field which allows files to be removed with a checkbox in mount
50
+ * [added] Mount_on option for Mount, to be able to override the serialization column
51
+ * [added] Added demeter friendly column_url method to Mount
52
+ * [added] Option to not copy files to cache dir, to prevent writes on read only fs systems (this is a workaround and needs a better solution)
53
+
54
+
55
+ === 0.2 2009-04-15
56
+
57
+ * [changed] The version is no longer stored in the store dir. This will break the paths for files uploaded with 0.1
58
+ * [changed] CarrierWave::Uploader is now a module, not a class, so you need to include it, not inherit from it.
59
+ * [added] Integiry checking in uploaders via a white list of extensions
60
+ * [added] Validations for integrity and processing in ActiveRecord, activated by default
61
+ * [added] Support for nested versions
62
+ * [added] Permissions option to set the permissions of the uploaded files
63
+ * [added] Support for Sequel
64
+ * [added] CarrierWave::Uploader#read to read the contents of the uploaded files
65
+
66
+ === 0.1 2009-03-12
67
+
68
+ This is a very experimental release that has not been well tested. All of the major features are in place though. Please note that there currently is a bug with load paths in Merb, which means you need to manually require uploaders.
@@ -0,0 +1,89 @@
1
+ Generators
2
+ History.txt
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ carrierwave.gemspec
7
+ cucumber.yml
8
+ features/caching.feature
9
+ features/file_storage.feature
10
+ features/file_storage_overridden_filename.feature
11
+ features/file_storage_overridden_store_dir.feature
12
+ features/file_storage_reversing_processor.feature
13
+ features/fixtures/bork.txt
14
+ features/fixtures/monkey.txt
15
+ features/mount_activerecord.feature
16
+ features/mount_datamapper.feature
17
+ features/step_definitions/activerecord_steps.rb
18
+ features/step_definitions/caching_steps.rb
19
+ features/step_definitions/datamapper_steps.rb
20
+ features/step_definitions/file_steps.rb
21
+ features/step_definitions/general_steps.rb
22
+ features/step_definitions/mount_steps.rb
23
+ features/step_definitions/store_steps.rb
24
+ features/support/activerecord.rb
25
+ features/support/datamapper.rb
26
+ features/support/env.rb
27
+ features/versions_basics.feature
28
+ features/versions_nested_versions.feature
29
+ features/versions_overridden_filename.feature
30
+ features/versions_overriden_store_dir.feature
31
+ lib/carrierwave.rb
32
+ lib/carrierwave/compatibility/paperclip.rb
33
+ lib/carrierwave/core_ext/blank.rb
34
+ lib/carrierwave/core_ext/inheritable_attributes.rb
35
+ lib/carrierwave/core_ext/module_setup.rb
36
+ lib/carrierwave/mount.rb
37
+ lib/carrierwave/orm/activerecord.rb
38
+ lib/carrierwave/orm/datamapper.rb
39
+ lib/carrierwave/orm/mongomapper.rb
40
+ lib/carrierwave/orm/sequel.rb
41
+ lib/carrierwave/processing/image_science.rb
42
+ lib/carrierwave/processing/rmagick.rb
43
+ lib/carrierwave/sanitized_file.rb
44
+ lib/carrierwave/storage/abstract.rb
45
+ lib/carrierwave/storage/file.rb
46
+ lib/carrierwave/storage/s3.rb
47
+ lib/carrierwave/test/matchers.rb
48
+ lib/carrierwave/uploader.rb
49
+ lib/carrierwave/uploader/cache.rb
50
+ lib/carrierwave/uploader/callbacks.rb
51
+ lib/carrierwave/uploader/default_path.rb
52
+ lib/carrierwave/uploader/extension_whitelist.rb
53
+ lib/carrierwave/uploader/mountable.rb
54
+ lib/carrierwave/uploader/paths.rb
55
+ lib/carrierwave/uploader/processing.rb
56
+ lib/carrierwave/uploader/proxy.rb
57
+ lib/carrierwave/uploader/remove.rb
58
+ lib/carrierwave/uploader/store.rb
59
+ lib/carrierwave/uploader/url.rb
60
+ lib/carrierwave/uploader/versions.rb
61
+ lib/generators/uploader_generator.rb
62
+ rails_generators/uploader/USAGE
63
+ rails_generators/uploader/templates/uploader.rb
64
+ rails_generators/uploader/uploader_generator.rb
65
+ script/console
66
+ script/destroy
67
+ script/generate
68
+ spec/compatibility/paperclip_spec.rb
69
+ spec/fixtures/bork.txt
70
+ spec/fixtures/test.jpeg
71
+ spec/fixtures/test.jpg
72
+ spec/mount_spec.rb
73
+ spec/orm/activerecord_spec.rb
74
+ spec/orm/datamapper_spec.rb
75
+ spec/orm/mongomapper_spec.rb
76
+ spec/orm/sequel_spec.rb
77
+ spec/sanitized_file_spec.rb
78
+ spec/spec_helper.rb
79
+ spec/uploader/cache_spec.rb
80
+ spec/uploader/default_path_spec.rb
81
+ spec/uploader/extension_whitelist_spec.rb
82
+ spec/uploader/mountable_spec.rb
83
+ spec/uploader/paths_spec.rb
84
+ spec/uploader/processing_spec.rb
85
+ spec/uploader/proxy_spec.rb
86
+ spec/uploader/remove_spec.rb
87
+ spec/uploader/store_spec.rb
88
+ spec/uploader/url_spec.rb
89
+ spec/uploader/versions_spec.rb
@@ -69,7 +69,7 @@ Most of the time you are going to want to use CarrierWave together with an ORM.
69
69
  It is quite simple to mount uploaders on columns in your model, so you can
70
70
  simply assign files and get going:
71
71
 
72
- === ActiveRecord, DataMapper, Sequel
72
+ === ActiveRecord, DataMapper, Sequel, MongoMapper
73
73
 
74
74
  If you are *not* using Merb or Rails you'll need to require the relevant ORM
75
75
  extension.
@@ -77,6 +77,7 @@ extension.
77
77
  require 'carrierwave/orm/activerecord'
78
78
  require 'carrierwave/orm/datamapper'
79
79
  require 'carrierwave/orm/sequel'
80
+ require 'carrierwave/orm/mongomapper'
80
81
 
81
82
  Open your model file, for ActiveRecord do something like:
82
83
 
@@ -301,14 +302,41 @@ These people have contributed their time and effort to CarrierWave:
301
302
 
302
303
  * Jonas Nicklas
303
304
  * Pavel Kunc
305
+ * Andrew Timberlake
304
306
 
305
307
  == License
306
308
 
307
- MIT-License, see the separate LICENSE file in the source distribution.
309
+ Copyright (c) 2008 Jonas Nicklas
308
310
 
309
- == Read the source
311
+ Permission is hereby granted, free of charge, to any person obtaining
312
+ a copy of this software and associated documentation files (the
313
+ "Software"), to deal in the Software without restriction, including
314
+ without limitation the rights to use, copy, modify, merge, publish,
315
+ distribute, sublicense, and/or sell copies of the Software, and to
316
+ permit persons to whom the Software is furnished to do so, subject to
317
+ the following conditions:
318
+
319
+ The above copyright notice and this permission notice shall be
320
+ included in all copies or substantial portions of the Software.
321
+
322
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
323
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
324
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
325
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
326
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
327
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
328
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
329
+
330
+ == Development
331
+
332
+ If you want to run the tests (and you should) it might be convenient to install
333
+ the development dependencies, you can do that with:
334
+
335
+ sudo gem install carrierwave --development
310
336
 
311
337
  CarrierWave is still young, but most of it is pretty well documented. It is also
312
338
  extensively specced, and there are cucumber features for some common use cases.
313
339
  Just dig in and look at the source for more in-depth explanation of what things
314
- are doing.
340
+ are doing.
341
+
342
+ Issues are reported on GitHub, pull requests are very welcome!
data/Rakefile CHANGED
@@ -2,7 +2,8 @@ require 'rubygems'
2
2
  gem 'hoe', '>= 2.1.0'
3
3
  require 'hoe'
4
4
  require 'fileutils'
5
- require './lib/carrierwave'
5
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
6
+ require 'carrierwave'
6
7
 
7
8
  Hoe.plugin :newgem
8
9
  # Hoe.plugin :website
@@ -16,11 +17,13 @@ $hoe = Hoe.spec 'carrierwave' do
16
17
  self.extra_dev_deps << ['rspec', '>=1.2.8']
17
18
  self.extra_dev_deps << ['cucumber', '>=0.3.96']
18
19
  self.extra_dev_deps << ['activerecord', '>=2.3.3']
20
+ self.extra_dev_deps << ['sqlite3-ruby', '>=2.3.3']
19
21
  self.extra_dev_deps << ['dm-core', '>=0.9.11']
22
+ self.extra_dev_deps << ['do_sqlite3', '>=0.9.11']
20
23
  self.extra_dev_deps << ['sequel', '>=3.2.0']
21
24
  self.extra_dev_deps << ['rmagick', '>=2.10.0']
25
+ self.extra_dev_deps << ['jnunemaker-mongomapper', '>=0.3.3']
22
26
  self.extra_rdoc_files << 'README.rdoc'
23
- self.extra_rdoc_files << 'LICENSE'
24
27
  end
25
28
 
26
29
  require 'newgem/tasks'
@@ -0,0 +1,63 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{carrierwave}
5
+ s.version = "0.3.3"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Jonas Nicklas"]
9
+ s.date = %q{2009-08-29}
10
+ s.description = %q{* RDoc Documentation {available at Rubyforge}[http://carrierwave.rubyforge.org/].
11
+ * Source code {hosted at GitHub}[http://github.com/jnicklas/carrierwave]
12
+ * Please {report any issues}[http://github.com/jnicklas/carrierwave/issues] on GitHub
13
+ * Please direct any questions at the {mailing list}[http://groups.google.com/group/carrierwave]}
14
+ s.email = ["jonas.nicklas@gmail.com"]
15
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "features/fixtures/bork.txt", "features/fixtures/monkey.txt", "README.rdoc"]
16
+ s.files = ["Generators", "History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "carrierwave.gemspec", "cucumber.yml", "features/caching.feature", "features/file_storage.feature", "features/file_storage_overridden_filename.feature", "features/file_storage_overridden_store_dir.feature", "features/file_storage_reversing_processor.feature", "features/fixtures/bork.txt", "features/fixtures/monkey.txt", "features/mount_activerecord.feature", "features/mount_datamapper.feature", "features/step_definitions/activerecord_steps.rb", "features/step_definitions/caching_steps.rb", "features/step_definitions/datamapper_steps.rb", "features/step_definitions/file_steps.rb", "features/step_definitions/general_steps.rb", "features/step_definitions/mount_steps.rb", "features/step_definitions/store_steps.rb", "features/support/activerecord.rb", "features/support/datamapper.rb", "features/support/env.rb", "features/versions_basics.feature", "features/versions_nested_versions.feature", "features/versions_overridden_filename.feature", "features/versions_overriden_store_dir.feature", "lib/carrierwave.rb", "lib/carrierwave/compatibility/paperclip.rb", "lib/carrierwave/core_ext/blank.rb", "lib/carrierwave/core_ext/inheritable_attributes.rb", "lib/carrierwave/core_ext/module_setup.rb", "lib/carrierwave/mount.rb", "lib/carrierwave/orm/activerecord.rb", "lib/carrierwave/orm/datamapper.rb", "lib/carrierwave/orm/mongomapper.rb", "lib/carrierwave/orm/sequel.rb", "lib/carrierwave/processing/image_science.rb", "lib/carrierwave/processing/rmagick.rb", "lib/carrierwave/sanitized_file.rb", "lib/carrierwave/storage/abstract.rb", "lib/carrierwave/storage/file.rb", "lib/carrierwave/storage/s3.rb", "lib/carrierwave/test/matchers.rb", "lib/carrierwave/uploader.rb", "lib/carrierwave/uploader/cache.rb", "lib/carrierwave/uploader/callbacks.rb", "lib/carrierwave/uploader/default_path.rb", "lib/carrierwave/uploader/extension_whitelist.rb", "lib/carrierwave/uploader/mountable.rb", "lib/carrierwave/uploader/paths.rb", "lib/carrierwave/uploader/processing.rb", "lib/carrierwave/uploader/proxy.rb", "lib/carrierwave/uploader/remove.rb", "lib/carrierwave/uploader/store.rb", "lib/carrierwave/uploader/url.rb", "lib/carrierwave/uploader/versions.rb", "lib/generators/uploader_generator.rb", "rails_generators/uploader/USAGE", "rails_generators/uploader/templates/uploader.rb", "rails_generators/uploader/uploader_generator.rb", "script/console", "script/destroy", "script/generate", "spec/compatibility/paperclip_spec.rb", "spec/fixtures/bork.txt", "spec/fixtures/test.jpeg", "spec/fixtures/test.jpg", "spec/mount_spec.rb", "spec/orm/activerecord_spec.rb", "spec/orm/datamapper_spec.rb", "spec/orm/mongomapper_spec.rb", "spec/orm/sequel_spec.rb", "spec/sanitized_file_spec.rb", "spec/spec_helper.rb", "spec/uploader/cache_spec.rb", "spec/uploader/default_path_spec.rb", "spec/uploader/extension_whitelist_spec.rb", "spec/uploader/mountable_spec.rb", "spec/uploader/paths_spec.rb", "spec/uploader/processing_spec.rb", "spec/uploader/proxy_spec.rb", "spec/uploader/remove_spec.rb", "spec/uploader/store_spec.rb", "spec/uploader/url_spec.rb", "spec/uploader/versions_spec.rb"]
17
+ s.homepage = %q{http://carrierwave.rubyforge.org}
18
+ s.rdoc_options = ["--main", "README.rdoc"]
19
+ s.require_paths = ["lib"]
20
+ s.rubyforge_project = %q{carrierwave}
21
+ s.rubygems_version = %q{1.3.5}
22
+ s.summary = %q{* RDoc Documentation {available at Rubyforge}[http://carrierwave.rubyforge.org/]}
23
+
24
+ if s.respond_to? :specification_version then
25
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
26
+ s.specification_version = 3
27
+
28
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
29
+ s.add_development_dependency(%q<rspec>, [">= 1.2.8"])
30
+ s.add_development_dependency(%q<cucumber>, [">= 0.3.96"])
31
+ s.add_development_dependency(%q<activerecord>, [">= 2.3.3"])
32
+ s.add_development_dependency(%q<sqlite3-ruby>, [">= 2.3.3"])
33
+ s.add_development_dependency(%q<dm-core>, [">= 0.9.11"])
34
+ s.add_development_dependency(%q<do_sqlite3>, [">= 0.9.11"])
35
+ s.add_development_dependency(%q<sequel>, [">= 3.2.0"])
36
+ s.add_development_dependency(%q<rmagick>, [">= 2.10.0"])
37
+ s.add_development_dependency(%q<jnunemaker-mongomapper>, [">= 0.3.3"])
38
+ s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
39
+ else
40
+ s.add_dependency(%q<rspec>, [">= 1.2.8"])
41
+ s.add_dependency(%q<cucumber>, [">= 0.3.96"])
42
+ s.add_dependency(%q<activerecord>, [">= 2.3.3"])
43
+ s.add_dependency(%q<sqlite3-ruby>, [">= 2.3.3"])
44
+ s.add_dependency(%q<dm-core>, [">= 0.9.11"])
45
+ s.add_dependency(%q<do_sqlite3>, [">= 0.9.11"])
46
+ s.add_dependency(%q<sequel>, [">= 3.2.0"])
47
+ s.add_dependency(%q<rmagick>, [">= 2.10.0"])
48
+ s.add_dependency(%q<jnunemaker-mongomapper>, [">= 0.3.3"])
49
+ s.add_dependency(%q<hoe>, [">= 2.3.3"])
50
+ end
51
+ else
52
+ s.add_dependency(%q<rspec>, [">= 1.2.8"])
53
+ s.add_dependency(%q<cucumber>, [">= 0.3.96"])
54
+ s.add_dependency(%q<activerecord>, [">= 2.3.3"])
55
+ s.add_dependency(%q<sqlite3-ruby>, [">= 2.3.3"])
56
+ s.add_dependency(%q<dm-core>, [">= 0.9.11"])
57
+ s.add_dependency(%q<do_sqlite3>, [">= 0.9.11"])
58
+ s.add_dependency(%q<sequel>, [">= 3.2.0"])
59
+ s.add_dependency(%q<rmagick>, [">= 2.10.0"])
60
+ s.add_dependency(%q<jnunemaker-mongomapper>, [">= 0.3.3"])
61
+ s.add_dependency(%q<hoe>, [">= 2.3.3"])
62
+ end
63
+ end
@@ -0,0 +1,2 @@
1
+ default: --format pretty --no-source
2
+ html: --format html --out features.html
@@ -0,0 +1,28 @@
1
+ Feature: uploader with file storage
2
+ In order to be able to temporarily store files to disk
3
+ As a developer using CarrierWave
4
+ I want to cache files
5
+
6
+ Scenario: cache a file
7
+ Given an uploader class that uses the 'file' storage
8
+ And an instance of that class
9
+ When I cache the file 'fixtures/bork.txt'
10
+ Then there should be a file called 'bork.txt' somewhere in a subdirectory of 'public/uploads/tmp'
11
+ And the file called 'bork.txt' in a subdirectory of 'public/uploads/tmp' should be identical to the file at 'fixtures/bork.txt'
12
+
13
+ Scenario: cache two files in succession
14
+ Given an uploader class that uses the 'file' storage
15
+ And an instance of that class
16
+ When I cache the file 'fixtures/bork.txt'
17
+ Then there should be a file called 'bork.txt' somewhere in a subdirectory of 'public/uploads/tmp'
18
+ And the file called 'bork.txt' in a subdirectory of 'public/uploads/tmp' should be identical to the file at 'fixtures/bork.txt'
19
+ When I cache the file 'fixtures/monkey.txt'
20
+ Then there should be a file called 'monkey.txt' somewhere in a subdirectory of 'public/uploads/tmp'
21
+ And the file called 'monkey.txt' in a subdirectory of 'public/uploads/tmp' should be identical to the file at 'fixtures/monkey.txt'
22
+
23
+ Scenario: retrieving a file from cache
24
+ Given an uploader class that uses the 'file' storage
25
+ And an instance of that class
26
+ And the file 'fixtures/bork.txt' is cached file at 'public/uploads/tmp/20090212-2343-8336-0348/bork.txt'
27
+ When I retrieve the cache name '20090212-2343-8336-0348/bork.txt' from the cache
28
+ Then the uploader should have 'public/uploads/tmp/20090212-2343-8336-0348/bork.txt' as its current path
@@ -0,0 +1,37 @@
1
+ Feature: uploader with file storage
2
+ In order to be awesome
3
+ As a developer using CarrierWave
4
+ I want to upload files to the filesystem
5
+
6
+ Background:
7
+ Given an uploader class that uses the 'file' storage
8
+ And an instance of that class
9
+
10
+ Scenario: store a file
11
+ When I store the file 'fixtures/bork.txt'
12
+ Then there should be a file at 'public/uploads/bork.txt'
13
+ And the file at 'public/uploads/bork.txt' should be identical to the file at 'fixtures/bork.txt'
14
+
15
+ Scenario: store two files in succession
16
+ When I store the file 'fixtures/bork.txt'
17
+ Then there should be a file at 'public/uploads/bork.txt'
18
+ And the file at 'public/uploads/bork.txt' should be identical to the file at 'fixtures/bork.txt'
19
+ When I store the file 'fixtures/monkey.txt'
20
+ Then there should be a file at 'public/uploads/monkey.txt'
21
+ And the file at 'public/uploads/monkey.txt' should be identical to the file at 'fixtures/monkey.txt'
22
+
23
+ Scenario: cache a file and then store it
24
+ When I cache the file 'fixtures/bork.txt'
25
+ Then there should be a file called 'bork.txt' somewhere in a subdirectory of 'public/uploads/tmp'
26
+ And the file called 'bork.txt' in a subdirectory of 'public/uploads/tmp' should be identical to the file at 'fixtures/bork.txt'
27
+ And there should not be a file at 'public/uploads/bork.txt'
28
+ When I store the file
29
+ Then there should be a file at 'public/uploads/bork.txt'
30
+ And the file at 'public/uploads/bork.txt' should be identical to the file at 'fixtures/bork.txt'
31
+
32
+ Scenario: retrieving a file from cache then storing
33
+ Given the file 'fixtures/bork.txt' is cached file at 'public/uploads/tmp/20090212-2343-8336-0348/bork.txt'
34
+ When I retrieve the cache name '20090212-2343-8336-0348/bork.txt' from the cache
35
+ And I store the file
36
+ Then there should be a file at 'public/uploads/bork.txt'
37
+ And the file at 'public/uploads/bork.txt' should be identical to the file at 'fixtures/bork.txt'
@@ -0,0 +1,38 @@
1
+ Feature: uploader with file storage and overriden filename
2
+ In order to be awesome
3
+ As a developer using CarrierWave
4
+ I want to upload files to the filesystem with an overriden filename
5
+
6
+ Background:
7
+ Given an uploader class that uses the 'file' storage
8
+ And that the uploader reverses the filename
9
+ And an instance of that class
10
+
11
+ Scenario: store a file
12
+ When I store the file 'fixtures/bork.txt'
13
+ Then there should be a file at 'public/uploads/txt.krob'
14
+ And the file at 'public/uploads/txt.krob' should be identical to the file at 'fixtures/bork.txt'
15
+
16
+ Scenario: store two files in succession
17
+ When I store the file 'fixtures/bork.txt'
18
+ Then there should be a file at 'public/uploads/txt.krob'
19
+ And the file at 'public/uploads/txt.krob' should be identical to the file at 'fixtures/bork.txt'
20
+ When I store the file 'fixtures/monkey.txt'
21
+ Then there should be a file at 'public/uploads/txt.yeknom'
22
+ And the file at 'public/uploads/txt.yeknom' should be identical to the file at 'fixtures/monkey.txt'
23
+
24
+ Scenario: cache a file and then store it
25
+ When I cache the file 'fixtures/bork.txt'
26
+ Then there should be a file called 'bork.txt' somewhere in a subdirectory of 'public/uploads/tmp'
27
+ And the file called 'bork.txt' in a subdirectory of 'public/uploads/tmp' should be identical to the file at 'fixtures/bork.txt'
28
+ And there should not be a file at 'public/uploads/txt.krob'
29
+ When I store the file
30
+ Then there should be a file at 'public/uploads/txt.krob'
31
+ And the file at 'public/uploads/txt.krob' should be identical to the file at 'fixtures/bork.txt'
32
+
33
+ Scenario: retrieving a file from cache then storing
34
+ Given the file 'fixtures/bork.txt' is cached file at 'public/uploads/tmp/20090212-2343-8336-0348/bork.txt'
35
+ When I retrieve the cache name '20090212-2343-8336-0348/bork.txt' from the cache
36
+ And I store the file
37
+ Then there should be a file at 'public/uploads/txt.krob'
38
+ And the file at 'public/uploads/txt.krob' should be identical to the file at 'fixtures/bork.txt'
@@ -0,0 +1,38 @@
1
+ Feature: uploader with file storage and overridden store dir
2
+ In order to be awesome
3
+ As a developer using CarrierWave
4
+ I want to upload files to the filesystem
5
+
6
+ Background:
7
+ Given an uploader class that uses the 'file' storage
8
+ And that the uploader has the store_dir overridden to 'public/monkey/llama'
9
+ And an instance of that class
10
+
11
+ Scenario: store a file
12
+ When I store the file 'fixtures/bork.txt'
13
+ Then there should be a file at 'public/monkey/llama/bork.txt'
14
+ And the file at 'public/monkey/llama/bork.txt' should be identical to the file at 'fixtures/bork.txt'
15
+
16
+ Scenario: store two files in succession
17
+ When I store the file 'fixtures/bork.txt'
18
+ Then there should be a file at 'public/monkey/llama/bork.txt'
19
+ And the file at 'public/monkey/llama/bork.txt' should be identical to the file at 'fixtures/bork.txt'
20
+ When I store the file 'fixtures/monkey.txt'
21
+ Then there should be a file at 'public/monkey/llama/monkey.txt'
22
+ And the file at 'public/monkey/llama/monkey.txt' should be identical to the file at 'fixtures/monkey.txt'
23
+
24
+ Scenario: cache a file and then store it
25
+ When I cache the file 'fixtures/bork.txt'
26
+ Then there should be a file called 'bork.txt' somewhere in a subdirectory of 'public/uploads/tmp'
27
+ And the file called 'bork.txt' in a subdirectory of 'public/uploads/tmp' should be identical to the file at 'fixtures/bork.txt'
28
+ And there should not be a file at 'public/monkey/llama/bork.txt'
29
+ When I store the file
30
+ Then there should be a file at 'public/monkey/llama/bork.txt'
31
+ And the file at 'public/monkey/llama/bork.txt' should be identical to the file at 'fixtures/bork.txt'
32
+
33
+ Scenario: retrieving a file from cache then storing
34
+ Given the file 'fixtures/bork.txt' is cached file at 'public/uploads/tmp/20090212-2343-8336-0348/bork.txt'
35
+ When I retrieve the cache name '20090212-2343-8336-0348/bork.txt' from the cache
36
+ And I store the file
37
+ Then there should be a file at 'public/monkey/llama/bork.txt'
38
+ And the file at 'public/monkey/llama/bork.txt' should be identical to the file at 'fixtures/bork.txt'