image_optimizer 1.7.2 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 969a4901be9795c5603fe6da08a149216663c2ec
4
- data.tar.gz: 47b0be6953e9d2fe6a58c5ae3c0aa7403b6c5b98
3
+ metadata.gz: 45e5f6d43275a961ce4361e16e74964a0997fb0f
4
+ data.tar.gz: 20825e379182211fd1d91a3d3bdc7e770156a87f
5
5
  SHA512:
6
- metadata.gz: 4685d83bd013a3aa95e58a0abe28c916f8b71c12b737be3bfa9e8fa362265b158c6220c2905fff8fdeaf4591a4b2cd3f158b144b59088cca1f6b99643f340cb7
7
- data.tar.gz: '002002468cc274240a6a40c9db842a729ca761b7a830c661b954bd451aadcbbe8d28f808ff6ec02a873f9da833f651d6126f932eaeb36f7607bb6ffe75ac2f4c'
6
+ metadata.gz: 58805ec57ebd31008f53900573f3bdb1e5486b068ba0f11295180aaf216ca88cb8bc6fcb2552c5cc8e4fd42c3dbf1e6b960441f8ef0ca491bea172158c790b47
7
+ data.tar.gz: 99c6b7a0eb7661048a83462996ea59afda918b3116bc26a9225a8215ab538576faa0af7f8c5117573bc19b839973e329f4edfb210bd83c8e33133c2cff3714ad
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,6 @@
1
+ ## [1.8.0](https://github.com/jtescher/image_optimizer/releases/tag/v1.7.3) 2018-07-30
2
+ * Fix: space in file name will break PNGQuantOptimizer - https://github.com/jtescher/image_optimizer/pull/21
3
+
1
4
  ## [1.7.2](https://github.com/jtescher/image_optimizer/releases/tag/v1.7.2) 2018-01-10
2
5
  * Added quiet option support for pngquant optimizer - https://github.com/jtescher/image_optimizer/pull/19
3
6
 
data/README.md CHANGED
@@ -58,7 +58,7 @@ Pngquant is a command-line utility and a library for lossy compression of PNG im
58
58
  The conversion reduces file sizes significantly (often as much as 70%) and preserves full alpha transparency. Generated images are compatible with all modern web browsers, and have better fallback in IE6 than 24-bit PNGs.
59
59
 
60
60
  ```ruby
61
- PNGQuantOptimizer.new('path/to/file.png').optimize
61
+ ImageOptimizer::PNGQuantOptimizer.new('path/to/file.png').optimize
62
62
  ```
63
63
 
64
64
  #### Optimize JPEG formats:
@@ -0,0 +1 @@
1
+ a060c2b8101654118102bbced353085a17155363cd283bf2365f8ade16fa621b83076a06cf1c0635c44ce8ef465fad4a675bcebae616cb86b83e871db67e6e44
@@ -3,22 +3,18 @@ class ImageOptimizer
3
3
 
4
4
  private
5
5
 
6
- def perform_optimizations
7
- system("#{optimizer_bin} #{command_options.join(' ')}")
8
- end
9
-
10
6
  def command_options
11
- flags = ['--skip-if-larger', '--speed 1',
12
- '--force', '--verbose', '--ext .png']
7
+ flags = ['--skip-if-larger', '--speed=1',
8
+ '--force', '--verbose', '--ext=.png']
13
9
 
14
10
  flags -= ['--verbose'] if quiet?
15
- flags << quantity
11
+ flags << quality
16
12
  flags << path
17
13
  end
18
14
 
19
- def quantity
20
- return "--quality 100" unless (0..100).include?(options[:quality])
21
- "--quality #{options[:quality]}"
15
+ def quality
16
+ return "--quality=100" unless (0..100).include?(options[:quality])
17
+ "--quality=#{options[:quality]}"
22
18
  end
23
19
 
24
20
  def extensions
@@ -1,3 +1,3 @@
1
1
  class ImageOptimizer
2
- VERSION = '1.7.2'
2
+ VERSION = '1.8.0'
3
3
  end
@@ -3,7 +3,8 @@ require 'spec_helper'
3
3
  describe ImageOptimizer::PNGQuantOptimizer do
4
4
  describe '#optimize' do
5
5
  let(:options) { {} }
6
- let(:pngquant_optimizer) { ImageOptimizer::PNGQuantOptimizer.new('/path/to/file.png', options) }
6
+ let(:path) { '/path/to/file.png' }
7
+ let(:pngquant_optimizer) { ImageOptimizer::PNGQuantOptimizer.new(path, options) }
7
8
  after { ImageOptimizer::PNGQuantOptimizer.instance_variable_set(:@bin, nil) }
8
9
  subject { pngquant_optimizer.optimize }
9
10
 
@@ -13,8 +14,8 @@ describe ImageOptimizer::PNGQuantOptimizer do
13
14
  end
14
15
 
15
16
  it 'optimizes the png' do
16
- expected_cmd = "/usr/local/bin/pngquant --skip-if-larger --speed\ 1 --force --verbose --ext\ .png --quality\ 100 /path/to/file.png"
17
- expect(pngquant_optimizer).to receive(:system).with(expected_cmd)
17
+ expected_cmd = %w[/usr/local/bin/pngquant --skip-if-larger --speed=1 --force --verbose --ext=.png --quality=100 /path/to/file.png]
18
+ expect(pngquant_optimizer).to receive(:system).with(*expected_cmd)
18
19
  subject
19
20
  end
20
21
 
@@ -28,8 +29,8 @@ describe ImageOptimizer::PNGQuantOptimizer do
28
29
  end
29
30
 
30
31
  it 'should optimize using the given path' do
31
- expected_cmd = "#{image_pngquant_bin_path} --skip-if-larger --speed\ 1 --force --verbose --ext\ .png --quality\ 100 /path/to/file.png"
32
- expect(pngquant_optimizer).to receive(:system).with(expected_cmd)
32
+ expected_cmd = %w[--skip-if-larger --speed=1 --force --verbose --ext=.png --quality=100 /path/to/file.png]
33
+ expect(pngquant_optimizer).to receive(:system).with(image_pngquant_bin_path, *expected_cmd)
33
34
  subject
34
35
  end
35
36
  end
@@ -38,8 +39,8 @@ describe ImageOptimizer::PNGQuantOptimizer do
38
39
  let(:options) { { :quality => 99 } }
39
40
 
40
41
  it 'optimizes the png with the quality' do
41
- expected_cmd = "/usr/local/bin/pngquant --skip-if-larger --speed\ 1 --force --verbose --ext\ .png --quality\ 99 /path/to/file.png"
42
- expect(pngquant_optimizer).to receive(:system).with(expected_cmd)
42
+ expected_cmd = %w[/usr/local/bin/pngquant --skip-if-larger --speed=1 --force --verbose --ext=.png --quality=99 /path/to/file.png]
43
+ expect(pngquant_optimizer).to receive(:system).with(*expected_cmd)
43
44
  subject
44
45
  end
45
46
  end
@@ -48,8 +49,18 @@ describe ImageOptimizer::PNGQuantOptimizer do
48
49
  let(:options) { { :quiet => true } }
49
50
 
50
51
  it 'optimizes the png with the quality' do
51
- expected_cmd = "/usr/local/bin/pngquant --skip-if-larger --speed\ 1 --force --ext\ .png --quality\ 100 /path/to/file.png"
52
- expect(pngquant_optimizer).to receive(:system).with(expected_cmd)
52
+ expected_cmd = %w[/usr/local/bin/pngquant --skip-if-larger --speed=1 --force --ext=.png --quality=100 /path/to/file.png]
53
+ expect(pngquant_optimizer).to receive(:system).with(*expected_cmd)
54
+ subject
55
+ end
56
+ end
57
+
58
+ context 'with space in file name' do
59
+ let(:path) { '/path/to/file 2.png' }
60
+
61
+ it do
62
+ expected_cmd = %w[/usr/local/bin/pngquant --skip-if-larger --speed=1 --force --verbose --ext=.png --quality=100]
63
+ expect(pngquant_optimizer).to receive(:system).with(*expected_cmd, path)
53
64
  subject
54
65
  end
55
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_optimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Tescher
@@ -30,7 +30,7 @@ cert_chain:
30
30
  QwZpjX6ObAC8UUVzMUl9zs9rGj05QmK5Se0ZfFZYzfO71Z8Kx7vpePbGco/fzPvk
31
31
  15Xsz7dTwTgNTPwj2HLuCxQjiUskbdzv
32
32
  -----END CERTIFICATE-----
33
- date: 2018-01-11 00:00:00.000000000 Z
33
+ date: 2018-07-30 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rspec
@@ -131,6 +131,7 @@ files:
131
131
  - checksum/image_optimizer-1.7.0.gem.sha512
132
132
  - checksum/image_optimizer-1.7.1.gem.sha512
133
133
  - checksum/image_optimizer-1.7.2.gem.sha512
134
+ - checksum/image_optimizer-1.8.0.gem.sha512
134
135
  - image_optimizer.gemspec
135
136
  - lib/image_optimizer.rb
136
137
  - lib/image_optimizer/gif_optimizer.rb
metadata.gz.sig CHANGED
Binary file