carrierwave-meta 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ module CurrentProcessor
2
+ extend ::ActiveSupport::Concern
3
+
4
+ included do
5
+ case PROCESSOR
6
+ when :image_sorcery
7
+ require 'carrierwave-imagesorcery'
8
+ include CarrierWave::ImageSorcery
9
+ when :vips
10
+ require 'carrierwave-vips'
11
+ include CarrierWave::Vips
12
+ when :mini_magick
13
+ include CarrierWave::MiniMagick
14
+ else
15
+ include CarrierWave::RMagick
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,27 @@
1
+ if ENV['STORAGE'] == 'fog'
2
+ Fog.mock!
3
+
4
+ Fog.credentials = {
5
+ :provider => 'AWS',
6
+ :aws_access_key_id => 'xxx',
7
+ :aws_secret_access_key => 'yyy',
8
+ :region => 'eu-west-1',
9
+ :host => 's3.example.com',
10
+ :endpoint => 'https://s3.example.com:8080'
11
+ }
12
+
13
+ connection = Fog::Storage.new(:provider => 'AWS')
14
+ connection.directories.create(:key => 'dev-bucket')
15
+
16
+ CarrierWave.configure do |config|
17
+ config.fog_credentials = Fog.credentials
18
+ config.fog_directory = 'dev-bucket'
19
+ config.fog_public = true
20
+ config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
21
+ config.storage = :fog
22
+ end
23
+ else
24
+ CarrierWave.configure do |config|
25
+ config.storage = :file
26
+ end
27
+ end
@@ -1,15 +1,10 @@
1
- ActiveRecord::Schema.define :version => 0 do
2
- create_table "test_models", :force => true do |t|
3
- t.string :image
4
-
5
- t.integer :image_width
6
- t.integer :image_height
7
- t.string :image_content_type
8
- t.integer :image_file_size
1
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
2
+
3
+ ActiveRecord::Schema.define :version => 1 do
9
4
 
10
- t.integer :image_version_width
11
- t.integer :image_version_height
12
- t.integer :image_version_file_size
13
- t.string :image_version_content_type
5
+ create_table "test_composed_models", :force => true do |t|
6
+ t.string :image
7
+ t.text :image_meta
14
8
  end
9
+
15
10
  end
@@ -1,9 +1,5 @@
1
1
  class TestBlankUploader < CarrierWave::Uploader::Base
2
- if PROCESSOR == :mini_magick
3
- include CarrierWave::MiniMagick
4
- else
5
- include CarrierWave::RMagick
6
- end
2
+ include CurrentProcessor
7
3
  include CarrierWave::Meta
8
4
 
9
5
  def store_dir
@@ -14,6 +10,5 @@ class TestBlankUploader < CarrierWave::Uploader::Base
14
10
  "tmp/cache"
15
11
  end
16
12
 
17
- storage :file
18
13
  process :store_meta
19
14
  end
@@ -0,0 +1,7 @@
1
+ class TestComposedModel < ActiveRecord::Base
2
+ extend CarrierWave::Meta::ActiveRecord
3
+
4
+ mount_uploader :image, TestUploader
5
+ serialize :image_meta, OpenStruct
6
+ carrierwave_meta_composed :image_meta, :image, image_version: [:width, :height]
7
+ end
@@ -5,13 +5,11 @@ class TestDelegateUploader < CarrierWave::Uploader::Base
5
5
  :dimensions => [1, 1],
6
6
  :version_dimensions => [2, 2]
7
7
  }
8
-
8
+
9
9
  DEFAULT_VALUES = {
10
10
  :x => 0,
11
11
  :dimensions => []
12
12
  }
13
-
14
- storage :file
15
13
 
16
14
  def store_dir
17
15
  "tmp/store"
@@ -19,23 +17,23 @@ class TestDelegateUploader < CarrierWave::Uploader::Base
19
17
 
20
18
  def cache_dir
21
19
  "tmp/cache"
22
- end
23
-
20
+ end
21
+
24
22
  include CarrierWave::ModelDelegateAttribute
25
-
23
+
26
24
  model_delegate_attribute :x, DEFAULT_VALUES[:x]
27
25
  model_delegate_attribute :dimensions, DEFAULT_VALUES[:dimensions]
28
-
26
+
29
27
  process :set_values
30
28
  version :version do
31
29
  process :set_values_for_version
32
30
  end
33
-
31
+
34
32
  def set_values
35
33
  self.x = VALUES[:x]
36
34
  self.dimensions = VALUES[:dimensions]
37
35
  end
38
-
36
+
39
37
  def set_values_for_version
40
38
  self.x = VALUES[:version_x]
41
39
  self.dimensions = VALUES[:version_dimensions]
@@ -2,20 +2,21 @@ class TestModel
2
2
  attr_accessor :image_x
3
3
  attr_accessor :image_version_x
4
4
  attr_accessor :image_dimensions
5
- attr_accessor :image_version_dimensions
5
+ attr_accessor :image_version_dimensions
6
6
 
7
- attr_accessor :image_width
7
+ attr_accessor :image_width
8
8
  attr_accessor :image_height
9
- attr_accessor :image_image_size
9
+ attr_accessor :image_image_size
10
10
  attr_accessor :image_content_type
11
11
  attr_accessor :image_file_size
12
+ attr_accessor :image_md5sum
12
13
 
13
- attr_accessor :image_version_width
14
+ attr_accessor :image_version_width
14
15
  attr_accessor :image_version_height
15
16
  attr_accessor :image_version_image_size
16
17
  attr_accessor :image_version_content_type
17
18
  attr_accessor :image_version_file_size
18
-
19
+
19
20
  attr_accessor :destroyed
20
21
 
21
22
  def destroyed?
@@ -1,11 +1,7 @@
1
1
  class TestUploader < CarrierWave::Uploader::Base
2
- if PROCESSOR == :mini_magick
3
- include CarrierWave::MiniMagick
4
- else
5
- include CarrierWave::RMagick
6
- end
2
+ include CurrentProcessor
7
3
  include CarrierWave::Meta
8
-
4
+
9
5
  def store_dir
10
6
  "tmp/store"
11
7
  end
@@ -14,9 +10,7 @@ class TestUploader < CarrierWave::Uploader::Base
14
10
  "tmp/cache"
15
11
  end
16
12
 
17
- storage :file
18
-
19
- process :store_meta
13
+ process :store_meta => [{md5sum: true}]
20
14
  version :version do
21
15
  process :resize_to_fill => [200, 200]
22
16
  process :store_meta
metadata CHANGED
@@ -1,144 +1,197 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-meta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Victor Sokolov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-24 00:00:00.000000000 Z
11
+ date: 2013-08-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: carrierwave
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.5.7
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.5.7
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activesupport
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '3.0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '3.0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: mime-types
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec-rails
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '2.6'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '2.6'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: sqlite3-ruby
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rmagick
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: mini_magick
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: mime-types
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: carrierwave-imagesorcery
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: carrierwave-vips
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: fog
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ version: 1.3.1
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ~>
165
+ - !ruby/object:Gem::Version
166
+ version: 1.3.1
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: activerecord
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '3.0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '3.0'
142
195
  description: ''
143
196
  email:
144
197
  - gzigzigzi@gmail.com
@@ -147,54 +200,79 @@ extensions: []
147
200
  extra_rdoc_files: []
148
201
  files:
149
202
  - .gitignore
203
+ - .travis.yml
150
204
  - Gemfile
151
205
  - README.rdoc
152
206
  - Rakefile
153
207
  - carrierwave-meta.gemspec
154
208
  - lib/carrierwave-meta.rb
209
+ - lib/carrierwave-meta/active_record.rb
155
210
  - lib/carrierwave-meta/meta.rb
156
211
  - lib/carrierwave-meta/model_delegate_attribute.rb
157
212
  - lib/carrierwave-meta/version.rb
158
213
  - spec/fixtures/big.jpg
159
214
  - spec/fixtures/big.zip
160
215
  - spec/fixtures/corrupted.bmp
216
+ - spec/fixtures/corrupted.eps
217
+ - spec/fixtures/corrupted.pdf
218
+ - spec/fixtures/flash.swf
219
+ - spec/fixtures/sample.eps
220
+ - spec/fixtures/sample.pdf
161
221
  - spec/fixtures/small.png
222
+ - spec/modules/active_record_spec.rb
162
223
  - spec/modules/meta_spec.rb
163
224
  - spec/modules/model_delegate_attribute_spec.rb
164
225
  - spec/spec_helper.rb
226
+ - spec/support/current_processor.rb
227
+ - spec/support/remote.rb
165
228
  - spec/support/schema.rb
166
229
  - spec/support/test_blank_uploader.rb
230
+ - spec/support/test_composed_model.rb
167
231
  - spec/support/test_delegate_uploader.rb
168
232
  - spec/support/test_model.rb
169
233
  - spec/support/test_uploader.rb
170
234
  homepage: http://github.com/gzigzigzeo/carrierwave-meta
171
235
  licenses: []
236
+ metadata: {}
172
237
  post_install_message:
173
238
  rdoc_options: []
174
239
  require_paths:
175
240
  - lib
176
241
  required_ruby_version: !ruby/object:Gem::Requirement
177
- none: false
178
242
  requirements:
179
- - - ! '>='
243
+ - - '>='
180
244
  - !ruby/object:Gem::Version
181
245
  version: '0'
182
- segments:
183
- - 0
184
- hash: -518299106991217917
185
246
  required_rubygems_version: !ruby/object:Gem::Requirement
186
- none: false
187
247
  requirements:
188
- - - ! '>='
248
+ - - '>='
189
249
  - !ruby/object:Gem::Version
190
250
  version: '0'
191
- segments:
192
- - 0
193
- hash: -518299106991217917
194
251
  requirements: []
195
252
  rubyforge_project: carrierwave-meta
196
- rubygems_version: 1.8.24
253
+ rubygems_version: 2.0.3
197
254
  signing_key:
198
- specification_version: 3
255
+ specification_version: 4
199
256
  summary: ''
200
- test_files: []
257
+ test_files:
258
+ - spec/fixtures/big.jpg
259
+ - spec/fixtures/big.zip
260
+ - spec/fixtures/corrupted.bmp
261
+ - spec/fixtures/corrupted.eps
262
+ - spec/fixtures/corrupted.pdf
263
+ - spec/fixtures/flash.swf
264
+ - spec/fixtures/sample.eps
265
+ - spec/fixtures/sample.pdf
266
+ - spec/fixtures/small.png
267
+ - spec/modules/active_record_spec.rb
268
+ - spec/modules/meta_spec.rb
269
+ - spec/modules/model_delegate_attribute_spec.rb
270
+ - spec/spec_helper.rb
271
+ - spec/support/current_processor.rb
272
+ - spec/support/remote.rb
273
+ - spec/support/schema.rb
274
+ - spec/support/test_blank_uploader.rb
275
+ - spec/support/test_composed_model.rb
276
+ - spec/support/test_delegate_uploader.rb
277
+ - spec/support/test_model.rb
278
+ - spec/support/test_uploader.rb