image_optim 0.13.3 → 0.14.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 +8 -8
- data/.rubocop.yml +56 -0
- data/.travis.yml +3 -1
- data/README.markdown +23 -10
- data/bin/image_optim +25 -15
- data/image_optim.gemspec +5 -2
- data/lib/image_optim.rb +47 -37
- data/lib/image_optim/bin_resolver.rb +17 -12
- data/lib/image_optim/bin_resolver/comparable_condition.rb +23 -7
- data/lib/image_optim/bin_resolver/simple_version.rb +2 -0
- data/lib/image_optim/config.rb +21 -13
- data/lib/image_optim/handler.rb +18 -12
- data/lib/image_optim/hash_helpers.rb +23 -13
- data/lib/image_optim/image_meta.rb +1 -0
- data/lib/image_optim/image_path.rb +14 -13
- data/lib/image_optim/option_definition.rb +11 -9
- data/lib/image_optim/option_helpers.rb +1 -2
- data/lib/image_optim/railtie.rb +18 -15
- data/lib/image_optim/runner.rb +67 -61
- data/lib/image_optim/space.rb +29 -0
- data/lib/image_optim/true_false_nil.rb +9 -1
- data/lib/image_optim/worker.rb +40 -16
- data/lib/image_optim/worker/advpng.rb +8 -1
- data/lib/image_optim/worker/gifsicle.rb +13 -1
- data/lib/image_optim/worker/jhead.rb +5 -0
- data/lib/image_optim/worker/jpegoptim.rb +17 -4
- data/lib/image_optim/worker/jpegtran.rb +9 -1
- data/lib/image_optim/worker/optipng.rb +13 -2
- data/lib/image_optim/worker/pngcrush.rb +14 -5
- data/lib/image_optim/worker/pngout.rb +10 -2
- data/lib/image_optim/worker/svgo.rb +1 -0
- data/script/update_worker_options_in_readme +42 -27
- data/spec/image_optim/bin_resolver/comparable_condition_spec.rb +13 -13
- data/spec/image_optim/bin_resolver/simple_version_spec.rb +4 -4
- data/spec/image_optim/bin_resolver_spec.rb +65 -37
- data/spec/image_optim/config_spec.rb +121 -110
- data/spec/image_optim/handler_spec.rb +29 -18
- data/spec/image_optim/hash_helpers_spec.rb +29 -27
- data/spec/image_optim/image_path_spec.rb +17 -17
- data/spec/image_optim/space_spec.rb +24 -0
- data/spec/image_optim/worker_spec.rb +18 -0
- data/spec/image_optim_spec.rb +134 -74
- metadata +27 -7
- data/script/update_instructions_in_readme +0 -44
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.
|
|
4
|
+
version: 0.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ivan Kuchin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-07-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fspath
|
|
@@ -84,16 +84,30 @@ dependencies:
|
|
|
84
84
|
name: rspec
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
|
-
- -
|
|
87
|
+
- - ~>
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
89
|
+
version: '3.0'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
|
-
- -
|
|
94
|
+
- - ~>
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3.0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rubocop
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ~>
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: 0.24.1
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ~>
|
|
95
109
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
110
|
+
version: 0.24.1
|
|
97
111
|
description:
|
|
98
112
|
email:
|
|
99
113
|
executables:
|
|
@@ -102,6 +116,7 @@ extensions: []
|
|
|
102
116
|
extra_rdoc_files: []
|
|
103
117
|
files:
|
|
104
118
|
- .gitignore
|
|
119
|
+
- .rubocop.yml
|
|
105
120
|
- .travis.yml
|
|
106
121
|
- Gemfile
|
|
107
122
|
- LICENSE.txt
|
|
@@ -122,6 +137,7 @@ files:
|
|
|
122
137
|
- lib/image_optim/option_helpers.rb
|
|
123
138
|
- lib/image_optim/railtie.rb
|
|
124
139
|
- lib/image_optim/runner.rb
|
|
140
|
+
- lib/image_optim/space.rb
|
|
125
141
|
- lib/image_optim/true_false_nil.rb
|
|
126
142
|
- lib/image_optim/worker.rb
|
|
127
143
|
- lib/image_optim/worker/advpng.rb
|
|
@@ -133,7 +149,6 @@ files:
|
|
|
133
149
|
- lib/image_optim/worker/pngcrush.rb
|
|
134
150
|
- lib/image_optim/worker/pngout.rb
|
|
135
151
|
- lib/image_optim/worker/svgo.rb
|
|
136
|
-
- script/update_instructions_in_readme
|
|
137
152
|
- script/update_worker_options_in_readme
|
|
138
153
|
- spec/image_optim/bin_resolver/comparable_condition_spec.rb
|
|
139
154
|
- spec/image_optim/bin_resolver/simple_version_spec.rb
|
|
@@ -142,6 +157,8 @@ files:
|
|
|
142
157
|
- spec/image_optim/handler_spec.rb
|
|
143
158
|
- spec/image_optim/hash_helpers_spec.rb
|
|
144
159
|
- spec/image_optim/image_path_spec.rb
|
|
160
|
+
- spec/image_optim/space_spec.rb
|
|
161
|
+
- spec/image_optim/worker_spec.rb
|
|
145
162
|
- spec/image_optim_spec.rb
|
|
146
163
|
- spec/images/comparison.png
|
|
147
164
|
- spec/images/decompressed.jpeg
|
|
@@ -197,6 +214,8 @@ test_files:
|
|
|
197
214
|
- spec/image_optim/handler_spec.rb
|
|
198
215
|
- spec/image_optim/hash_helpers_spec.rb
|
|
199
216
|
- spec/image_optim/image_path_spec.rb
|
|
217
|
+
- spec/image_optim/space_spec.rb
|
|
218
|
+
- spec/image_optim/worker_spec.rb
|
|
200
219
|
- spec/image_optim_spec.rb
|
|
201
220
|
- spec/images/comparison.png
|
|
202
221
|
- spec/images/decompressed.jpeg
|
|
@@ -218,3 +237,4 @@ test_files:
|
|
|
218
237
|
- spec/images/transparency1.png
|
|
219
238
|
- spec/images/transparency2.png
|
|
220
239
|
- spec/images/vergroessert.jpg
|
|
240
|
+
has_rdoc:
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: UTF-8
|
|
3
|
-
|
|
4
|
-
$:.unshift File.expand_path('../../lib', __FILE__)
|
|
5
|
-
|
|
6
|
-
require 'net/http'
|
|
7
|
-
require 'uri'
|
|
8
|
-
require 'image_optim/bin_resolver/simple_version'
|
|
9
|
-
|
|
10
|
-
README_FILE = File.expand_path('../../README.markdown', __FILE__)
|
|
11
|
-
|
|
12
|
-
def fetch_url(url)
|
|
13
|
-
res = Net::HTTP.get_response(URI(url))
|
|
14
|
-
raise "Got #{res.class}" unless res.is_a?(Net::HTTPSuccess)
|
|
15
|
-
res.body
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def v(s)
|
|
19
|
-
ImageOptim::BinResolver::SimpleVersion.new(s)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def update_instructions(text)
|
|
23
|
-
latest_versions = Hash.new do |h, project|
|
|
24
|
-
data = fetch_url("http://freecode.com/projects/#{project}/releases.atom")
|
|
25
|
-
versions = data.scan(%r{<title>[a-z]+ (\d+(?:\.\d+)+)</title>}).map{ |m| v(m[0]) }
|
|
26
|
-
h[project] = versions.max
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
updated = text.gsub(/([a-z]+)-(\d+(?:\.\d+)+)/) do |m|
|
|
30
|
-
project, current = $1, v($2)
|
|
31
|
-
latest = latest_versions[project]
|
|
32
|
-
"#{project}-#{[current, latest].max}"
|
|
33
|
-
end
|
|
34
|
-
updated unless text == updated
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
readme = File.read(README_FILE)
|
|
38
|
-
if readme = update_instructions(readme)
|
|
39
|
-
File.open(README_FILE, 'w') do |f|
|
|
40
|
-
f.write readme
|
|
41
|
-
end
|
|
42
|
-
else
|
|
43
|
-
abort "Did not update instructions"
|
|
44
|
-
end
|