samlown-carrierwave 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Generators +4 -0
- data/History.txt +125 -0
- data/Manifest.txt +110 -0
- data/README.rdoc +524 -0
- data/Rakefile +39 -0
- data/carrierwave.gemspec +85 -0
- data/cucumber.yml +2 -0
- data/features/caching.feature +28 -0
- data/features/download.feature +20 -0
- data/features/file_storage.feature +37 -0
- data/features/file_storage_overridden_filename.feature +38 -0
- data/features/file_storage_overridden_store_dir.feature +38 -0
- data/features/file_storage_reversing_processor.feature +43 -0
- data/features/fixtures/bork.txt +1 -0
- data/features/fixtures/monkey.txt +1 -0
- data/features/grid_fs_storage.feature +32 -0
- data/features/mount_activerecord.feature +46 -0
- data/features/mount_datamapper.feature +46 -0
- data/features/step_definitions/activerecord_steps.rb +22 -0
- data/features/step_definitions/caching_steps.rb +14 -0
- data/features/step_definitions/datamapper_steps.rb +29 -0
- data/features/step_definitions/download_steps.rb +4 -0
- data/features/step_definitions/file_steps.rb +53 -0
- data/features/step_definitions/general_steps.rb +85 -0
- data/features/step_definitions/mount_steps.rb +19 -0
- data/features/step_definitions/store_steps.rb +18 -0
- data/features/support/activerecord.rb +30 -0
- data/features/support/datamapper.rb +7 -0
- data/features/support/env.rb +22 -0
- data/features/versions_basics.feature +50 -0
- data/features/versions_nested_versions.feature +70 -0
- data/features/versions_overridden_filename.feature +51 -0
- data/features/versions_overriden_store_dir.feature +41 -0
- data/lib/carrierwave.rb +98 -0
- data/lib/carrierwave/compatibility/paperclip.rb +95 -0
- data/lib/carrierwave/core_ext/blank.rb +46 -0
- data/lib/carrierwave/core_ext/file.rb +11 -0
- data/lib/carrierwave/core_ext/inheritable_attributes.rb +108 -0
- data/lib/carrierwave/core_ext/module_setup.rb +51 -0
- data/lib/carrierwave/mount.rb +359 -0
- data/lib/carrierwave/orm/activerecord.rb +73 -0
- data/lib/carrierwave/orm/datamapper.rb +27 -0
- data/lib/carrierwave/orm/mongoid.rb +23 -0
- data/lib/carrierwave/orm/mongomapper.rb +27 -0
- data/lib/carrierwave/orm/sequel.rb +45 -0
- data/lib/carrierwave/processing/image_science.rb +101 -0
- data/lib/carrierwave/processing/mini_magick.rb +265 -0
- data/lib/carrierwave/processing/rmagick.rb +282 -0
- data/lib/carrierwave/sanitized_file.rb +273 -0
- data/lib/carrierwave/storage/abstract.rb +30 -0
- data/lib/carrierwave/storage/cloud_files.rb +169 -0
- data/lib/carrierwave/storage/file.rb +48 -0
- data/lib/carrierwave/storage/grid_fs.rb +97 -0
- data/lib/carrierwave/storage/right_s3.rb +3 -0
- data/lib/carrierwave/storage/s3.rb +206 -0
- data/lib/carrierwave/test/matchers.rb +128 -0
- data/lib/carrierwave/uploader.rb +44 -0
- data/lib/carrierwave/uploader/cache.rb +145 -0
- data/lib/carrierwave/uploader/callbacks.rb +42 -0
- data/lib/carrierwave/uploader/configuration.rb +132 -0
- data/lib/carrierwave/uploader/default_url.rb +19 -0
- data/lib/carrierwave/uploader/download.rb +59 -0
- data/lib/carrierwave/uploader/extension_whitelist.rb +37 -0
- data/lib/carrierwave/uploader/mountable.rb +39 -0
- data/lib/carrierwave/uploader/processing.rb +83 -0
- data/lib/carrierwave/uploader/proxy.rb +62 -0
- data/lib/carrierwave/uploader/remove.rb +22 -0
- data/lib/carrierwave/uploader/store.rb +89 -0
- data/lib/carrierwave/uploader/url.rb +33 -0
- data/lib/carrierwave/uploader/versions.rb +146 -0
- data/merb_generators/uploader_generator.rb +22 -0
- data/rails_generators/uploader/USAGE +2 -0
- data/rails_generators/uploader/templates/uploader.rb +47 -0
- data/rails_generators/uploader/uploader_generator.rb +21 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/compatibility/paperclip_spec.rb +52 -0
- data/spec/fixtures/bork.txt +1 -0
- data/spec/fixtures/landscape.jpg +0 -0
- data/spec/fixtures/portrait.jpg +0 -0
- data/spec/fixtures/test.jpeg +1 -0
- data/spec/fixtures/test.jpg +1 -0
- data/spec/mount_spec.rb +538 -0
- data/spec/orm/activerecord_spec.rb +271 -0
- data/spec/orm/datamapper_spec.rb +168 -0
- data/spec/orm/mongoid_spec.rb +202 -0
- data/spec/orm/mongomapper_spec.rb +202 -0
- data/spec/orm/sequel_spec.rb +183 -0
- data/spec/processing/image_science_spec.rb +56 -0
- data/spec/processing/mini_magick_spec.rb +76 -0
- data/spec/processing/rmagick_spec.rb +75 -0
- data/spec/sanitized_file_spec.rb +623 -0
- data/spec/spec_helper.rb +92 -0
- data/spec/storage/cloudfiles_spec.rb +78 -0
- data/spec/storage/grid_fs_spec.rb +83 -0
- data/spec/storage/s3_spec.rb +118 -0
- data/spec/uploader/cache_spec.rb +209 -0
- data/spec/uploader/configuration_spec.rb +105 -0
- data/spec/uploader/default_url_spec.rb +85 -0
- data/spec/uploader/download_spec.rb +75 -0
- data/spec/uploader/extension_whitelist_spec.rb +44 -0
- data/spec/uploader/mountable_spec.rb +33 -0
- data/spec/uploader/paths_spec.rb +22 -0
- data/spec/uploader/processing_spec.rb +73 -0
- data/spec/uploader/proxy_spec.rb +54 -0
- data/spec/uploader/remove_spec.rb +70 -0
- data/spec/uploader/store_spec.rb +264 -0
- data/spec/uploader/url_spec.rb +102 -0
- data/spec/uploader/versions_spec.rb +298 -0
- metadata +433 -0
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
$:.unshift File.join(File.dirname(__FILE__), 'lib')
|
6
|
+
require 'carrierwave'
|
7
|
+
|
8
|
+
Hoe.plugin :newgem
|
9
|
+
# Hoe.plugin :website
|
10
|
+
Hoe.plugin :cucumberfeatures
|
11
|
+
|
12
|
+
$hoe = Hoe.spec 'samlown-carrierwave' do
|
13
|
+
self.developer 'Jonas Nicklas', 'jonas.nicklas@gmail.com'
|
14
|
+
self.rubyforge_name = 'samlown-carrierwave' # self.name
|
15
|
+
self.readme_file = 'README.rdoc'
|
16
|
+
self.version = CarrierWave::VERSION
|
17
|
+
self.extra_dev_deps << ['newgem', '>=1.5.2']
|
18
|
+
self.extra_dev_deps << ['rspec', '>=1.2.8']
|
19
|
+
self.extra_dev_deps << ['cucumber', '>=0.3.96']
|
20
|
+
self.extra_dev_deps << ['activerecord', '>=2.3.3']
|
21
|
+
self.extra_dev_deps << ['sqlite3-ruby', '>=1.2.5']
|
22
|
+
self.extra_dev_deps << ['dm-core', '>=0.9.11']
|
23
|
+
self.extra_dev_deps << ['data_objects', '>=0.9.12']
|
24
|
+
self.extra_dev_deps << ['do_sqlite3', '>=0.9.11']
|
25
|
+
self.extra_dev_deps << ['sequel', '>=3.2.0']
|
26
|
+
self.extra_dev_deps << ['rmagick', '>=2.10.0']
|
27
|
+
self.extra_dev_deps << ['mini_magick', '>=1.2.5']
|
28
|
+
self.extra_dev_deps << ['mongo_mapper', '>=0.6.8']
|
29
|
+
self.extra_dev_deps << ['mongoid', '>=0.10.4']
|
30
|
+
self.extra_dev_deps << ['aws-s3', '>=0.6.2']
|
31
|
+
self.extra_dev_deps << ['timecop', '>=0.3.4']
|
32
|
+
self.extra_dev_deps << ['json', '>=1.1.9']
|
33
|
+
self.extra_rdoc_files << 'README.rdoc'
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'newgem/tasks'
|
37
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
38
|
+
|
39
|
+
task :default => [:spec, :features]
|
data/carrierwave.gemspec
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{samlown-carrierwave}
|
5
|
+
s.version = "0.4.4"
|
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{2010-02-18}
|
10
|
+
s.description = %q{* RDoc Documentation {available at Rubyforge}[http://carrierwave.rubyforge.org/rdoc].
|
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
|
+
* Check out the {example app}[http://github.com/jnicklas/carrierwave-example-app]}
|
15
|
+
s.email = ["jonas.nicklas@gmail.com"]
|
16
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "features/fixtures/bork.txt", "features/fixtures/monkey.txt", "README.rdoc"]
|
17
|
+
s.files = ["Generators", "History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "cucumber.yml", "features/caching.feature", "features/download.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/grid_fs_storage.feature", "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/download_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/mongoid.rb", "lib/carrierwave/orm/mongomapper.rb", "lib/carrierwave/orm/sequel.rb", "lib/carrierwave/processing/image_science.rb", "lib/carrierwave/processing/mini_magick.rb", "lib/carrierwave/processing/rmagick.rb", "lib/carrierwave/sanitized_file.rb", "lib/carrierwave/storage/abstract.rb", "lib/carrierwave/storage/cloud_files.rb", "lib/carrierwave/storage/file.rb", "lib/carrierwave/storage/grid_fs.rb", "lib/carrierwave/storage/right_s3.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/configuration.rb", "lib/carrierwave/uploader/default_url.rb", "lib/carrierwave/uploader/download.rb", "lib/carrierwave/uploader/extension_whitelist.rb", "lib/carrierwave/uploader/mountable.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", "merb_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/landscape.jpg", "spec/fixtures/portrait.jpg", "spec/fixtures/test.jpeg", "spec/fixtures/test.jpg", "spec/mount_spec.rb", "spec/orm/activerecord_spec.rb", "spec/orm/datamapper_spec.rb", "spec/orm/mongoid_spec.rb", "spec/orm/mongomapper_spec.rb", "spec/orm/sequel_spec.rb", "spec/processing/image_science_spec.rb", "spec/processing/mini_magick_spec.rb", "spec/processing/rmagick_spec.rb", "spec/sanitized_file_spec.rb", "spec/spec_helper.rb", "spec/storage/grid_fs_spec.rb", "spec/storage/right_s3_spec.rb", "spec/storage/s3_spec.rb", "spec/uploader/cache_spec.rb", "spec/uploader/configuration_spec.rb", "spec/uploader/default_url_spec.rb", "spec/uploader/download_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"]
|
18
|
+
s.homepage = %q{http://carrierwave.rubyforge.org}
|
19
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.rubyforge_project = %q{carrierwave}
|
22
|
+
s.rubygems_version = %q{1.3.5}
|
23
|
+
s.summary = %q{* RDoc Documentation {available at Rubyforge}[http://carrierwave.rubyforge.org/rdoc]}
|
24
|
+
|
25
|
+
if s.respond_to? :specification_version then
|
26
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
27
|
+
s.specification_version = 3
|
28
|
+
|
29
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
30
|
+
s.add_development_dependency(%q<newgem>, [">= 1.5.2"])
|
31
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.8"])
|
32
|
+
s.add_development_dependency(%q<cucumber>, [">= 0.3.96"])
|
33
|
+
s.add_development_dependency(%q<activerecord>, [">= 2.3.3"])
|
34
|
+
s.add_development_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
35
|
+
s.add_development_dependency(%q<dm-core>, [">= 0.9.11"])
|
36
|
+
s.add_development_dependency(%q<data_objects>, [">= 0.9.12"])
|
37
|
+
s.add_development_dependency(%q<do_sqlite3>, [">= 0.9.11"])
|
38
|
+
s.add_development_dependency(%q<sequel>, [">= 3.2.0"])
|
39
|
+
s.add_development_dependency(%q<rmagick>, [">= 2.10.0"])
|
40
|
+
s.add_development_dependency(%q<mini_magick>, [">= 1.2.5"])
|
41
|
+
s.add_development_dependency(%q<mongo_mapper>, [">= 0.6.8"])
|
42
|
+
s.add_development_dependency(%q<mongoid>, [">= 0.10.4"])
|
43
|
+
s.add_development_dependency(%q<aws-s3>, [">= 0.6.2"])
|
44
|
+
s.add_development_dependency(%q<timecop>, [">= 0.3.4"])
|
45
|
+
s.add_development_dependency(%q<json>, [">= 1.1.9"])
|
46
|
+
s.add_development_dependency(%q<hoe>, [">= 2.4.0"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<newgem>, [">= 1.5.2"])
|
49
|
+
s.add_dependency(%q<rspec>, [">= 1.2.8"])
|
50
|
+
s.add_dependency(%q<cucumber>, [">= 0.3.96"])
|
51
|
+
s.add_dependency(%q<activerecord>, [">= 2.3.3"])
|
52
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
53
|
+
s.add_dependency(%q<dm-core>, [">= 0.9.11"])
|
54
|
+
s.add_dependency(%q<data_objects>, [">= 0.9.12"])
|
55
|
+
s.add_dependency(%q<do_sqlite3>, [">= 0.9.11"])
|
56
|
+
s.add_dependency(%q<sequel>, [">= 3.2.0"])
|
57
|
+
s.add_dependency(%q<rmagick>, [">= 2.10.0"])
|
58
|
+
s.add_dependency(%q<mini_magick>, [">= 1.2.5"])
|
59
|
+
s.add_dependency(%q<mongo_mapper>, [">= 0.6.8"])
|
60
|
+
s.add_dependency(%q<mongoid>, [">= 0.10.4"])
|
61
|
+
s.add_dependency(%q<aws-s3>, [">= 0.6.2"])
|
62
|
+
s.add_dependency(%q<timecop>, [">= 0.3.4"])
|
63
|
+
s.add_dependency(%q<json>, [">= 1.1.9"])
|
64
|
+
s.add_dependency(%q<hoe>, [">= 2.4.0"])
|
65
|
+
end
|
66
|
+
else
|
67
|
+
s.add_dependency(%q<newgem>, [">= 1.5.2"])
|
68
|
+
s.add_dependency(%q<rspec>, [">= 1.2.8"])
|
69
|
+
s.add_dependency(%q<cucumber>, [">= 0.3.96"])
|
70
|
+
s.add_dependency(%q<activerecord>, [">= 2.3.3"])
|
71
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
72
|
+
s.add_dependency(%q<dm-core>, [">= 0.9.11"])
|
73
|
+
s.add_dependency(%q<data_objects>, [">= 0.9.12"])
|
74
|
+
s.add_dependency(%q<do_sqlite3>, [">= 0.9.11"])
|
75
|
+
s.add_dependency(%q<sequel>, [">= 3.2.0"])
|
76
|
+
s.add_dependency(%q<rmagick>, [">= 2.10.0"])
|
77
|
+
s.add_dependency(%q<mini_magick>, [">= 1.2.5"])
|
78
|
+
s.add_dependency(%q<mongo_mapper>, [">= 0.6.8"])
|
79
|
+
s.add_dependency(%q<mongoid>, [">= 0.10.4"])
|
80
|
+
s.add_dependency(%q<aws-s3>, [">= 0.6.2"])
|
81
|
+
s.add_dependency(%q<timecop>, [">= 0.3.4"])
|
82
|
+
s.add_dependency(%q<json>, [">= 1.1.9"])
|
83
|
+
s.add_dependency(%q<hoe>, [">= 2.4.0"])
|
84
|
+
end
|
85
|
+
end
|
data/cucumber.yml
ADDED
@@ -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,20 @@
|
|
1
|
+
Feature: downloading files
|
2
|
+
In order to allow users to upload remote files
|
3
|
+
As a developer using CarrierWave
|
4
|
+
I want to download files to the filesystem via HTTP
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given an uploader class that uses the 'file' storage
|
8
|
+
And an instance of that class
|
9
|
+
|
10
|
+
Scenario: download a file
|
11
|
+
When I download the file 'http://s3.amazonaws.com/Monkey/testfile.txt'
|
12
|
+
Then there should be a file called 'testfile.txt' somewhere in a subdirectory of 'public/uploads/tmp'
|
13
|
+
And the file called 'testfile.txt' in a subdirectory of 'public/uploads/tmp' should contain 'S3 Remote File'
|
14
|
+
|
15
|
+
Scenario: downloading a file then storing
|
16
|
+
When I download the file 'http://s3.amazonaws.com/Monkey/testfile.txt'
|
17
|
+
And I store the file
|
18
|
+
Then there should be a file at 'public/uploads/testfile.txt'
|
19
|
+
And the file at 'public/uploads/testfile.txt' should contain 'S3 Remote File'
|
20
|
+
|
@@ -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'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
Feature: uploader with file storage and a processor that reverses the file
|
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
|
+
And the class has a method called 'reverse' that reverses the contents of a file
|
10
|
+
And the class will process 'reverse'
|
11
|
+
|
12
|
+
Scenario: store a file
|
13
|
+
When I store the file 'fixtures/bork.txt'
|
14
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
15
|
+
And the file at 'public/uploads/bork.txt' should not be identical to the file at 'fixtures/bork.txt'
|
16
|
+
And the file at 'public/uploads/bork.txt' should be the reverse of the file at 'fixtures/bork.txt'
|
17
|
+
|
18
|
+
Scenario: store two files in succession
|
19
|
+
When I store the file 'fixtures/bork.txt'
|
20
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
21
|
+
And the file at 'public/uploads/bork.txt' should not be identical to the file at 'fixtures/bork.txt'
|
22
|
+
And the file at 'public/uploads/bork.txt' should be the reverse of the file at 'fixtures/bork.txt'
|
23
|
+
When I store the file 'fixtures/monkey.txt'
|
24
|
+
Then there should be a file at 'public/uploads/monkey.txt'
|
25
|
+
And the file at 'public/uploads/monkey.txt' should not be identical to the file at 'fixtures/monkey.txt'
|
26
|
+
And the file at 'public/uploads/monkey.txt' should be the reverse of the file at 'fixtures/monkey.txt'
|
27
|
+
|
28
|
+
Scenario: cache a file and then store it
|
29
|
+
When I cache the file 'fixtures/bork.txt'
|
30
|
+
Then there should be a file called 'bork.txt' somewhere in a subdirectory of 'public/uploads/tmp'
|
31
|
+
And the file called 'bork.txt' in a subdirectory of 'public/uploads/tmp' should not be identical to the file at 'fixtures/bork.txt'
|
32
|
+
And there should not be a file at 'public/uploads/bork.txt'
|
33
|
+
When I store the file
|
34
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
35
|
+
And the file at 'public/uploads/bork.txt' should not be identical to the file at 'fixtures/bork.txt'
|
36
|
+
And the file at 'public/uploads/bork.txt' should be the reverse of the file at 'fixtures/bork.txt'
|
37
|
+
|
38
|
+
Scenario: retrieving a file from cache then storing
|
39
|
+
Given the file 'fixtures/bork.txt' is cached file at 'public/uploads/tmp/20090212-2343-8336-0348/bork.txt'
|
40
|
+
When I retrieve the cache name '20090212-2343-8336-0348/bork.txt' from the cache
|
41
|
+
And I store the file
|
42
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
43
|
+
And the file at 'public/uploads/bork.txt' should be identical to the file at 'fixtures/bork.txt'
|
@@ -0,0 +1 @@
|
|
1
|
+
this is a file
|
@@ -0,0 +1 @@
|
|
1
|
+
this is another file
|
@@ -0,0 +1,32 @@
|
|
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 'grid_fs' 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 the contents of the file should be 'this is a file'
|
13
|
+
|
14
|
+
Scenario: store two files in succession
|
15
|
+
When I store the file 'fixtures/bork.txt'
|
16
|
+
Then the contents of the file should be 'this is a file'
|
17
|
+
When I store the file 'fixtures/monkey.txt'
|
18
|
+
Then the contents of the file should be 'this is another file'
|
19
|
+
|
20
|
+
Scenario: cache a file and then store it
|
21
|
+
When I cache the file 'fixtures/bork.txt'
|
22
|
+
Then there should be a file called 'bork.txt' somewhere in a subdirectory of 'public/uploads/tmp'
|
23
|
+
And the file called 'bork.txt' in a subdirectory of 'public/uploads/tmp' should be identical to the file at 'fixtures/bork.txt'
|
24
|
+
And there should not be a file at 'public/uploads/bork.txt'
|
25
|
+
When I store the file
|
26
|
+
Then the contents of the file should be 'this is a file'
|
27
|
+
|
28
|
+
Scenario: retrieving a file from cache then storing
|
29
|
+
Given the file 'fixtures/bork.txt' is cached file at 'public/uploads/tmp/20090212-2343-8336-0348/bork.txt'
|
30
|
+
When I retrieve the cache name '20090212-2343-8336-0348/bork.txt' from the cache
|
31
|
+
And I store the file
|
32
|
+
Then the contents of the file should be 'this is a file'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
Feature: Mount an Uploader on ActiveRecord class
|
2
|
+
In order to easily attach files to a form
|
3
|
+
As a web developer using CarrierWave
|
4
|
+
I want to mount an uploader on an ActiveRecord class
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given an uploader class that uses the 'file' storage
|
8
|
+
And an activerecord class that uses the 'users' table
|
9
|
+
And the uploader class is mounted on the 'avatar' column
|
10
|
+
And an instance of the activerecord class
|
11
|
+
|
12
|
+
Scenario: assign a file
|
13
|
+
When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
14
|
+
Then there should be a file called 'bork.txt' somewhere in a subdirectory of 'public/uploads/tmp'
|
15
|
+
And the file called 'bork.txt' in a subdirectory of 'public/uploads/tmp' should be identical to the file at 'fixtures/bork.txt'
|
16
|
+
|
17
|
+
Scenario: assign a file and save the record
|
18
|
+
When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
19
|
+
And I save the active record
|
20
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
21
|
+
And the file at 'public/uploads/bork.txt' should be identical to the file at 'fixtures/bork.txt'
|
22
|
+
And the url for the column 'avatar' should be '/uploads/bork.txt'
|
23
|
+
|
24
|
+
Scenario: assign a file and retrieve it from cache
|
25
|
+
When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
26
|
+
And I retrieve the file later from the cache name for the column 'avatar'
|
27
|
+
And I save the active record
|
28
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
29
|
+
And the file at 'public/uploads/bork.txt' should be identical to the file at 'fixtures/bork.txt'
|
30
|
+
And the url for the column 'avatar' should be '/uploads/bork.txt'
|
31
|
+
|
32
|
+
Scenario: store a file and retrieve it later
|
33
|
+
When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
34
|
+
And I retrieve the file later from the cache name for the column 'avatar'
|
35
|
+
And I save the active record
|
36
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
37
|
+
When I reload the active record
|
38
|
+
Then the url for the column 'avatar' should be '/uploads/bork.txt'
|
39
|
+
|
40
|
+
Scenario: store a file and delete the record
|
41
|
+
When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
42
|
+
And I retrieve the file later from the cache name for the column 'avatar'
|
43
|
+
And I save the active record
|
44
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
45
|
+
When I delete the active record
|
46
|
+
Then there should not be a file at 'public/uploads/bork.txt'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
Feature: Mount an Uploader on ActiveRecord class
|
2
|
+
In order to easily attach files to a form
|
3
|
+
As a web developer using CarrierWave
|
4
|
+
I want to mount an uploader on an ActiveRecord class
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given an uploader class that uses the 'file' storage
|
8
|
+
And a datamapper class that has a 'avatar' column
|
9
|
+
And the uploader class is mounted on the 'avatar' column
|
10
|
+
And an instance of the datamapper class
|
11
|
+
|
12
|
+
Scenario: assign a file
|
13
|
+
When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
14
|
+
Then there should be a file called 'bork.txt' somewhere in a subdirectory of 'public/uploads/tmp'
|
15
|
+
And the file called 'bork.txt' in a subdirectory of 'public/uploads/tmp' should be identical to the file at 'fixtures/bork.txt'
|
16
|
+
|
17
|
+
Scenario: assign a file and save the record
|
18
|
+
When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
19
|
+
And I save the datamapper record
|
20
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
21
|
+
And the file at 'public/uploads/bork.txt' should be identical to the file at 'fixtures/bork.txt'
|
22
|
+
And the url for the column 'avatar' should be '/uploads/bork.txt'
|
23
|
+
|
24
|
+
Scenario: assign a file and retrieve it from cache
|
25
|
+
When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
26
|
+
And I retrieve the file later from the cache name for the column 'avatar'
|
27
|
+
And I save the datamapper record
|
28
|
+
Then there should be a file at 'public/uploads/bork.txt'
|
29
|
+
And the file at 'public/uploads/bork.txt' should be identical to the file at 'fixtures/bork.txt'
|
30
|
+
And the url for the column 'avatar' should be '/uploads/bork.txt'
|
31
|
+
|
32
|
+
# Scenario: store a file and retrieve it later
|
33
|
+
# When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
34
|
+
# And I retrieve the file later from the cache name for the column 'avatar'
|
35
|
+
# And I save the datamapper record
|
36
|
+
# Then there should be a file at 'public/uploads/bork.txt'
|
37
|
+
# When I reload the datamapper record
|
38
|
+
# Then the url for the column 'avatar' should be '/uploads/bork.txt'
|
39
|
+
#
|
40
|
+
# Scenario: store a file and delete the record
|
41
|
+
# When I assign the file 'fixtures/bork.txt' to the 'avatar' column
|
42
|
+
# And I retrieve the file later from the cache name for the column 'avatar'
|
43
|
+
# And I save the datamapper record
|
44
|
+
# Then there should be a file at 'public/uploads/bork.txt'
|
45
|
+
# When I delete the datamapper record
|
46
|
+
# Then there should not be a file at 'public/uploads/bork.txt'
|