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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8888e33817df6e28e43e63a5d26aadff0ef72df2
4
- data.tar.gz: 69fd491bd8ffdf034c9ad4561a2600e8422b73f7
3
+ metadata.gz: cd48afff42e5cf9328e2c5f58c59066e89522bc1
4
+ data.tar.gz: 5ac5d20101f1d9fded1066248db67c4ea18a7548
5
5
  SHA512:
6
- metadata.gz: 9cd9c75be3ed190a8e7e2879940bff4898d85c7bd327c15eeb7a27a9ab2e31e38c14230fb13c9b72cdc52407ec2b5484492cf6146a0173d3b036d50f436e626a
7
- data.tar.gz: 068140e6335488f2a67ea7be347987e85dd7934f777cf9e0ce3d2ccfb4c626e0e4861acb526a907166be0643a5aac53e6e3533e01ae9be6f02e11e3908f9a11a
6
+ metadata.gz: b98fae5d89e75817a44fcb29265563a1c1efdbf11f58318f70c91af24132de924120838dd286aea0e4a912b695ad034b149f3aef5950e23a9878c186da20ad7b
7
+ data.tar.gz: 5cf9146bc008d34c8f0475c2123417968d41d1ad1b174e5c80605854366b5f601c19f9d2f023860ec361eda924d303950e675d4930ba42eb0d1f927ccfba1ea3
data/README.md CHANGED
@@ -1,29 +1,51 @@
1
- # Carrierwave::Processing
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
- Add this line to your application's Gemfile:
13
+ ## Use
8
14
 
9
- gem 'carrierwave-processing'
15
+ Now you can write groups of Carrierwave processors and versions outside of Uploader
10
16
 
11
- And then execute:
12
17
 
13
- $ bundle
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
- Or install it yourself as:
27
+ version :default do
28
+ process :scale => [500, 500]
29
+ end
16
30
 
17
- $ gem install carrierwave-processing
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
- TODO: Write usage instructions here
43
+ and use_processor in Uploader
22
44
 
23
- ## Contributing
45
+ class SomeUploader < CarrierWave::Uploader::Base
46
+ use_processor :image, :if => :image?
24
47
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
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
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module Processor
3
- VERSION = "1.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -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: '1.0'
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-25 00:00:00.000000000 Z
11
+ date: 2013-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave