image_optimizer 1.4.0 → 1.5.0
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/.travis.yml +5 -16
- data/README.md +15 -4
- data/certs/jtescher.pem +21 -0
- data/checksum/image_optimizer-1.4.0.gem.sha512 +1 -0
- data/checksum/image_optimizer-1.5.0.gem.sha512 +1 -0
- data/image_optimizer.gemspec +1 -1
- data/lib/image_optimizer/png_optimizer.rb +10 -0
- data/lib/image_optimizer/version.rb +1 -1
- data/spec/image_optimizer/png_optimizer_spec.rb +13 -5
- data.tar.gz.sig +2 -3
- metadata +21 -19
- metadata.gz.sig +0 -0
- data/certs/gem-public_cert.pem +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe0ce5556db01889c9fef089fed908d4f1b79bc2
|
4
|
+
data.tar.gz: ceedd80eaf3103531acb0fc65294f8a490a6d0ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a97195d6d3deff29e16156d0844f56590175c3b4aa0307eebd824a532b17e8bd8a6efad00be116bcc66e80fb87687b1cb6964882ebed81a47756e79fd523f934
|
7
|
+
data.tar.gz: 51237df0a72c67bbb412a27d3a7851728d84ea5333ceb1ab91286125c82f85a9af7a7eafdb1e495496f3762853948d38e9af49314fbb4ed7509447965f7f5f77
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
@@ -1,21 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
4
|
-
-
|
5
|
-
-
|
6
|
-
-
|
7
|
-
- 1.9.2
|
8
|
-
- 1.9.3
|
9
|
-
- 2.0.0
|
10
|
-
- 2.1.0
|
3
|
+
- 2.0
|
4
|
+
- 2.1
|
5
|
+
- 2.2
|
6
|
+
- 2.3
|
11
7
|
- ruby-head
|
12
|
-
- rbx-2.1.0
|
13
|
-
- rbx-2.2.0
|
14
|
-
- ree
|
15
8
|
matrix:
|
16
9
|
allow_failures:
|
17
|
-
- rvm:
|
18
|
-
- rvm: 1.8.7
|
19
|
-
- rvm: rbx-2.1.0
|
20
|
-
- rvm: rbx-2.2.0
|
21
|
-
- rvm: ree
|
10
|
+
- rvm: 2.1
|
data/README.md
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
This gem allows you to simply optimize images via jpegoptim or OptiPNG.
|
4
4
|
|
5
|
-
Tested against ruby
|
6
|
-
rbx-2.2.0, and ree
|
5
|
+
Tested against ruby 2.0.x, 2.1.x, 2.2.x, 2.3.x, and ruby-head
|
7
6
|
|
8
7
|
[![Build Status](https://secure.travis-ci.org/jtescher/image_optimizer.png)]
|
9
8
|
(http://travis-ci.org/jtescher/image_optimizer)
|
@@ -18,12 +17,12 @@ rbx-2.2.0, and ree
|
|
18
17
|
## Installation
|
19
18
|
|
20
19
|
##### This gem uses the following utilities for optimizing images:
|
21
|
-
|
20
|
+
|
22
21
|
1. jpegoptim, which can be installed from [freecode.com](http://freecode.com/projects/jpegoptim)
|
23
22
|
|
24
23
|
2. OptiPNG, which can be installed from [sourceforge.net](http://optipng.sourceforge.net/)
|
25
24
|
|
26
|
-
Or install the utilities via homebrew:
|
25
|
+
Or install the utilities via homebrew:
|
27
26
|
|
28
27
|
```bash
|
29
28
|
$ brew install optipng jpegoptim
|
@@ -98,6 +97,18 @@ optimizer will ignore the value.
|
|
98
97
|
ImageOptimizer.new('path/to/file.png', level: 3).optimize
|
99
98
|
```
|
100
99
|
|
100
|
+
##### Don't Remove metadata from PNG
|
101
|
+
|
102
|
+
By default, `optipng` is called with the `-strip all` flag, which removes all the
|
103
|
+
level of metadata. This default generates the most optimized results.
|
104
|
+
|
105
|
+
You can skip removing the meta data by changing the `strip_metadata` parameter to
|
106
|
+
`false`. the JPEG optimizer will ignore the value.
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
ImageOptimizer.new('path/to/file.png', strip_metadata: false).optimize
|
110
|
+
```
|
111
|
+
|
101
112
|
##### Use identify
|
102
113
|
|
103
114
|
Pass an optional `identify` parameter to identify file types using ImageMagick or GraphicsMagick `identify`
|
data/certs/jtescher.pem
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlqYXRl
|
3
|
+
c2NoZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
4
|
+
bTAeFw0xNjA5MTQyMjMxMjBaFw0xNzA5MTQyMjMxMjBaMEAxEjAQBgNVBAMMCWph
|
5
|
+
dGVzY2hlcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
6
|
+
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo/27NcaBOvlvmUdK
|
7
|
+
M3aFbSE7m6nB7PlWFjIo87KF3uuQCraFKTMzKjnkL4dryjbecnqRUFXbIqOu1SkZ
|
8
|
+
DRgVsJKxOY5OpF5tXRmlF4eVjgilCv8BO/+ATxw1JGZNurAX0mAWT14dHYl0Xm7Z
|
9
|
+
nLHNiLuWhf0uPpUIx3yOUUXIvl8bhrDlWMI8sLNpzsQzvcsOOcT9kLTsPn2Mzlpv
|
10
|
+
/A5iFbL8yY1zUTEQtbKS8g9RhbCDWmTy1OwYHbtvytiAZmCYQ0TOwg8ylOw/HRMU
|
11
|
+
IwZluiuqT3sm66YLBg2EuWJrh/qUo0QuAXRau+jDe59zMufAh82+A5cc8PcQAZy4
|
12
|
+
vVlnhQIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
13
|
+
zi6rnRE1R95g8cPiHKd7HfLYKUUwHgYDVR0RBBcwFYETamF0ZXNjaGVyQGdtYWls
|
14
|
+
LmNvbTAeBgNVHRIEFzAVgRNqYXRlc2NoZXJAZ21haWwuY29tMA0GCSqGSIb3DQEB
|
15
|
+
BQUAA4IBAQBhA+GcLNVACfbzlRvteRf82wcUHfSSnJT9pW+Fac0BTOIKxq20eA7Q
|
16
|
+
E9/+Nw0dXAv/ZKHrsE8we10HrdATi/Ttihw3gq5Vr/aqPYhGg4v2VU3hTWGiDgDF
|
17
|
+
Le7d8cKn7l5JiPzQA4lle8Pli4T1ZmRO77PoupGtgvWhjc4VdoJXv4HwpnCI5B/u
|
18
|
+
AtfAg94ozrWwnqyyyKwUQF8r6uWq5ISmEW5P7P+YwC6ZgOfpc96Vbq3O5T0RqdCs
|
19
|
+
LpH0VjewjPomJA/RfvDFE1lD+k3QydZ0BqVdYeOvi566MkIyaYoif219EWYkKJyC
|
20
|
+
yXHWBt/qnJVmxQWrl6i/kGXOqafTVBHj
|
21
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1 @@
|
|
1
|
+
d469c87f7ecd4257d577acb85f18eb3f88ad04cbd1a68ca41d2504a85808718596d19ded948ce7bd2891bc5fcfee1f4251d3c88b3424bcef57f0b4567b1e7593
|
@@ -0,0 +1 @@
|
|
1
|
+
7d9f36ef721f2e78205cf17b03f580ed892f474c2a7d0f6f0847948e64fa7585a371ba78fce84f35bea868b59bacc6fec84fd3302be382a7cacf90cb326f756b
|
data/image_optimizer.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.homepage = "https://github.com/jtescher/image_optimizer"
|
14
14
|
gem.license = 'MIT'
|
15
15
|
gem.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $0 =~ /gem\z/
|
16
|
-
gem.cert_chain = ['certs/
|
16
|
+
gem.cert_chain = ['certs/jtescher.pem']
|
17
17
|
|
18
18
|
gem.files = `git ls-files`.split($/)
|
19
19
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -5,6 +5,7 @@ class ImageOptimizer
|
|
5
5
|
|
6
6
|
def command_options
|
7
7
|
flags = %W[-o#{level}]
|
8
|
+
flags << strip_metadata if strip_metadata?
|
8
9
|
flags << quiet if options[:quiet]
|
9
10
|
flags << path
|
10
11
|
end
|
@@ -13,6 +14,15 @@ class ImageOptimizer
|
|
13
14
|
options[:level] || 7
|
14
15
|
end
|
15
16
|
|
17
|
+
def strip_metadata
|
18
|
+
'-strip all'
|
19
|
+
end
|
20
|
+
|
21
|
+
def strip_metadata?
|
22
|
+
return options[:strip_metadata] if options.key? :strip_metadata
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
16
26
|
def quiet
|
17
27
|
'-quiet'
|
18
28
|
end
|
@@ -13,7 +13,7 @@ describe ImageOptimizer::PNGOptimizer do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'optimizes the png' do
|
16
|
-
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o7', '/path/to/file.png')
|
16
|
+
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o7', '-strip all', '/path/to/file.png')
|
17
17
|
subject
|
18
18
|
end
|
19
19
|
|
@@ -27,7 +27,7 @@ describe ImageOptimizer::PNGOptimizer do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'detects if there is an ENV variable path to optipng' do
|
30
|
-
expect(png_optimizer).to receive(:system).with(image_optim_optipng_bin_path, '-o7', '/path/to/file.png')
|
30
|
+
expect(png_optimizer).to receive(:system).with(image_optim_optipng_bin_path, '-o7', '-strip all', '/path/to/file.png')
|
31
31
|
subject
|
32
32
|
end
|
33
33
|
end
|
@@ -35,14 +35,14 @@ describe ImageOptimizer::PNGOptimizer do
|
|
35
35
|
context 'with quiet parameter' do
|
36
36
|
let(:options) { { :quiet => true } }
|
37
37
|
it 'optimizes the png' do
|
38
|
-
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o7', '-quiet', '/path/to/file.png')
|
38
|
+
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o7', '-strip all', '-quiet', '/path/to/file.png')
|
39
39
|
subject
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
context 'without optimization parameter' do
|
44
44
|
it 'optimizes the png with level 7 optimization' do
|
45
|
-
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o7', '/path/to/file.png')
|
45
|
+
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o7', '-strip all', '/path/to/file.png')
|
46
46
|
subject
|
47
47
|
end
|
48
48
|
end
|
@@ -50,7 +50,15 @@ describe ImageOptimizer::PNGOptimizer do
|
|
50
50
|
context 'with optimization parameter' do
|
51
51
|
let(:options) { { level: 3 } }
|
52
52
|
it 'optimizes the png with the requested optimization level' do
|
53
|
-
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o3', '/path/to/file.png')
|
53
|
+
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o3', '-strip all', '/path/to/file.png')
|
54
|
+
subject
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'without strip metadata objects parameter' do
|
59
|
+
let(:options) { { strip_metadata: false } }
|
60
|
+
it 'removes the requested metadata objects from the png' do
|
61
|
+
expect(png_optimizer).to receive(:system).with('/usr/local/bin/optipng', '-o7', '/path/to/file.png')
|
54
62
|
subject
|
55
63
|
end
|
56
64
|
end
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
3=�Sp��s4���W�Z!ʎr�1U��?�H�F�4��)�i/���Tw���8�dƊ{Y�H`�Pmi
|
1
|
+
n�pIԇd�a��VA4�2#}��үG�4�|�ȍB��>�;-�p�n]�4��=6���ה����6�!�K�9�Y�#aU�N_-�Ga���>r���E��y1^�A�X���uf ^��WuLL�ڹkxZ�F�ܡ����鎸��P�U���x��ǧ��KO.�� _����)���Y#!��hA
|
2
|
+
�6^���z#���c�"�D�ACD=D�n����Ό(��0��MjГ�歫;>s����Bg�~6��u��T
|
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.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Tescher
|
@@ -12,25 +12,25 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlqYXRl
|
14
14
|
c2NoZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
15
|
-
|
15
|
+
bTAeFw0xNjA5MTQyMjMxMjBaFw0xNzA5MTQyMjMxMjBaMEAxEjAQBgNVBAMMCWph
|
16
16
|
dGVzY2hlcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo/27NcaBOvlvmUdK
|
18
|
+
M3aFbSE7m6nB7PlWFjIo87KF3uuQCraFKTMzKjnkL4dryjbecnqRUFXbIqOu1SkZ
|
19
|
+
DRgVsJKxOY5OpF5tXRmlF4eVjgilCv8BO/+ATxw1JGZNurAX0mAWT14dHYl0Xm7Z
|
20
|
+
nLHNiLuWhf0uPpUIx3yOUUXIvl8bhrDlWMI8sLNpzsQzvcsOOcT9kLTsPn2Mzlpv
|
21
|
+
/A5iFbL8yY1zUTEQtbKS8g9RhbCDWmTy1OwYHbtvytiAZmCYQ0TOwg8ylOw/HRMU
|
22
|
+
IwZluiuqT3sm66YLBg2EuWJrh/qUo0QuAXRau+jDe59zMufAh82+A5cc8PcQAZy4
|
23
|
+
vVlnhQIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
24
|
+
zi6rnRE1R95g8cPiHKd7HfLYKUUwHgYDVR0RBBcwFYETamF0ZXNjaGVyQGdtYWls
|
25
25
|
LmNvbTAeBgNVHRIEFzAVgRNqYXRlc2NoZXJAZ21haWwuY29tMA0GCSqGSIb3DQEB
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
BQUAA4IBAQBhA+GcLNVACfbzlRvteRf82wcUHfSSnJT9pW+Fac0BTOIKxq20eA7Q
|
27
|
+
E9/+Nw0dXAv/ZKHrsE8we10HrdATi/Ttihw3gq5Vr/aqPYhGg4v2VU3hTWGiDgDF
|
28
|
+
Le7d8cKn7l5JiPzQA4lle8Pli4T1ZmRO77PoupGtgvWhjc4VdoJXv4HwpnCI5B/u
|
29
|
+
AtfAg94ozrWwnqyyyKwUQF8r6uWq5ISmEW5P7P+YwC6ZgOfpc96Vbq3O5T0RqdCs
|
30
|
+
LpH0VjewjPomJA/RfvDFE1lD+k3QydZ0BqVdYeOvi566MkIyaYoif219EWYkKJyC
|
31
|
+
yXHWBt/qnJVmxQWrl6i/kGXOqafTVBHj
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2016-09-
|
33
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rspec
|
@@ -115,7 +115,7 @@ files:
|
|
115
115
|
- LICENSE.txt
|
116
116
|
- README.md
|
117
117
|
- Rakefile
|
118
|
-
- certs/
|
118
|
+
- certs/jtescher.pem
|
119
119
|
- checksum/image_optimizer-0.0.1.gem.sha512
|
120
120
|
- checksum/image_optimizer-0.0.2.gem.sha512
|
121
121
|
- checksum/image_optimizer-1.0.0.gem.sha512
|
@@ -123,6 +123,8 @@ files:
|
|
123
123
|
- checksum/image_optimizer-1.2.0.gem.sha512
|
124
124
|
- checksum/image_optimizer-1.2.1.gem.sha512
|
125
125
|
- checksum/image_optimizer-1.3.0.gem.sha512
|
126
|
+
- checksum/image_optimizer-1.4.0.gem.sha512
|
127
|
+
- checksum/image_optimizer-1.5.0.gem.sha512
|
126
128
|
- image_optimizer.gemspec
|
127
129
|
- lib/image_optimizer.rb
|
128
130
|
- lib/image_optimizer/image_optimizer_base.rb
|
@@ -156,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
158
|
version: '0'
|
157
159
|
requirements: []
|
158
160
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.6.6
|
160
162
|
signing_key:
|
161
163
|
specification_version: 4
|
162
164
|
summary: Simply optimize images via jpegoptim or OptiPNG
|
metadata.gz.sig
CHANGED
Binary file
|
data/certs/gem-public_cert.pem
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlqYXRl
|
3
|
-
c2NoZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
4
|
-
bTAeFw0xNjA5MDgxNjU1NTdaFw0xNzA5MDgxNjU1NTdaMEAxEjAQBgNVBAMMCWph
|
5
|
-
dGVzY2hlcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
6
|
-
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuqjxHf9b5nxdJjxw
|
7
|
-
VCSEWNowdtX5xO6hL6mCkiQmdCN0it10hexslLX0xU2O5ZYRf49GbwXR+WX0KLNw
|
8
|
-
u6PP8C98ivYjd3s61c7b67ox6CM+xhk4jzJGOklvT6CDJyb2M94HkrjoQ5wBqdCD
|
9
|
-
UqV66AMR9jXFCWsMmS/oViCv/EAn4277XL4W/XFmHjSHl7wFHI9vpXXDPdz0BWhh
|
10
|
-
M8xtcXFpKn0B5c/xd4+vgFU0IEyUATIhkYkcXKhlVQyiwGoSyRhVeZoIXQUGvca9
|
11
|
-
5Mgz59L0Xm0L9kaBObP8WPRLtw3q/6chg9Mz56kNMSmz6TCesDYWhxBEQXIkS6le
|
12
|
-
pRLGgQIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
13
|
-
aegVvEe65dL0O+rlw/Rn0G/0tp0wHgYDVR0RBBcwFYETamF0ZXNjaGVyQGdtYWls
|
14
|
-
LmNvbTAeBgNVHRIEFzAVgRNqYXRlc2NoZXJAZ21haWwuY29tMA0GCSqGSIb3DQEB
|
15
|
-
BQUAA4IBAQCUsnKbyrt/8G3nfKNHYc4t9UfWR0kM/tIAm96bTJ05tNSIVoMnEHMA
|
16
|
-
GE2HalEgeQhxGlZOGTo6/MOkO4KskzkESR9ttG3Dh9FzmXAoUwe3j0zj4WGls/5/
|
17
|
-
qL58FP+PJRWsa5Mr3v2cbR2621MnYFcYaWIukku099vtxtOnRiu5E3PWBeyPdgGq
|
18
|
-
uckiPw91vFR5CvN/OTm9ldC7QXTJ4uFjBiyn6FWXijTPFfSLCypTN6FQzxE6XCng
|
19
|
-
xHrbjektsf9F0uFBpO8hph+/E5rUHU3TPA2zniEdww0txJKm/GfyUL0U/ueMt0mb
|
20
|
-
LMAkft3CjmFzOtBGrqWUNehvx43pyTqg
|
21
|
-
-----END CERTIFICATE-----
|