image_optimizer 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +2 -0
- data/README.md +12 -10
- data/certs/jtescher.pem +7 -7
- data/checksum/image_optimizer-1.7.1.gem.sha512 +1 -0
- data/lib/image_optimizer.rb +9 -0
- data/lib/image_optimizer/image_optimizer_base.rb +4 -0
- data/lib/image_optimizer/jpeg_optimizer.rb +1 -1
- data/lib/image_optimizer/png_optimizer.rb +1 -1
- data/lib/image_optimizer/pngquant_optimizer.rb +4 -0
- data/lib/image_optimizer/version.rb +1 -1
- data/spec/image_optimizer/jpeg_optimizer_spec.rb +12 -1
- data/spec/image_optimizer/png_optimizer_spec.rb +10 -0
- data/spec/image_optimizer/pngquant_optimizer_spec.rb +7 -7
- metadata +12 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e281c990b3a3ffffdd7580f24d1ef8ef05b6639
|
4
|
+
data.tar.gz: 62ee860019a6a691f4b3a11971c6f744d0de09e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fbe361fb4ed757d209e7c4510679a918167603d25685d8b44c4b5d843c57df8fa845d479f6a79fef232fc9c689bab7ce491c1562b79e6154141cb3649a911aa
|
7
|
+
data.tar.gz: df8240f7998a0fe82e465032392f7ec2ed2a159602a8c647cb87493b460b0ed4802b77922c1ec1b1ba9f2d03e4bd28c877860458dad699aca352866b9f88acaf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -4,14 +4,10 @@ This gem allows you to simply optimize images via jpegoptim or OptiPNG.
|
|
4
4
|
|
5
5
|
Tested against ruby 2.0.x, 2.1.x, 2.2.x, 2.3.x, and ruby-head
|
6
6
|
|
7
|
-
[![Build Status](https://secure.travis-ci.org/jtescher/image_optimizer.png)]
|
8
|
-
(
|
9
|
-
[![
|
10
|
-
(https://
|
11
|
-
[![Code Climate](https://codeclimate.com/github/jtescher/image_optimizer.png)]
|
12
|
-
(https://codeclimate.com/github/jtescher/image_optimizer)
|
13
|
-
[![Coverage Status](https://coveralls.io/repos/jtescher/image_optimizer/badge.png)]
|
14
|
-
(https://coveralls.io/r/jtescher/image_optimizer)
|
7
|
+
[![Build Status](https://secure.travis-ci.org/jtescher/image_optimizer.png)](http://travis-ci.org/jtescher/image_optimizer)
|
8
|
+
[![Dependency Status](https://gemnasium.com/jtescher/image_optimizer.png)](https://gemnasium.com/jtescher/image_optimizer)
|
9
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/31aa4c1b98a4c31433a3/maintainability)](https://codeclimate.com/github/jtescher/image_optimizer/maintainability)
|
10
|
+
[![Coverage Status](https://coveralls.io/repos/jtescher/image_optimizer/badge.png)](https://coveralls.io/r/jtescher/image_optimizer)
|
15
11
|
[![Gem Version](https://badge.fury.io/rb/image_optimizer.png)](http://badge.fury.io/rb/image_optimizer)
|
16
12
|
|
17
13
|
## Installation
|
@@ -24,7 +20,7 @@ Tested against ruby 2.0.x, 2.1.x, 2.2.x, 2.3.x, and ruby-head
|
|
24
20
|
|
25
21
|
3. Gifsicle, which can be installed from [www.lcdf.org/gifsicle/](https://www.lcdf.org/gifsicle/)
|
26
22
|
|
27
|
-
4. Pngquant, which can be installed from [pngquant.org]https://pngquant.org/
|
23
|
+
4. Pngquant, which can be installed from [pngquant.org](https://pngquant.org/)
|
28
24
|
|
29
25
|
Or install the utilities via homebrew:
|
30
26
|
|
@@ -40,7 +36,7 @@ And then execute:
|
|
40
36
|
|
41
37
|
```bash
|
42
38
|
$ bundle
|
43
|
-
```
|
39
|
+
```
|
44
40
|
|
45
41
|
Or install it yourself as:
|
46
42
|
```bash
|
@@ -93,6 +89,12 @@ Default is false.
|
|
93
89
|
ImageOptimizer.new('path/to/file.jpg', quiet: true).optimize
|
94
90
|
```
|
95
91
|
|
92
|
+
You can also enable quiet mode globally:
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
ImageOptimizer.quiet = true
|
96
|
+
```
|
97
|
+
|
96
98
|
##### Lossy JPEG optimization
|
97
99
|
|
98
100
|
Pass an optional `quality` parameter to target a specific lossy JPG quality level (0-100), default is lossless
|
data/certs/jtescher.pem
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlqYXRl
|
3
3
|
c2NoZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
4
|
-
|
4
|
+
bTAeFw0xNzExMjkyMjEzNDJaFw0xODExMjkyMjEzNDJaMEAxEjAQBgNVBAMMCWph
|
5
5
|
dGVzY2hlcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
6
6
|
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7ptCQvN739Rjos4e
|
7
7
|
G2Y8uGCQxpBoXozU36PXLtR5ws7aly1QV0zRc1cy7nKnOSnXn7dEfbLGZS6/87pM
|
@@ -12,10 +12,10 @@ Ryd/QG0BcvkSHph/ZDlgfZ1V/lzWWq+mZOt/U+t6cVITSET5XDzHkeZ0BodGyAMr
|
|
12
12
|
lZpggQIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
13
13
|
QLcGxzEu2F2XI+3tIWSu8KqAFrkwHgYDVR0RBBcwFYETamF0ZXNjaGVyQGdtYWls
|
14
14
|
LmNvbTAeBgNVHRIEFzAVgRNqYXRlc2NoZXJAZ21haWwuY29tMA0GCSqGSIb3DQEB
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
BQUAA4IBAQBWRgAR+mfc834XIrCK8/Ack7tAqN6sGfBZEWIm1/KVIcxL+NbaqNRR
|
16
|
+
DnY2LTppxj50MQe+O3CLdjK7qVktjf/dFdL4lBT1l3kgn8V5/YBjFQOy/8/ReKe3
|
17
|
+
oKD7BUdCvH/Iu2WSG8VIajN1hkiSDStY8sNzPwv1IFrsdn38ruTWHHpACajIg3EP
|
18
|
+
GleOnRUhEar/TQHxJmMQYrao78Gzq/b6VhQgv5up/vvs0WHUETBx7PTmoyW1Krqm
|
19
|
+
QwZpjX6ObAC8UUVzMUl9zs9rGj05QmK5Se0ZfFZYzfO71Z8Kx7vpePbGco/fzPvk
|
20
|
+
15Xsz7dTwTgNTPwj2HLuCxQjiUskbdzv
|
21
21
|
-----END CERTIFICATE-----
|
@@ -0,0 +1 @@
|
|
1
|
+
dc5be3d00db746d52012b8f61e8c7cc546538180fbbd043bee18e466dccb5454c2e7675d37f2db91ba3db7b513dc7f5a33ed9953c182b5d22035031ed1bc99f2
|
data/lib/image_optimizer.rb
CHANGED
@@ -9,6 +9,15 @@ require 'image_optimizer/pngquant_optimizer'
|
|
9
9
|
class ImageOptimizer
|
10
10
|
include Shell
|
11
11
|
|
12
|
+
# Allow the +quiet+ flag to be set globally.
|
13
|
+
@@quiet = false
|
14
|
+
def self.quiet
|
15
|
+
@@quiet
|
16
|
+
end
|
17
|
+
def self.quiet=(value)
|
18
|
+
@@quiet = value
|
19
|
+
end
|
20
|
+
|
12
21
|
attr_reader :path, :options
|
13
22
|
def initialize(path, options = {})
|
14
23
|
@path = path
|
@@ -53,6 +53,17 @@ describe ImageOptimizer::JPEGOptimizer do
|
|
53
53
|
subject
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
context 'with global quiet mode enabled' do
|
58
|
+
before { ImageOptimizer.quiet = true }
|
59
|
+
after { ImageOptimizer.quiet = false }
|
60
|
+
|
61
|
+
it 'sets quiet parameter on the command line' do
|
62
|
+
optimizer_options = %w[-f --strip-all --all-progressive --quiet /path/to/file.jpg]
|
63
|
+
expect(jpeg_optimizer).to receive(:system).with('/usr/local/bin/jpegoptim', *optimizer_options)
|
64
|
+
subject
|
65
|
+
end
|
66
|
+
end
|
56
67
|
end
|
57
68
|
|
58
69
|
context 'optimizing utility is not installed' do
|
@@ -66,4 +77,4 @@ describe ImageOptimizer::JPEGOptimizer do
|
|
66
77
|
end
|
67
78
|
end
|
68
79
|
end
|
69
|
-
end
|
80
|
+
end
|
@@ -40,6 +40,16 @@ describe ImageOptimizer::PNGOptimizer do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
context 'with global quiet mode enabled' do
|
44
|
+
before { ImageOptimizer.quiet = true }
|
45
|
+
after { ImageOptimizer.quiet = false }
|
46
|
+
|
47
|
+
it 'sets quiet parameter on the command line' do
|
48
|
+
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o7', '-strip all', '-quiet', '/path/to/file.png')
|
49
|
+
subject
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
43
53
|
context 'without optimization parameter' do
|
44
54
|
it 'optimizes the png with level 7 optimization' do
|
45
55
|
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o7', '-strip all', '/path/to/file.png')
|
@@ -13,8 +13,8 @@ describe ImageOptimizer::PNGQuantOptimizer do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'optimizes the png' do
|
16
|
-
|
17
|
-
expect(pngquant_optimizer).to receive(:system).with(
|
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)
|
18
18
|
subject
|
19
19
|
end
|
20
20
|
|
@@ -28,18 +28,18 @@ describe ImageOptimizer::PNGQuantOptimizer do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should optimize using the given path' do
|
31
|
-
|
32
|
-
expect(pngquant_optimizer).to receive(:system).with(
|
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)
|
33
33
|
subject
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'with quality parameter' do
|
38
|
-
let(:options) { { :quality =>
|
38
|
+
let(:options) { { :quality => 99 } }
|
39
39
|
|
40
40
|
it 'optimizes the png with the quality' do
|
41
|
-
|
42
|
-
expect(pngquant_optimizer).to receive(:system).with(
|
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)
|
43
43
|
subject
|
44
44
|
end
|
45
45
|
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.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Tescher
|
@@ -12,7 +12,7 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlqYXRl
|
14
14
|
c2NoZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
15
|
-
|
15
|
+
bTAeFw0xNzExMjkyMjEzNDJaFw0xODExMjkyMjEzNDJaMEAxEjAQBgNVBAMMCWph
|
16
16
|
dGVzY2hlcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
17
17
|
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7ptCQvN739Rjos4e
|
18
18
|
G2Y8uGCQxpBoXozU36PXLtR5ws7aly1QV0zRc1cy7nKnOSnXn7dEfbLGZS6/87pM
|
@@ -23,14 +23,14 @@ cert_chain:
|
|
23
23
|
lZpggQIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
24
24
|
QLcGxzEu2F2XI+3tIWSu8KqAFrkwHgYDVR0RBBcwFYETamF0ZXNjaGVyQGdtYWls
|
25
25
|
LmNvbTAeBgNVHRIEFzAVgRNqYXRlc2NoZXJAZ21haWwuY29tMA0GCSqGSIb3DQEB
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
BQUAA4IBAQBWRgAR+mfc834XIrCK8/Ack7tAqN6sGfBZEWIm1/KVIcxL+NbaqNRR
|
27
|
+
DnY2LTppxj50MQe+O3CLdjK7qVktjf/dFdL4lBT1l3kgn8V5/YBjFQOy/8/ReKe3
|
28
|
+
oKD7BUdCvH/Iu2WSG8VIajN1hkiSDStY8sNzPwv1IFrsdn38ruTWHHpACajIg3EP
|
29
|
+
GleOnRUhEar/TQHxJmMQYrao78Gzq/b6VhQgv5up/vvs0WHUETBx7PTmoyW1Krqm
|
30
|
+
QwZpjX6ObAC8UUVzMUl9zs9rGj05QmK5Se0ZfFZYzfO71Z8Kx7vpePbGco/fzPvk
|
31
|
+
15Xsz7dTwTgNTPwj2HLuCxQjiUskbdzv
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2017-11-29 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rspec
|
@@ -111,6 +111,7 @@ extra_rdoc_files: []
|
|
111
111
|
files:
|
112
112
|
- ".gitignore"
|
113
113
|
- ".travis.yml"
|
114
|
+
- CHANGELOG.md
|
114
115
|
- Gemfile
|
115
116
|
- LICENSE.txt
|
116
117
|
- README.md
|
@@ -128,6 +129,7 @@ files:
|
|
128
129
|
- checksum/image_optimizer-1.6.0.gem.sha512
|
129
130
|
- checksum/image_optimizer-1.6.1.gem.sha512
|
130
131
|
- checksum/image_optimizer-1.7.0.gem.sha512
|
132
|
+
- checksum/image_optimizer-1.7.1.gem.sha512
|
131
133
|
- image_optimizer.gemspec
|
132
134
|
- lib/image_optimizer.rb
|
133
135
|
- lib/image_optimizer/gif_optimizer.rb
|
@@ -165,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
167
|
version: '0'
|
166
168
|
requirements: []
|
167
169
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.6.14
|
169
171
|
signing_key:
|
170
172
|
specification_version: 4
|
171
173
|
summary: Simply optimize images via jpegoptim or OptiPNG or Gifsicle
|
metadata.gz.sig
CHANGED
Binary file
|