carrierwave-processing 0.0.2 → 1.0.0
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/.gitignore +4 -0
 - data/.rspec +2 -0
 - data/.travis.yml +6 -0
 - data/README.md +3 -0
 - data/Rakefile +7 -1
 - data/carrierwave-processing.gemspec +4 -0
 - data/lib/carrierwave-processing/mini_magick.rb +29 -9
 - data/lib/carrierwave-processing/rmagick.rb +23 -4
 - data/lib/carrierwave-processing/version.rb +1 -1
 - data/spec/fixtures/little_foxes.jpg +0 -0
 - data/spec/fixtures/little_foxes_cmyk.jpg +0 -0
 - data/spec/integration/carrierwave_processing_spec.rb +106 -0
 - data/spec/spec_helper.rb +41 -0
 - metadata +76 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 692153452bc341564f11b2a70cdbc033c160fdd7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9e60ff3332b29d57d6300750602bbcc5c94bba41
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8956fa5709c9c8aab3bed8c7dfc7e269b8ce4f253ff6b22bdb25aacf6af5ab48d2813d2e5eabdb52f91b975b95cc83e748f844d9c655fb683eab38972e63f964
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1d89786ba670ff71e99facdd6178a4139c939e6e3b445fb0a277ee28f00aa4ac89f1949c4ab9da9558b4da1c74994a96c48e0b75801350a4a2ab5a986e799daa
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,5 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # CarrierWave::Processing
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            [](http://travis-ci.org/fxposter/carrierwave-processing)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       3 
5 
     | 
    
         
             
            Additional processing support for MiniMagick and RMagick. These are processors that I've been using in multiple projects so I decided to extract those as a gem.
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            ## Installation
         
     | 
| 
         @@ -30,6 +32,7 @@ To use those, you should include specified module (RMagick or MiniMagick) into y 
     | 
|
| 
       30 
32 
     | 
    
         
             
                  process :quality => 90 # Set JPEG/MIFF/PNG compression level (0-100)
         
     | 
| 
       31 
33 
     | 
    
         
             
                  process :convert => 'png'
         
     | 
| 
       32 
34 
     | 
    
         
             
                  process :colorspace => :rgb # Set colorspace to rgb or cmyk
         
     | 
| 
      
 35 
     | 
    
         
            +
                  process :blur => [0, 8] #reduce image noise and reduce detail levels [radius,sigma]
         
     | 
| 
       33 
36 
     | 
    
         | 
| 
       34 
37 
     | 
    
         
             
                  def filename
         
     | 
| 
       35 
38 
     | 
    
         
             
                    super.chomp(File.extname(super)) + '.png'
         
     | 
    
        data/Rakefile
    CHANGED
    
    
| 
         @@ -16,4 +16,8 @@ Gem::Specification.new do |gem| 
     | 
|
| 
       16 
16 
     | 
    
         
             
              gem.version       = CarrierWave::Processing::VERSION
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
              gem.add_dependency 'carrierwave'
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem.add_development_dependency 'rake'
         
     | 
| 
      
 20 
     | 
    
         
            +
              gem.add_development_dependency 'rspec', '~> 3.0.0.beta1'
         
     | 
| 
      
 21 
     | 
    
         
            +
              gem.add_development_dependency 'mini_magick'
         
     | 
| 
      
 22 
     | 
    
         
            +
              gem.add_development_dependency 'rmagick' if RUBY_PLATFORM != 'java'
         
     | 
| 
       19 
23 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,6 +2,9 @@ module CarrierWave 
     | 
|
| 
       2 
2 
     | 
    
         
             
              module Processing
         
     | 
| 
       3 
3 
     | 
    
         
             
                module MiniMagick
         
     | 
| 
       4 
4 
     | 
    
         
             
                  # Strips out all embedded information from the image
         
     | 
| 
      
 5 
     | 
    
         
            +
                  #
         
     | 
| 
      
 6 
     | 
    
         
            +
                  #   process :strip
         
     | 
| 
      
 7 
     | 
    
         
            +
                  #
         
     | 
| 
       5 
8 
     | 
    
         
             
                  def strip
         
     | 
| 
       6 
9 
     | 
    
         
             
                    manipulate! do |img|
         
     | 
| 
       7 
10 
     | 
    
         
             
                      img.strip
         
     | 
| 
         @@ -11,6 +14,9 @@ module CarrierWave 
     | 
|
| 
       11 
14 
     | 
    
         
             
                  end
         
     | 
| 
       12 
15 
     | 
    
         | 
| 
       13 
16 
     | 
    
         
             
                  # Reduces the quality of the image to the percentage given
         
     | 
| 
      
 17 
     | 
    
         
            +
                  #
         
     | 
| 
      
 18 
     | 
    
         
            +
                  #   process :quality => 90
         
     | 
| 
      
 19 
     | 
    
         
            +
                  #
         
     | 
| 
       14 
20 
     | 
    
         
             
                  def quality(percentage)
         
     | 
| 
       15 
21 
     | 
    
         
             
                    manipulate! do |img|
         
     | 
| 
       16 
22 
     | 
    
         
             
                      img.quality(percentage.to_s)
         
     | 
| 
         @@ -20,23 +26,37 @@ module CarrierWave 
     | 
|
| 
       20 
26 
     | 
    
         
             
                  end
         
     | 
| 
       21 
27 
     | 
    
         | 
| 
       22 
28 
     | 
    
         
             
                  # Sets the colorspace of the image to the specified value.
         
     | 
| 
       23 
     | 
    
         
            -
                  # 
     | 
| 
       24 
     | 
    
         
            -
                  #   process :rgb # force rgb
         
     | 
| 
       25 
     | 
    
         
            -
                  #   process :cmyk # force cmyk
         
     | 
| 
       26 
     | 
    
         
            -
                  # 
     | 
| 
      
 29 
     | 
    
         
            +
                  #
         
     | 
| 
      
 30 
     | 
    
         
            +
                  #   process :colorspace => :rgb # force rgb
         
     | 
| 
      
 31 
     | 
    
         
            +
                  #   process :colorspace => :cmyk # force cmyk
         
     | 
| 
      
 32 
     | 
    
         
            +
                  #
         
     | 
| 
       27 
33 
     | 
    
         
             
                  def colorspace(cs)
         
     | 
| 
       28 
34 
     | 
    
         
             
                    manipulate! do |img|
         
     | 
| 
       29 
     | 
    
         
            -
                       
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                         
     | 
| 
      
 35 
     | 
    
         
            +
                      img.combine_options do |c|
         
     | 
| 
      
 36 
     | 
    
         
            +
                        case cs.to_sym
         
     | 
| 
      
 37 
     | 
    
         
            +
                        when :rgb
         
     | 
| 
      
 38 
     | 
    
         
            +
                          c.colorspace "sRGB"
         
     | 
| 
      
 39 
     | 
    
         
            +
                        when :cmyk
         
     | 
| 
      
 40 
     | 
    
         
            +
                          c.colorspace "CMYK"
         
     | 
| 
      
 41 
     | 
    
         
            +
                        end
         
     | 
| 
       34 
42 
     | 
    
         
             
                      end
         
     | 
| 
       35 
43 
     | 
    
         
             
                      img = yield(img) if block_given?
         
     | 
| 
       36 
44 
     | 
    
         
             
                      img
         
     | 
| 
       37 
45 
     | 
    
         
             
                    end
         
     | 
| 
       38 
46 
     | 
    
         
             
                  end
         
     | 
| 
       39 
47 
     | 
    
         | 
| 
      
 48 
     | 
    
         
            +
                  # reduce image noise and reduce detail levels
         
     | 
| 
      
 49 
     | 
    
         
            +
                  #
         
     | 
| 
      
 50 
     | 
    
         
            +
                  #   process :blur => [0, 8]
         
     | 
| 
      
 51 
     | 
    
         
            +
                  #
         
     | 
| 
      
 52 
     | 
    
         
            +
                  def blur(radius, sigma)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    manipulate! do |img|
         
     | 
| 
      
 54 
     | 
    
         
            +
                      img.blur "#{radius}x#{sigma}"
         
     | 
| 
      
 55 
     | 
    
         
            +
                      img = yield(img) if block_given?
         
     | 
| 
      
 56 
     | 
    
         
            +
                      img
         
     | 
| 
      
 57 
     | 
    
         
            +
                    end
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
       40 
60 
     | 
    
         
             
                end
         
     | 
| 
       41 
61 
     | 
    
         
             
              end
         
     | 
| 
       42 
62 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,6 +2,9 @@ module CarrierWave 
     | 
|
| 
       2 
2 
     | 
    
         
             
              module Processing
         
     | 
| 
       3 
3 
     | 
    
         
             
                module RMagick
         
     | 
| 
       4 
4 
     | 
    
         
             
                  # Strips out all embedded information from the image
         
     | 
| 
      
 5 
     | 
    
         
            +
                  #
         
     | 
| 
      
 6 
     | 
    
         
            +
                  #   process :strip
         
     | 
| 
      
 7 
     | 
    
         
            +
                  #
         
     | 
| 
       5 
8 
     | 
    
         
             
                  def strip
         
     | 
| 
       6 
9 
     | 
    
         
             
                    manipulate! do |img|
         
     | 
| 
       7 
10 
     | 
    
         
             
                      img.strip!
         
     | 
| 
         @@ -11,6 +14,9 @@ module CarrierWave 
     | 
|
| 
       11 
14 
     | 
    
         
             
                  end
         
     | 
| 
       12 
15 
     | 
    
         | 
| 
       13 
16 
     | 
    
         
             
                  # Reduces the quality of the image to the percentage given
         
     | 
| 
      
 17 
     | 
    
         
            +
                  #
         
     | 
| 
      
 18 
     | 
    
         
            +
                  #   process :quality => 90
         
     | 
| 
      
 19 
     | 
    
         
            +
                  #
         
     | 
| 
       14 
20 
     | 
    
         
             
                  def quality(percentage)
         
     | 
| 
       15 
21 
     | 
    
         
             
                    manipulate! do |img|
         
     | 
| 
       16 
22 
     | 
    
         
             
                      img.write(current_path){ self.quality = percentage }
         
     | 
| 
         @@ -20,10 +26,10 @@ module CarrierWave 
     | 
|
| 
       20 
26 
     | 
    
         
             
                  end
         
     | 
| 
       21 
27 
     | 
    
         | 
| 
       22 
28 
     | 
    
         
             
                  # Sets the colorspace of the image to the specified value.
         
     | 
| 
       23 
     | 
    
         
            -
                  # 
     | 
| 
       24 
     | 
    
         
            -
                  #   process :rgb # force rgb
         
     | 
| 
       25 
     | 
    
         
            -
                  #   process :cmyk # force cmyk
         
     | 
| 
       26 
     | 
    
         
            -
                  # 
     | 
| 
      
 29 
     | 
    
         
            +
                  #
         
     | 
| 
      
 30 
     | 
    
         
            +
                  #   process :colorspace => :rgb # force rgb
         
     | 
| 
      
 31 
     | 
    
         
            +
                  #   process :colorspace => :cmyk # force cmyk
         
     | 
| 
      
 32 
     | 
    
         
            +
                  #
         
     | 
| 
       27 
33 
     | 
    
         
             
                  def colorspace(cs)
         
     | 
| 
       28 
34 
     | 
    
         
             
                    manipulate! do |img|
         
     | 
| 
       29 
35 
     | 
    
         
             
                      case cs.to_sym
         
     | 
| 
         @@ -37,6 +43,19 @@ module CarrierWave 
     | 
|
| 
       37 
43 
     | 
    
         
             
                    end
         
     | 
| 
       38 
44 
     | 
    
         
             
                  end
         
     | 
| 
       39 
45 
     | 
    
         | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  # reduce image noise and reduce detail levels
         
     | 
| 
      
 48 
     | 
    
         
            +
                  #
         
     | 
| 
      
 49 
     | 
    
         
            +
                  #   process :blur => [0, 8]
         
     | 
| 
      
 50 
     | 
    
         
            +
                  #
         
     | 
| 
      
 51 
     | 
    
         
            +
                  def blur(radius, sigma)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    manipulate! do |img|
         
     | 
| 
      
 53 
     | 
    
         
            +
                      img = img.blur_image(radius, sigma)
         
     | 
| 
      
 54 
     | 
    
         
            +
                      img = yield(img) if block_given?
         
     | 
| 
      
 55 
     | 
    
         
            +
                      img
         
     | 
| 
      
 56 
     | 
    
         
            +
                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
       40 
59 
     | 
    
         
             
                end
         
     | 
| 
       41 
60 
     | 
    
         
             
              end
         
     | 
| 
       42 
61 
     | 
    
         
             
            end
         
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,106 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'carrierwave'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'carrierwave-processing'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            working_module_names = (RUBY_PLATFORM == 'java' ? %w[MiniMagick] : %w[RMagick MiniMagick])
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            working_module_names.each do |module_name|
         
     | 
| 
      
 9 
     | 
    
         
            +
              describe CarrierWave::Processing.const_get(module_name) do
         
     | 
| 
      
 10 
     | 
    
         
            +
                before do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  FileUtils.rm_rf(fixture_path('uploads'))
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                it 'strips image metadata' do
         
     | 
| 
      
 15 
     | 
    
         
            +
                  uploader = uploader_for(module_name) {
         
     | 
| 
      
 16 
     | 
    
         
            +
                    process :strip
         
     | 
| 
      
 17 
     | 
    
         
            +
                  }
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  expect(exif(fixture_path('little_foxes.jpg'), 'Artist')).not_to be_empty
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  open_fixture 'little_foxes.jpg' do |file|
         
     | 
| 
      
 22 
     | 
    
         
            +
                    uploader.store!(file)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  expect(exif(uploader.store_path, 'Artist')).to be_empty
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                it 'reduces image quality' do
         
     | 
| 
      
 29 
     | 
    
         
            +
                  uploader = uploader_for(module_name) {
         
     | 
| 
      
 30 
     | 
    
         
            +
                    process :quality => 50
         
     | 
| 
      
 31 
     | 
    
         
            +
                  }
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  open_fixture 'little_foxes.jpg' do |file|
         
     | 
| 
      
 34 
     | 
    
         
            +
                    uploader.store!(file)
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  expect(File.size(uploader.store_path)).to be < File.size(fixture_path('little_foxes.jpg'))
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                it 'changes image colorspace to CMYK' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                  uploader = uploader_for(module_name) {
         
     | 
| 
      
 42 
     | 
    
         
            +
                    process :colorspace => :cmyk
         
     | 
| 
      
 43 
     | 
    
         
            +
                  }
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  expect(colorspace(fixture_path('little_foxes.jpg'))).to include('RGB')
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  open_fixture 'little_foxes.jpg' do |file|
         
     | 
| 
      
 48 
     | 
    
         
            +
                    uploader.store!(file)
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                  expect(colorspace(uploader.store_path)).to eq('CMYK')
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                it 'changes image colorspace to sRGB' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                  uploader = uploader_for(module_name) {
         
     | 
| 
      
 56 
     | 
    
         
            +
                    process :colorspace => :rgb
         
     | 
| 
      
 57 
     | 
    
         
            +
                  }
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                  expect(colorspace(fixture_path('little_foxes_cmyk.jpg'))).to eq('CMYK')
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                  open_fixture 'little_foxes_cmyk.jpg' do |file|
         
     | 
| 
      
 62 
     | 
    
         
            +
                    uploader.store!(file)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                  expect(colorspace(uploader.store_path)).to include('RGB')
         
     | 
| 
      
 66 
     | 
    
         
            +
                end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                it 'blurs image' do
         
     | 
| 
      
 69 
     | 
    
         
            +
                  uploader = uploader_for(module_name) {
         
     | 
| 
      
 70 
     | 
    
         
            +
                    process :blur => [5, 5]
         
     | 
| 
      
 71 
     | 
    
         
            +
                  }
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                  open_fixture 'little_foxes.jpg' do |file|
         
     | 
| 
      
 74 
     | 
    
         
            +
                    uploader.store!(file)
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                  expect(File.size(uploader.store_path)).to be < File.size(fixture_path('little_foxes.jpg'))
         
     | 
| 
      
 78 
     | 
    
         
            +
                end
         
     | 
| 
      
 79 
     | 
    
         
            +
              end
         
     | 
| 
      
 80 
     | 
    
         
            +
            end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            describe CarrierWave::Processing do
         
     | 
| 
      
 83 
     | 
    
         
            +
              before do
         
     | 
| 
      
 84 
     | 
    
         
            +
                FileUtils.rm_rf(fixture_path('uploads'))
         
     | 
| 
      
 85 
     | 
    
         
            +
              end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
              it 'produces the same transformations for all modules' do
         
     | 
| 
      
 88 
     | 
    
         
            +
                uploaders = working_module_names.map { |module_name|
         
     | 
| 
      
 89 
     | 
    
         
            +
                  uploader_for(module_name) {
         
     | 
| 
      
 90 
     | 
    
         
            +
                    process :strip
         
     | 
| 
      
 91 
     | 
    
         
            +
                    process :quality => 90
         
     | 
| 
      
 92 
     | 
    
         
            +
                    process :blur => [0, 2]
         
     | 
| 
      
 93 
     | 
    
         
            +
                    process :colorspace => :cmyk
         
     | 
| 
      
 94 
     | 
    
         
            +
                  }
         
     | 
| 
      
 95 
     | 
    
         
            +
                }
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                uploaders.each do |uploader|
         
     | 
| 
      
 98 
     | 
    
         
            +
                  open_fixture 'little_foxes.jpg' do |file|
         
     | 
| 
      
 99 
     | 
    
         
            +
                    uploader.store!(file)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  end
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                files = uploaders.map { |uploader| File.open(uploader.store_path, 'rb', &:read) }
         
     | 
| 
      
 104 
     | 
    
         
            +
                expect(files).to be_all { |file| file == files[0] }
         
     | 
| 
      
 105 
     | 
    
         
            +
              end
         
     | 
| 
      
 106 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,41 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Helpers
         
     | 
| 
      
 4 
     | 
    
         
            +
              def fixture_path(filename)
         
     | 
| 
      
 5 
     | 
    
         
            +
                File.expand_path(File.join('..', 'fixtures', filename), __FILE__)
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              def open_fixture(filename, &block)
         
     | 
| 
      
 9 
     | 
    
         
            +
                File.open(fixture_path(filename), &block)
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def exif(path, field)
         
     | 
| 
      
 13 
     | 
    
         
            +
                `identify -format %[exif:#{field}] #{path}`.chomp
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              def colorspace(path)
         
     | 
| 
      
 17 
     | 
    
         
            +
                `identify -verbose #{path} | grep 'Colorspace'`.chomp.split(':').last.strip
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              def uploader_for(module_name, &block)
         
     | 
| 
      
 21 
     | 
    
         
            +
                Class.new(CarrierWave::Uploader::Base) {
         
     | 
| 
      
 22 
     | 
    
         
            +
                  include Helpers
         
     | 
| 
      
 23 
     | 
    
         
            +
                  include CarrierWave.const_get(module_name)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  include CarrierWave::Processing.const_get(module_name)
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  instance_eval(&block)
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  define_method :store_dir do
         
     | 
| 
      
 29 
     | 
    
         
            +
                    File.expand_path(File.join('..', 'uploads'), __FILE__)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  define_method :filename do
         
     | 
| 
      
 33 
     | 
    
         
            +
                    "#{module_name}#{File.extname(super())}" if original_filename.present?
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                }.new
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            RSpec.configure do |config|
         
     | 
| 
      
 40 
     | 
    
         
            +
              config.include Helpers
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,27 +1,83 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: carrierwave-processing
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Pavel Forkert
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-01-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: carrierwave
         
     | 
| 
       15 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
     | 
    
         
            -
                - -  
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
19 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
     | 
    
         
            -
                - -  
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 3.0.0.beta1
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: 3.0.0.beta1
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: mini_magick
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: rmagick
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       25 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
82 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       27 
83 
     | 
    
         
             
            description: Additional processing support for MiniMagick and RMagick
         
     | 
| 
         @@ -31,7 +87,9 @@ executables: [] 
     | 
|
| 
       31 
87 
     | 
    
         
             
            extensions: []
         
     | 
| 
       32 
88 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       33 
89 
     | 
    
         
             
            files:
         
     | 
| 
       34 
     | 
    
         
            -
            - .gitignore
         
     | 
| 
      
 90 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 91 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 92 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
       35 
93 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       36 
94 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       37 
95 
     | 
    
         
             
            - README.md
         
     | 
| 
         @@ -41,6 +99,10 @@ files: 
     | 
|
| 
       41 
99 
     | 
    
         
             
            - lib/carrierwave-processing/mini_magick.rb
         
     | 
| 
       42 
100 
     | 
    
         
             
            - lib/carrierwave-processing/rmagick.rb
         
     | 
| 
       43 
101 
     | 
    
         
             
            - lib/carrierwave-processing/version.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - spec/fixtures/little_foxes.jpg
         
     | 
| 
      
 103 
     | 
    
         
            +
            - spec/fixtures/little_foxes_cmyk.jpg
         
     | 
| 
      
 104 
     | 
    
         
            +
            - spec/integration/carrierwave_processing_spec.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
       44 
106 
     | 
    
         
             
            homepage: https://github.com/fxposter/carrierwave-processing
         
     | 
| 
       45 
107 
     | 
    
         
             
            licenses: []
         
     | 
| 
       46 
108 
     | 
    
         
             
            metadata: {}
         
     | 
| 
         @@ -50,18 +112,23 @@ require_paths: 
     | 
|
| 
       50 
112 
     | 
    
         
             
            - lib
         
     | 
| 
       51 
113 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       52 
114 
     | 
    
         
             
              requirements:
         
     | 
| 
       53 
     | 
    
         
            -
              - -  
     | 
| 
      
 115 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       54 
116 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       55 
117 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       56 
118 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       57 
119 
     | 
    
         
             
              requirements:
         
     | 
| 
       58 
     | 
    
         
            -
              - -  
     | 
| 
      
 120 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       59 
121 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       60 
122 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       61 
123 
     | 
    
         
             
            requirements: []
         
     | 
| 
       62 
124 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       63 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 125 
     | 
    
         
            +
            rubygems_version: 2.2.1
         
     | 
| 
       64 
126 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       65 
127 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       66 
128 
     | 
    
         
             
            summary: Additional processing support for MiniMagick and RMagick
         
     | 
| 
       67 
     | 
    
         
            -
            test_files: 
     | 
| 
      
 129 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 130 
     | 
    
         
            +
            - spec/fixtures/little_foxes.jpg
         
     | 
| 
      
 131 
     | 
    
         
            +
            - spec/fixtures/little_foxes_cmyk.jpg
         
     | 
| 
      
 132 
     | 
    
         
            +
            - spec/integration/carrierwave_processing_spec.rb
         
     | 
| 
      
 133 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            has_rdoc: 
         
     |