carrierwave-processor 1.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +39 -17
- data/lib/carrierwave/processor/dsl.rb +2 -2
- data/lib/carrierwave/processor/version.rb +1 -1
- data/spec/uploader_dsl_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd48afff42e5cf9328e2c5f58c59066e89522bc1
|
|
4
|
+
data.tar.gz: 5ac5d20101f1d9fded1066248db67c4ea18a7548
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b98fae5d89e75817a44fcb29265563a1c1efdbf11f58318f70c91af24132de924120838dd286aea0e4a912b695ad034b149f3aef5950e23a9878c186da20ad7b
|
|
7
|
+
data.tar.gz: 5cf9146bc008d34c8f0475c2123417968d41d1ad1b174e5c80605854366b5f601c19f9d2f023860ec361eda924d303950e675d4930ba42eb0d1f927ccfba1ea3
|
data/README.md
CHANGED
|
@@ -1,29 +1,51 @@
|
|
|
1
|
-
# Carrierwave::
|
|
2
|
-
|
|
3
|
-
TODO: Write a gem description
|
|
1
|
+
# Carrierwave::Processor
|
|
4
2
|
|
|
5
3
|
## Installation
|
|
4
|
+
To use with Bundler:
|
|
5
|
+
|
|
6
|
+
gem 'carrierwave-processor', '~> 1.0'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
To require in non-rails
|
|
10
|
+
|
|
11
|
+
require 'carrierwave/processor'
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
## Use
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
Now you can write groups of Carrierwave processors and versions outside of Uploader
|
|
10
16
|
|
|
11
|
-
And then execute:
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
Just use **carrierwave_processor** somewhere for processor declaration
|
|
19
|
+
|
|
20
|
+
carrierwave_processor :image do
|
|
21
|
+
process :fix_exif_rotation
|
|
22
|
+
process :convert => 'jpg'
|
|
23
|
+
version :square do
|
|
24
|
+
process :scale => [100, 100]
|
|
25
|
+
end
|
|
14
26
|
|
|
15
|
-
|
|
27
|
+
version :default do
|
|
28
|
+
process :scale => [500, 500]
|
|
29
|
+
end
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
version :small do
|
|
32
|
+
process :scale_to_fit => [100, 100]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def fix_exif_rotation
|
|
36
|
+
manipulate! do |img|
|
|
37
|
+
img.tap(&:auto_orient)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
18
41
|
|
|
19
|
-
## Usage
|
|
20
42
|
|
|
21
|
-
|
|
43
|
+
and use_processor in Uploader
|
|
22
44
|
|
|
23
|
-
|
|
45
|
+
class SomeUploader < CarrierWave::Uploader::Base
|
|
46
|
+
use_processor :image, :if => :image?
|
|
24
47
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
5. Create new Pull Request
|
|
48
|
+
def image? m
|
|
49
|
+
# ...
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -21,9 +21,9 @@ module CarrierWave
|
|
|
21
21
|
|
|
22
22
|
def find_carrierwave_processor name
|
|
23
23
|
if self.kind_of? CarrierWave::Processor::Node
|
|
24
|
-
self.processors[name.to_sym]
|
|
24
|
+
self.processors && self.processors[name.to_sym]
|
|
25
25
|
else
|
|
26
|
-
CarrierWave::Processor.processors[name.to_sym]
|
|
26
|
+
CarrierWave::Processor.processors && CarrierWave::Processor.processors[name.to_sym]
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
data/spec/uploader_dsl_spec.rb
CHANGED
|
@@ -136,4 +136,9 @@ describe CarrierWave::Processor::UploaderDsl do
|
|
|
136
136
|
FooUploader.send(:use_processor, :some_processor, :if => :root)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
+
it "doesnt raise NoMethodError when no processor declared" do
|
|
140
|
+
CarrierWave::Processor.processors = nil
|
|
141
|
+
expect {FooUploader.send(:use_processor, :some_processor) }.to raise_error(CarrierWave::Processor::ProcessorNotFoundError)
|
|
142
|
+
end
|
|
143
|
+
|
|
139
144
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: carrierwave-processor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexander Kostrov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-12-
|
|
11
|
+
date: 2013-12-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: carrierwave
|