carrierwave 0.3.2 → 0.3.3

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 (41) hide show
  1. data/History.txt +68 -0
  2. data/Manifest.txt +89 -0
  3. data/README.rdoc +39 -4
  4. data/Rakefile +32 -115
  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 +8 -0
  31. data/lib/carrierwave/orm/mongomapper.rb +27 -0
  32. data/lib/carrierwave/processing/rmagick.rb +6 -4
  33. data/lib/carrierwave/storage/abstract.rb +5 -5
  34. data/lib/carrierwave/storage/s3.rb +17 -1
  35. data/script/console +10 -0
  36. data/script/destroy +14 -0
  37. data/script/generate +14 -0
  38. data/spec/orm/mongomapper_spec.rb +184 -0
  39. metadata +157 -20
  40. data/LICENSE +0 -20
  41. data/TODO +0 -0
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/carrierwave.rb'}"
9
+ puts "Loading carrierwave gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,184 @@
1
+ # encoding: utf-8
2
+ require File.dirname(__FILE__) + '/../spec_helper'
3
+
4
+ require 'carrierwave/orm/mongomapper'
5
+
6
+ MongoMapper.database = "carrierwave_test"
7
+
8
+ describe CarrierWave::MongoMapper do
9
+
10
+ before do
11
+ uploader = Class.new(CarrierWave::Uploader::Base)
12
+
13
+ @class = Class.new
14
+ @class.class_eval do
15
+ include MongoMapper::Document
16
+ mount_uploader :image, uploader
17
+ end
18
+
19
+ @uploader = uploader
20
+ end
21
+
22
+ describe '#image' do
23
+
24
+ context "when nothing is assigned" do
25
+
26
+ before do
27
+ @document = @class.new
28
+ end
29
+
30
+ it "returns a blank uploader" do
31
+ @document.image.should be_blank
32
+ end
33
+
34
+ end
35
+
36
+ context "when an empty string is assigned" do
37
+
38
+ before do
39
+ @document = @class.new(:image_filename => "")
40
+ @document.save
41
+ end
42
+
43
+ it "returns a blank uploader" do
44
+ @saved_doc = @class.find(:first)
45
+ @saved_doc.image.should be_blank
46
+ end
47
+
48
+ end
49
+
50
+ context "when a filename is saved in the database" do
51
+
52
+ before do
53
+ @document = @class.new(:image_filename => "test.jpg")
54
+ @document.save
55
+ @doc = @class.find(:first)
56
+ end
57
+
58
+ it "returns an uploader" do
59
+ @doc.image.should be_an_instance_of(@uploader)
60
+ end
61
+
62
+ it "sets the path to the store directory" do
63
+ @doc.image.current_path.should == public_path('uploads/test.jpg')
64
+ end
65
+
66
+ end
67
+
68
+ end
69
+
70
+ describe '#image=' do
71
+
72
+ before do
73
+ @doc = @class.new
74
+ end
75
+
76
+ context "when nil is assigned" do
77
+
78
+ it "does not set the value" do
79
+ @doc.image = nil
80
+ @doc.image.should be_blank
81
+ end
82
+
83
+ end
84
+
85
+ context "when an empty string is assigned" do
86
+
87
+ it "does not set the value" do
88
+ @doc.image = ''
89
+ @doc.image.should be_blank
90
+ end
91
+
92
+ end
93
+
94
+ context "when a file is assigned" do
95
+
96
+ it "should cache a file" do
97
+ @doc.image = stub_file('test.jpeg')
98
+ @doc.image.should be_an_instance_of(@uploader)
99
+ end
100
+
101
+ it "should write nothing to the database, to prevent overriden filenames to fail because of unassigned attributes" do
102
+ @doc[:image_filename].should be_nil
103
+ end
104
+
105
+ it "should copy a file into into the cache directory" do
106
+ @doc.image = stub_file('test.jpeg')
107
+ @doc.image.current_path.should =~ /^#{public_path('uploads/tmp')}/
108
+ end
109
+
110
+ end
111
+
112
+ end
113
+
114
+ describe "#save" do
115
+
116
+ before do
117
+ @doc = @class.new
118
+ end
119
+
120
+ context "when no file is assigned" do
121
+
122
+ it "image is blank" do
123
+ @doc.save
124
+ @doc.image.should be_blank
125
+ end
126
+
127
+ end
128
+
129
+ context "when a file is assigned" do
130
+
131
+ it "copies the file to the upload directory" do
132
+ @doc.image = stub_file('test.jpg')
133
+ @doc.save
134
+ @doc.image.should be_an_instance_of(@uploader)
135
+ @doc.image.current_path.should == public_path('uploads/test.jpg')
136
+ end
137
+
138
+ it "saves the filename in the database" do
139
+ @doc.image = stub_file('test.jpg')
140
+ @doc.save
141
+ @doc[:image_filename].should == 'test.jpg'
142
+ end
143
+
144
+ context "when remove_image? is true" do
145
+
146
+ it "removes the image" do
147
+ @doc.image = stub_file('test.jpeg')
148
+ @doc.save
149
+ @doc.remove_image = true
150
+ @doc.save
151
+ @doc.image.should be_blank
152
+ @doc[:image_filename].should == ''
153
+ end
154
+
155
+ end
156
+
157
+ end
158
+
159
+ end
160
+
161
+ describe '#destroy' do
162
+
163
+ before do
164
+ @doc = @class.new
165
+ end
166
+
167
+ context "when file assigned" do
168
+
169
+ it "removes the file from the filesystem" do
170
+ @doc.image = stub_file('test.jpeg')
171
+ @doc.save.should be_true
172
+ File.exist?(public_path('uploads/test.jpeg')).should be_true
173
+ @doc.image.should be_an_instance_of(@uploader)
174
+ @doc.image.current_path.should == public_path('uploads/test.jpeg')
175
+ @doc.destroy
176
+ File.exist?(public_path('uploads/test.jpeg')).should be_false
177
+ end
178
+
179
+ end
180
+
181
+ end
182
+
183
+
184
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
@@ -9,26 +9,158 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-18 00:00:00 +02:00
12
+ date: 2009-08-30 00:00:00 +02:00
13
13
  default_executable:
14
- dependencies: []
15
-
16
- description: Simple and powerful uploads for Merb and Rails
17
- email: jonas.nicklas@gmail.com
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.8
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: cucumber
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.96
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: activerecord
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.3.3
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: sqlite3-ruby
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.3.3
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: dm-core
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 0.9.11
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: do_sqlite3
67
+ type: :development
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 0.9.11
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: sequel
77
+ type: :development
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 3.2.0
84
+ version:
85
+ - !ruby/object:Gem::Dependency
86
+ name: rmagick
87
+ type: :development
88
+ version_requirement:
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: 2.10.0
94
+ version:
95
+ - !ruby/object:Gem::Dependency
96
+ name: jnunemaker-mongomapper
97
+ type: :development
98
+ version_requirement:
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 0.3.3
104
+ version:
105
+ - !ruby/object:Gem::Dependency
106
+ name: hoe
107
+ type: :development
108
+ version_requirement:
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: 2.3.3
114
+ version:
115
+ description: |-
116
+ * RDoc Documentation {available at Rubyforge}[http://carrierwave.rubyforge.org/].
117
+ * Source code {hosted at GitHub}[http://github.com/jnicklas/carrierwave]
118
+ * Please {report any issues}[http://github.com/jnicklas/carrierwave/issues] on GitHub
119
+ * Please direct any questions at the {mailing list}[http://groups.google.com/group/carrierwave]
120
+ email:
121
+ - jonas.nicklas@gmail.com
18
122
  executables: []
19
123
 
20
124
  extensions: []
21
125
 
22
126
  extra_rdoc_files:
127
+ - History.txt
128
+ - Manifest.txt
129
+ - features/fixtures/bork.txt
130
+ - features/fixtures/monkey.txt
23
131
  - README.rdoc
24
- - LICENSE
25
- - TODO
26
132
  files:
27
- - LICENSE
28
133
  - Generators
134
+ - History.txt
135
+ - Manifest.txt
29
136
  - README.rdoc
30
137
  - Rakefile
31
- - TODO
138
+ - carrierwave.gemspec
139
+ - cucumber.yml
140
+ - features/caching.feature
141
+ - features/file_storage.feature
142
+ - features/file_storage_overridden_filename.feature
143
+ - features/file_storage_overridden_store_dir.feature
144
+ - features/file_storage_reversing_processor.feature
145
+ - features/fixtures/bork.txt
146
+ - features/fixtures/monkey.txt
147
+ - features/mount_activerecord.feature
148
+ - features/mount_datamapper.feature
149
+ - features/step_definitions/activerecord_steps.rb
150
+ - features/step_definitions/caching_steps.rb
151
+ - features/step_definitions/datamapper_steps.rb
152
+ - features/step_definitions/file_steps.rb
153
+ - features/step_definitions/general_steps.rb
154
+ - features/step_definitions/mount_steps.rb
155
+ - features/step_definitions/store_steps.rb
156
+ - features/support/activerecord.rb
157
+ - features/support/datamapper.rb
158
+ - features/support/env.rb
159
+ - features/versions_basics.feature
160
+ - features/versions_nested_versions.feature
161
+ - features/versions_overridden_filename.feature
162
+ - features/versions_overriden_store_dir.feature
163
+ - lib/carrierwave.rb
32
164
  - lib/carrierwave/compatibility/paperclip.rb
33
165
  - lib/carrierwave/core_ext/blank.rb
34
166
  - lib/carrierwave/core_ext/inheritable_attributes.rb
@@ -36,6 +168,7 @@ files:
36
168
  - lib/carrierwave/mount.rb
37
169
  - lib/carrierwave/orm/activerecord.rb
38
170
  - lib/carrierwave/orm/datamapper.rb
171
+ - lib/carrierwave/orm/mongomapper.rb
39
172
  - lib/carrierwave/orm/sequel.rb
40
173
  - lib/carrierwave/processing/image_science.rb
41
174
  - lib/carrierwave/processing/rmagick.rb
@@ -44,6 +177,7 @@ files:
44
177
  - lib/carrierwave/storage/file.rb
45
178
  - lib/carrierwave/storage/s3.rb
46
179
  - lib/carrierwave/test/matchers.rb
180
+ - lib/carrierwave/uploader.rb
47
181
  - lib/carrierwave/uploader/cache.rb
48
182
  - lib/carrierwave/uploader/callbacks.rb
49
183
  - lib/carrierwave/uploader/default_path.rb
@@ -56,9 +190,13 @@ files:
56
190
  - lib/carrierwave/uploader/store.rb
57
191
  - lib/carrierwave/uploader/url.rb
58
192
  - lib/carrierwave/uploader/versions.rb
59
- - lib/carrierwave/uploader.rb
60
- - lib/carrierwave.rb
61
193
  - lib/generators/uploader_generator.rb
194
+ - rails_generators/uploader/USAGE
195
+ - rails_generators/uploader/templates/uploader.rb
196
+ - rails_generators/uploader/uploader_generator.rb
197
+ - script/console
198
+ - script/destroy
199
+ - script/generate
62
200
  - spec/compatibility/paperclip_spec.rb
63
201
  - spec/fixtures/bork.txt
64
202
  - spec/fixtures/test.jpeg
@@ -66,6 +204,7 @@ files:
66
204
  - spec/mount_spec.rb
67
205
  - spec/orm/activerecord_spec.rb
68
206
  - spec/orm/datamapper_spec.rb
207
+ - spec/orm/mongomapper_spec.rb
69
208
  - spec/orm/sequel_spec.rb
70
209
  - spec/sanitized_file_spec.rb
71
210
  - spec/spec_helper.rb
@@ -80,16 +219,14 @@ files:
80
219
  - spec/uploader/store_spec.rb
81
220
  - spec/uploader/url_spec.rb
82
221
  - spec/uploader/versions_spec.rb
83
- - rails_generators/uploader/templates/uploader.rb
84
- - rails_generators/uploader/uploader_generator.rb
85
- - rails_generators/uploader/USAGE
86
222
  has_rdoc: true
87
- homepage: http://www.example.com
223
+ homepage: http://carrierwave.rubyforge.org
88
224
  licenses: []
89
225
 
90
226
  post_install_message:
91
- rdoc_options: []
92
-
227
+ rdoc_options:
228
+ - --main
229
+ - README.rdoc
93
230
  require_paths:
94
231
  - lib
95
232
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -107,9 +244,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
244
  requirements: []
108
245
 
109
246
  rubyforge_project: carrierwave
110
- rubygems_version: 1.3.2
247
+ rubygems_version: 1.3.5
111
248
  signing_key:
112
249
  specification_version: 3
113
- summary: Simple and powerful uploads for Merb and Rails
250
+ summary: "* RDoc Documentation {available at Rubyforge}[http://carrierwave.rubyforge.org/]"
114
251
  test_files: []
115
252