image_optim 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/LICENSE.txt +1 -1
- data/README.markdown +7 -1
- data/image_optim.gemspec +1 -1
- data/lib/image_optim.rb +1 -1
- data/lib/image_optim/runner.rb +8 -4
- data/spec/image_optim_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmIyYWJlYjg2ODQ0YmE1MzZmMTE2ODI5Njk0OGZlZmFlMjAwODAzNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjI2NTE5ZmNiMjNkMWM0MTc3ZmJlY2FhNzJlODQ5MDg1ZWVmYzllYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTQwMDk3ZDE3YTBiNzdmOTBiMzU5NzkxNDI4ZDI1ODJhOWY3Y2Q3NzdlZjcy
|
10
|
+
NmJiZDE0MDdkODhjZmZhNjlhYmNlMGYyYmJmMzliYzdiM2RiOGI5OTk3ZjBm
|
11
|
+
YWQyN2RlMTFiMjVmY2M2NDFhMjJiMWFhYzE5OTlmNDQ2Y2RiOTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDcwZWMyMzg3YWRkM2RmYmM5NTRmOTgyYTlhOGJiMTc2M2RmN2Q3MjMyM2Yx
|
14
|
+
NzA1ZmMwZTFlNjYyYWRhMDg4MDNhYWRlNjM5Y2M1ODQzZDk1ODViZThjYTg0
|
15
|
+
ZTVkMzFlY2UxNGY5MzlhNzJlNjVkZDVmODI4ZDI5MmE1NGVmYmM=
|
data/LICENSE.txt
CHANGED
data/README.markdown
CHANGED
@@ -116,6 +116,10 @@ Optimize image in place:
|
|
116
116
|
|
117
117
|
image_optim.optimize_image!('b.jpg')
|
118
118
|
|
119
|
+
Optimize image data:
|
120
|
+
|
121
|
+
image_optim.optimize_image_data(data)
|
122
|
+
|
119
123
|
Multiple images:
|
120
124
|
|
121
125
|
image_optim.optimize_images(Dir['*.png']) do |unoptimized, optimized|
|
@@ -126,6 +130,8 @@ Multiple images:
|
|
126
130
|
|
127
131
|
image_optim.optimize_images!(Dir['*.*'])
|
128
132
|
|
133
|
+
image_optim.optimize_images_data(datas)
|
134
|
+
|
129
135
|
### From rails
|
130
136
|
|
131
137
|
`ImageOptim::Railtie` will automatically initialize processing of assets if `config.assets.compress` is true.
|
@@ -190,4 +196,4 @@ Worker can be disabled by passing false instead of options hash.
|
|
190
196
|
|
191
197
|
## Copyright
|
192
198
|
|
193
|
-
Copyright (c) 2012-
|
199
|
+
Copyright (c) 2012-2014 Ivan Kuchin. See LICENSE.txt for details.
|
data/image_optim.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'image_optim'
|
5
|
-
s.version = '0.10.
|
5
|
+
s.version = '0.10.1'
|
6
6
|
s.summary = %q{Optimize (lossless compress) images (jpeg, png, gif) using external utilities (advpng, gifsicle, jpegoptim, jpegtran, optipng, pngcrush, pngout)}
|
7
7
|
s.homepage = "http://github.com/toy/#{s.name}"
|
8
8
|
s.authors = ['Ivan Kuchin']
|
data/lib/image_optim.rb
CHANGED
data/lib/image_optim/runner.rb
CHANGED
@@ -79,12 +79,16 @@ class ImageOptim
|
|
79
79
|
else
|
80
80
|
warning "#{arg} is not an image or there is no optimizer for it"
|
81
81
|
end
|
82
|
-
elsif @recursive
|
83
|
-
|
84
|
-
|
82
|
+
elsif @recursive
|
83
|
+
if File.directory?(arg)
|
84
|
+
Find.find(arg) do |path|
|
85
|
+
files << path if File.file?(path) && @image_optim.optimizable?(path)
|
86
|
+
end
|
87
|
+
else
|
88
|
+
warning "#{arg} is not a file or a directory or does not exist"
|
85
89
|
end
|
86
90
|
else
|
87
|
-
warning "#{arg} does not exist"
|
91
|
+
warning "#{arg} is not a file or does not exist"
|
88
92
|
end
|
89
93
|
end
|
90
94
|
files
|
data/spec/image_optim_spec.rb
CHANGED
@@ -92,7 +92,7 @@ describe ImageOptim do
|
|
92
92
|
it "should optimize #{original}" do
|
93
93
|
image_optim = ImageOptim.new
|
94
94
|
optimized_data = image_optim.optimize_image_data(original.read)
|
95
|
-
optimized_data.should == image_optim.optimize_image(original.temp_copy).read
|
95
|
+
optimized_data.should == image_optim.optimize_image(original.temp_copy).open('rb', &:read)
|
96
96
|
|
97
97
|
image_optim.optimize_image_data(optimized_data).should be_nil
|
98
98
|
end
|
@@ -139,7 +139,7 @@ describe ImageOptim do
|
|
139
139
|
it "should optimize datas" do
|
140
140
|
optimized_images_datas = ImageOptim.optimize_images_data(TEST_IMAGES.map(&:read))
|
141
141
|
TEST_IMAGES.zip(optimized_images_datas).each do |original, optimized_image_data|
|
142
|
-
optimized_image_data.should == ImageOptim.optimize_image(original.temp_copy).read
|
142
|
+
optimized_image_data.should == ImageOptim.optimize_image(original.temp_copy).open('rb', &:read)
|
143
143
|
end
|
144
144
|
end
|
145
145
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_optim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Kuchin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fspath
|