image_optim 0.31.1 → 0.31.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/check.yml +5 -12
- data/.github/workflows/codeql.yml +30 -0
- data/.github/workflows/rubocop.yml +16 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.markdown +4 -0
- data/LICENSE.txt +1 -1
- data/README.markdown +23 -4
- data/image_optim.gemspec +3 -3
- data/lib/image_optim/bin_resolver.rb +3 -3
- data/lib/image_optim/config.rb +2 -2
- data/lib/image_optim/optimized_path.rb +2 -0
- data/lib/image_optim/runner/option_parser.rb +16 -16
- data/lib/image_optim/worker/advpng.rb +5 -5
- data/lib/image_optim/worker/gifsicle.rb +8 -8
- data/lib/image_optim/worker/jpegoptim.rb +8 -8
- data/lib/image_optim/worker/jpegrecompress.rb +4 -4
- data/lib/image_optim/worker/jpegtran.rb +1 -1
- data/lib/image_optim/worker/optipng.rb +5 -5
- data/lib/image_optim/worker/oxipng.rb +5 -5
- data/lib/image_optim/worker/pngcrush.rb +4 -4
- data/lib/image_optim/worker/pngout.rb +5 -5
- data/lib/image_optim/worker/pngquant.rb +6 -6
- data/lib/image_optim/worker.rb +3 -3
- data/script/update_worker_options_in_readme +2 -4
- data/script/worker_analysis +6 -10
- data/spec/image_optim/bin_resolver_spec.rb +7 -5
- data/spec/image_optim/cache_spec.rb +1 -1
- data/spec/image_optim/handler_spec.rb +1 -1
- data/spec/image_optim_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +14 -7
- data/Vagrantfile +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7197f37a1a5cd0a61248ccd4ef6b08f2c05ff8f084866da48f76b038bac4e4ec
|
4
|
+
data.tar.gz: 7be50ee48142fd8775022855624a7ea642436b11d8ca260f322742a7814d513a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02dbbb2520b6250fc2a5262c2c0524a42519e3a969683efe95b384f0e0cc5b4247638e74e5766ce016ccc462f3646f3ab7e7bf363299b1f6e79894b59af69df2
|
7
|
+
data.tar.gz: 6673410e57ba7e01f0f146678f2b74e8bbdcd97ccccb320679f24acb860ea46be229b2184383ee59e5a7bac6a4977f506e113a68bf53f975c1b296e9e28310d1
|
data/.github/workflows/check.yml
CHANGED
@@ -19,7 +19,10 @@ jobs:
|
|
19
19
|
- '2.6'
|
20
20
|
- '2.7'
|
21
21
|
- '3.0'
|
22
|
+
- '3.1'
|
22
23
|
- jruby-9.2
|
24
|
+
- jruby-9.3
|
25
|
+
- jruby-9.4
|
23
26
|
fail-fast: false
|
24
27
|
steps:
|
25
28
|
- uses: actions/checkout@v2
|
@@ -28,7 +31,6 @@ jobs:
|
|
28
31
|
ruby-version: "${{ matrix.ruby }}"
|
29
32
|
bundler-cache: true
|
30
33
|
- run: sudo npm install -g svgo
|
31
|
-
- run: curl -L "https://www.jonof.id.au/files/kenutils/pngout-20200115-linux.tar.gz" | sudo tar -xz -C /usr/local/bin --strip-components 2 --wildcards '*/amd64/pngout'
|
32
34
|
- run: curl -L "https://github.com/shssoichiro/oxipng/releases/download/v4.0.3/oxipng-4.0.3-x86_64-unknown-linux-musl.tar.gz" | tar -xz -C /usr/local/bin --strip-components 1 --wildcards '*oxipng'
|
33
35
|
- run: bundle exec image_optim --info
|
34
36
|
- run: bundle exec rspec
|
@@ -40,6 +42,7 @@ jobs:
|
|
40
42
|
- '2.6'
|
41
43
|
- '2.7'
|
42
44
|
- '3.0'
|
45
|
+
- '3.1'
|
43
46
|
fail-fast: false
|
44
47
|
steps:
|
45
48
|
- uses: actions/checkout@v2
|
@@ -70,20 +73,10 @@ jobs:
|
|
70
73
|
- uses: actions/checkout@v2
|
71
74
|
- uses: ruby/setup-ruby@v1
|
72
75
|
with:
|
73
|
-
ruby-version: '3.
|
76
|
+
ruby-version: '3.1'
|
74
77
|
bundler-cache: true
|
75
78
|
- run: sudo npm install -g svgo
|
76
|
-
- run: curl -L "https://www.jonof.id.au/files/kenutils/pngout-20200115-linux.tar.gz" | sudo tar -xz -C /usr/local/bin --strip-components 2 --wildcards '*/amd64/pngout'
|
77
79
|
- run: curl -L "https://github.com/shssoichiro/oxipng/releases/download/v4.0.3/oxipng-4.0.3-x86_64-unknown-linux-musl.tar.gz" | tar -xz -C /usr/local/bin --strip-components 1 --wildcards '*oxipng'
|
78
80
|
- uses: paambaati/codeclimate-action@v2.7.5
|
79
81
|
with:
|
80
82
|
coverageCommand: bundle exec rspec
|
81
|
-
rubocop:
|
82
|
-
runs-on: ubuntu-latest
|
83
|
-
steps:
|
84
|
-
- uses: actions/checkout@v2
|
85
|
-
- uses: ruby/setup-ruby@v1
|
86
|
-
with:
|
87
|
-
ruby-version: '3.0'
|
88
|
-
bundler-cache: true
|
89
|
-
- run: bundle exec rubocop
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: codeql
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
pull_request:
|
5
|
+
schedule:
|
6
|
+
- cron: '43 20 * * 0'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
analyze:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
actions: read
|
13
|
+
contents: read
|
14
|
+
security-events: write
|
15
|
+
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
language: [ 'ruby' ]
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
|
24
|
+
- uses: github/codeql-action/init@v1
|
25
|
+
with:
|
26
|
+
languages: ${{ matrix.language }}
|
27
|
+
|
28
|
+
- uses: github/codeql-action/autobuild@v1
|
29
|
+
|
30
|
+
- uses: github/codeql-action/analyze@v1
|
@@ -0,0 +1,16 @@
|
|
1
|
+
name: rubocop
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
pull_request:
|
5
|
+
schedule:
|
6
|
+
- cron: 45 4 * * 2
|
7
|
+
jobs:
|
8
|
+
rubocop:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
- uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: '3.1'
|
15
|
+
bundler-cache: true
|
16
|
+
- run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.markdown
CHANGED
data/LICENSE.txt
CHANGED
data/README.markdown
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
[![Gem Version](https://img.shields.io/gem/v/image_optim?logo=rubygems)](https://rubygems.org/gems/image_optim)
|
2
2
|
[![Build Status](https://img.shields.io/github/workflow/status/toy/image_optim/check/master?logo=github)](https://github.com/toy/image_optim/actions/workflows/check.yml)
|
3
|
+
[![Rubocop](https://img.shields.io/github/workflow/status/toy/image_optim/rubocop/master?label=rubocop&logo=rubocop)](https://github.com/toy/image_optim/actions/workflows/rubocop.yml)
|
4
|
+
[![CodeQL](https://img.shields.io/github/workflow/status/toy/image_optim/codeql/master?label=codeql&logo=github)](https://github.com/toy/image_optim/actions/workflows/codeql.yml)
|
3
5
|
[![Code Climate](https://img.shields.io/codeclimate/maintainability/toy/image_optim?logo=codeclimate)](https://codeclimate.com/github/toy/image_optim)
|
4
6
|
[![Code Climate Coverage](https://img.shields.io/codeclimate/coverage/toy/image_optim?logo=codeclimate)](https://codeclimate.com/github/toy/image_optim)
|
5
7
|
[![Depfu](https://img.shields.io/depfu/toy/image_optim)](https://depfu.com/github/toy/image_optim)
|
@@ -27,7 +29,7 @@ Based on [ImageOptim.app](http://imageoptim.com/).
|
|
27
29
|
|
28
30
|
Documentation for [latest gem version](http://rubydoc.info/gems/image_optim/frames) and [master branch](http://rubydoc.info/github/toy/image_optim/master/frames).
|
29
31
|
|
30
|
-
A test application with latest `image_optim` and `image_optim_pack` is available on
|
32
|
+
A test application with latest `image_optim` and `image_optim_pack` is available on render: https://iopack.onrender.com/.
|
31
33
|
|
32
34
|
## Gem installation
|
33
35
|
|
@@ -70,6 +72,18 @@ If you want to check latest changes:
|
|
70
72
|
gem 'image_optim', :git => 'git://github.com/toy/image_optim.git'
|
71
73
|
```
|
72
74
|
|
75
|
+
## Docker
|
76
|
+
|
77
|
+
This gem is also be available as [docker image](https://github.com/toy/image_optim_pack/pkgs/container/image_optim) containing most binaries:
|
78
|
+
|
79
|
+
```bash
|
80
|
+
docker run --rm ghcr.io/toy/image_optim --version # image_optim version
|
81
|
+
docker run --rm ghcr.io/toy/image_optim --info # image_optim info including bin versions
|
82
|
+
docker run --rm -v "$PWD":/here -w /here ghcr.io/toy/image_optim image-in-this-folder.jpg
|
83
|
+
```
|
84
|
+
|
85
|
+
See [image_optim_pack repository](https://github.com/toy/image_optim_pack) for [Dockerfile](https://github.com/toy/image_optim_pack/blob/master/Dockerfile) and [instructions](https://github.com/toy/image_optim_pack#docker).
|
86
|
+
|
73
87
|
## Binaries location
|
74
88
|
|
75
89
|
Simplest way for `image_optim` to locate binaries is to install them in common location present in `PATH` (see [Binaries installation](#binaries-installation)).
|
@@ -100,7 +114,7 @@ Besides permanently setting environment variables in `~/.profile`, `~/.bash_prof
|
|
100
114
|
|
101
115
|
### Binaries pack
|
102
116
|
|
103
|
-
Easiest way to get latest versions of most binaries for `image_optim` for Linux
|
117
|
+
Easiest way to get latest versions of most binaries for `image_optim` for Linux and Mac OS X is by installing [`image_optim_pack`](https://github.com/toy/image_optim_pack) gem.
|
104
118
|
|
105
119
|
Check installation instructions in [Gem installation](#gem-installation) section.
|
106
120
|
|
@@ -163,7 +177,7 @@ sudo port install advancecomp gifsicle jhead jpegoptim jpeg optipng pngcrush png
|
|
163
177
|
### OS X: Brew
|
164
178
|
|
165
179
|
```bash
|
166
|
-
brew install advancecomp gifsicle jhead jpegoptim jpeg optipng pngcrush pngquant jonof/kenutils/pngout
|
180
|
+
brew install advancecomp gifsicle jhead jpegoptim jpeg optipng oxipng pngcrush pngquant jonof/kenutils/pngout
|
167
181
|
```
|
168
182
|
|
169
183
|
### oxipng installation (optional)
|
@@ -337,6 +351,11 @@ Worker has no options
|
|
337
351
|
* `:interlace` — Interlace: `true` - interlace on, `false` - interlace off, `nil` - as is in original image *(defaults to `false`)*
|
338
352
|
* `:strip` — Remove all auxiliary chunks *(defaults to `true`)*
|
339
353
|
|
354
|
+
### oxipng:
|
355
|
+
* `:level` — Optimization level preset: `0` is least, `6` is best *(defaults to `3`)*
|
356
|
+
* `:interlace` — Interlace: `true` - interlace on, `false` - interlace off, `nil` - as is in original image *(defaults to `false`)*
|
357
|
+
* `:strip` — Remove all auxiliary chunks *(defaults to `true`)*
|
358
|
+
|
340
359
|
### pngcrush:
|
341
360
|
* `:chunks` — List of chunks to remove or `:alla` - all except tRNS/transparency or `:allb` - all except tRNS and gAMA/gamma *(defaults to `:alla`)*
|
342
361
|
* `:fix` — Fix otherwise fatal conditions such as bad CRCs *(defaults to `false`)*
|
@@ -371,4 +390,4 @@ In separate file [CHANGELOG.markdown](CHANGELOG.markdown).
|
|
371
390
|
|
372
391
|
## Copyright
|
373
392
|
|
374
|
-
Copyright (c) 2012-
|
393
|
+
Copyright (c) 2012-2022 Ivan Kuchin. See [LICENSE.txt](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.31.
|
5
|
+
s.version = '0.31.2'
|
6
6
|
s.summary = %q{Command line tool and ruby interface to optimize (lossless compress, optionally lossy) jpeg, png, gif and svg images using external utilities (advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegrescan, jpegtran, optipng, oxipng, pngcrush, pngout, pngquant, svgo)}
|
7
7
|
s.homepage = "https://github.com/toy/#{s.name}"
|
8
8
|
s.authors = ['Ivan Kuchin']
|
@@ -35,8 +35,8 @@ EOF
|
|
35
35
|
|
36
36
|
s.add_development_dependency 'image_optim_pack', '~> 0.2', '>= 0.2.2'
|
37
37
|
s.add_development_dependency 'rspec', '~> 3.0'
|
38
|
-
if RUBY_VERSION >= '2.
|
39
|
-
s.add_development_dependency 'rubocop', '~> 1.
|
38
|
+
if RUBY_VERSION >= '2.5' && !Gem.win_platform? && !defined?(JRUBY_VERSION)
|
39
|
+
s.add_development_dependency 'rubocop', '~> 1.22', '!= 1.22.2'
|
40
40
|
s.add_development_dependency 'rubocop-rspec', '~> 2.0'
|
41
41
|
end
|
42
42
|
end
|
@@ -61,7 +61,7 @@ class ImageOptim
|
|
61
61
|
[
|
62
62
|
dir,
|
63
63
|
pack_path,
|
64
|
-
ENV
|
64
|
+
ENV.fetch('PATH', nil),
|
65
65
|
VENDOR_PATH,
|
66
66
|
].compact.join(File::PATH_SEPARATOR)
|
67
67
|
end
|
@@ -109,12 +109,12 @@ class ImageOptim
|
|
109
109
|
# dir as name
|
110
110
|
def symlink_custom_bin!(name)
|
111
111
|
env_name = "#{name}_bin".upcase
|
112
|
-
path = ENV
|
112
|
+
path = ENV.fetch(env_name, nil)
|
113
113
|
return unless path
|
114
114
|
|
115
115
|
path = File.expand_path(path)
|
116
116
|
desc = "`#{path}` specified in #{env_name}"
|
117
|
-
fail "#{desc} doesn
|
117
|
+
fail "#{desc} doesn't exist" unless File.exist?(path)
|
118
118
|
fail "#{desc} is not a file" unless File.file?(path)
|
119
119
|
fail "#{desc} is not executable" unless File.executable?(path)
|
120
120
|
|
data/lib/image_optim/config.rb
CHANGED
@@ -15,7 +15,7 @@ class ImageOptim
|
|
15
15
|
|
16
16
|
# Global config path at `$XDG_CONFIG_HOME/image_optim.yml` (by default
|
17
17
|
# `~/.config/image_optim.yml`)
|
18
|
-
GLOBAL_PATH = File.join(ENV
|
18
|
+
GLOBAL_PATH = File.join(ENV.fetch('XDG_CONFIG_HOME', '~/.config'), 'image_optim.yml')
|
19
19
|
|
20
20
|
# Local config path at `./.image_optim.yml`
|
21
21
|
LOCAL_PATH = './.image_optim.yml'
|
@@ -185,7 +185,7 @@ class ImageOptim
|
|
185
185
|
when false
|
186
186
|
{disable: true}
|
187
187
|
else
|
188
|
-
fail ConfigurationError, "Got #{worker_options.inspect} for "\
|
188
|
+
fail ConfigurationError, "Got #{worker_options.inspect} for " \
|
189
189
|
"#{klass.name} options"
|
190
190
|
end
|
191
191
|
end
|
@@ -96,29 +96,29 @@ ImageOptim::Runner::OptionParser::DEFINE = proc do |op, options|
|
|
96
96
|
|
|
97
97
|
TEXT
|
98
98
|
|
99
|
-
op.on('--config-paths PATH1,PATH2', Array, 'Config paths to use instead of '\
|
99
|
+
op.on('--config-paths PATH1,PATH2', Array, 'Config paths to use instead of ' \
|
100
100
|
'default ones') do |paths|
|
101
101
|
options[:config_paths] = paths
|
102
102
|
end
|
103
103
|
|
104
104
|
op.separator nil
|
105
105
|
|
106
|
-
op.on('-r', '-R', '--recursive', 'Recursively scan directories '\
|
106
|
+
op.on('-r', '-R', '--recursive', 'Recursively scan directories ' \
|
107
107
|
'for images') do |recursive|
|
108
108
|
options[:recursive] = recursive
|
109
109
|
end
|
110
110
|
|
111
|
-
op.on("--exclude-dir 'GLOB'", 'Glob for excluding directories '\
|
111
|
+
op.on("--exclude-dir 'GLOB'", 'Glob for excluding directories ' \
|
112
112
|
'(defaults to .*)') do |glob|
|
113
113
|
options[:exclude_dir_glob] = glob
|
114
114
|
end
|
115
115
|
|
116
|
-
op.on("--exclude-file 'GLOB'", 'Glob for excluding files '\
|
116
|
+
op.on("--exclude-file 'GLOB'", 'Glob for excluding files ' \
|
117
117
|
'(defaults to .*)') do |glob|
|
118
118
|
options[:exclude_file_glob] = glob
|
119
119
|
end
|
120
120
|
|
121
|
-
op.on("--exclude 'GLOB'", 'Set glob for excluding both directories and '\
|
121
|
+
op.on("--exclude 'GLOB'", 'Set glob for excluding both directories and ' \
|
122
122
|
'files') do |glob|
|
123
123
|
options[:exclude_file_glob] = options[:exclude_dir_glob] = glob
|
124
124
|
end
|
@@ -129,19 +129,19 @@ ImageOptim::Runner::OptionParser::DEFINE = proc do |op, options|
|
|
129
129
|
options[:show_progress] = show_progress
|
130
130
|
end
|
131
131
|
|
132
|
-
op.on('--[no-]threads N', Integer, 'Number of threads or disable '\
|
132
|
+
op.on('--[no-]threads N', Integer, 'Number of threads or disable ' \
|
133
133
|
'(defaults to number of processors)') do |threads|
|
134
134
|
options[:threads] = threads
|
135
135
|
end
|
136
136
|
|
137
|
-
op.on('--[no-]nice N', Integer, 'Nice level, priority of all used tools '\
|
138
|
-
'with higher value meaning lower priority, in range -20..19, negative '\
|
137
|
+
op.on('--[no-]nice N', Integer, 'Nice level, priority of all used tools ' \
|
138
|
+
'with higher value meaning lower priority, in range -20..19, negative ' \
|
139
139
|
'values can be set only if run by root user (defaults to 10)') do |nice|
|
140
140
|
options[:nice] = nice
|
141
141
|
end
|
142
142
|
|
143
|
-
op.on('--[no-]pack', 'Require image_optim_pack or disable it, '\
|
144
|
-
'by default image_optim_pack will be used if available, '\
|
143
|
+
op.on('--[no-]pack', 'Require image_optim_pack or disable it, ' \
|
144
|
+
'by default image_optim_pack will be used if available, ' \
|
145
145
|
'will turn on skip-missing-workers unless explicitly disabled') do |pack|
|
146
146
|
options[:pack] = pack
|
147
147
|
end
|
@@ -149,12 +149,12 @@ ImageOptim::Runner::OptionParser::DEFINE = proc do |op, options|
|
|
149
149
|
op.separator nil
|
150
150
|
op.separator ' Caching:'
|
151
151
|
|
152
|
-
op.on('--cache-dir DIR', 'Cache optimized images '\
|
152
|
+
op.on('--cache-dir DIR', 'Cache optimized images ' \
|
153
153
|
'into the specified directory') do |cache_dir|
|
154
154
|
options[:cache_dir] = cache_dir
|
155
155
|
end
|
156
156
|
|
157
|
-
op.on('--cache-worker-digests', 'Cache worker digests '\
|
157
|
+
op.on('--cache-worker-digests', 'Cache worker digests ' \
|
158
158
|
'(updating workers invalidates cache)') do |cache_worker_digests|
|
159
159
|
options[:cache_worker_digests] = cache_worker_digests
|
160
160
|
end
|
@@ -162,7 +162,7 @@ ImageOptim::Runner::OptionParser::DEFINE = proc do |op, options|
|
|
162
162
|
op.separator nil
|
163
163
|
op.separator ' Disabling workers:'
|
164
164
|
|
165
|
-
op.on('--[no-]skip-missing-workers', 'Skip workers with missing or '\
|
165
|
+
op.on('--[no-]skip-missing-workers', 'Skip workers with missing or ' \
|
166
166
|
'problematic binaries') do |skip|
|
167
167
|
options[:skip_missing_workers] = skip
|
168
168
|
end
|
@@ -177,7 +177,7 @@ ImageOptim::Runner::OptionParser::DEFINE = proc do |op, options|
|
|
177
177
|
op.separator nil
|
178
178
|
op.separator ' Worker options:'
|
179
179
|
|
180
|
-
op.on('--allow-lossy', 'Allow lossy workers and '\
|
180
|
+
op.on('--allow-lossy', 'Allow lossy workers and ' \
|
181
181
|
'optimizations') do |allow_lossy|
|
182
182
|
options[:allow_lossy] = allow_lossy
|
183
183
|
end
|
@@ -229,8 +229,8 @@ ImageOptim::Runner::OptionParser::DEFINE = proc do |op, options|
|
|
229
229
|
op.separator nil
|
230
230
|
op.separator ' Common options:'
|
231
231
|
|
232
|
-
op.on_tail('-v', '--verbose', 'Verbose output (show global and worker '\
|
233
|
-
'config, binary resolution log, information about each tool invocation, '\
|
232
|
+
op.on_tail('-v', '--verbose', 'Verbose output (show global and worker ' \
|
233
|
+
'config, binary resolution log, information about each tool invocation, ' \
|
234
234
|
'backtrace of exception)') do
|
235
235
|
options[:verbose] = true
|
236
236
|
end
|
@@ -8,11 +8,11 @@ class ImageOptim
|
|
8
8
|
# http://advancemame.sourceforge.net/doc-advpng.html
|
9
9
|
class Advpng < Worker
|
10
10
|
LEVEL_OPTION =
|
11
|
-
option(:level, 4, 'Compression level: '\
|
12
|
-
'`0` - don\'t compress, '\
|
13
|
-
'`1` - fast, '\
|
14
|
-
'`2` - normal, '\
|
15
|
-
'`3` - extra, '\
|
11
|
+
option(:level, 4, 'Compression level: ' \
|
12
|
+
'`0` - don\'t compress, ' \
|
13
|
+
'`1` - fast, ' \
|
14
|
+
'`2` - normal, ' \
|
15
|
+
'`3` - extra, ' \
|
16
16
|
'`4` - extreme') do |v|
|
17
17
|
OptionHelpers.limit_with_range(v.to_i, 0..4)
|
18
18
|
end
|
@@ -17,19 +17,19 @@ class ImageOptim
|
|
17
17
|
end
|
18
18
|
|
19
19
|
INTERLACE_OPTION =
|
20
|
-
option(:interlace, false, TrueFalseNil, 'Interlace: '\
|
21
|
-
'`true` - interlace on, '\
|
22
|
-
'`false` - interlace off, '\
|
23
|
-
'`nil` - as is in original image '\
|
24
|
-
'(defaults to running two instances, one with interlace off and '\
|
20
|
+
option(:interlace, false, TrueFalseNil, 'Interlace: ' \
|
21
|
+
'`true` - interlace on, ' \
|
22
|
+
'`false` - interlace off, ' \
|
23
|
+
'`nil` - as is in original image ' \
|
24
|
+
'(defaults to running two instances, one with interlace off and ' \
|
25
25
|
'one with on)') do |v|
|
26
26
|
TrueFalseNil.convert(v)
|
27
27
|
end
|
28
28
|
|
29
29
|
LEVEL_OPTION =
|
30
|
-
option(:level, 3, 'Compression level: '\
|
31
|
-
'`1` - light and fast, '\
|
32
|
-
'`2` - normal, '\
|
30
|
+
option(:level, 3, 'Compression level: ' \
|
31
|
+
'`1` - light and fast, ' \
|
32
|
+
'`2` - normal, ' \
|
33
33
|
'`3` - heavy (slower)') do |v|
|
34
34
|
OptionHelpers.limit_with_range(v.to_i, 1..3)
|
35
35
|
end
|
@@ -11,13 +11,13 @@ class ImageOptim
|
|
11
11
|
option(:allow_lossy, false, 'Allow limiting maximum quality'){ |v| !!v }
|
12
12
|
|
13
13
|
STRIP_OPTION =
|
14
|
-
option(:strip, :all, Array, 'List of markers to strip: '\
|
15
|
-
'`:com`, '\
|
16
|
-
'`:exif`, '\
|
17
|
-
'`:iptc`, '\
|
18
|
-
'`:icc`, '\
|
19
|
-
'`:xmp`, '\
|
20
|
-
'`:none` or '\
|
14
|
+
option(:strip, :all, Array, 'List of markers to strip: ' \
|
15
|
+
'`:com`, ' \
|
16
|
+
'`:exif`, ' \
|
17
|
+
'`:iptc`, ' \
|
18
|
+
'`:icc`, ' \
|
19
|
+
'`:xmp`, ' \
|
20
|
+
'`:none` or ' \
|
21
21
|
'`:all`') do |v|
|
22
22
|
values = Array(v).map(&:to_s)
|
23
23
|
known_values = %w[com exif iptc icc xmp none all]
|
@@ -29,7 +29,7 @@ class ImageOptim
|
|
29
29
|
end
|
30
30
|
|
31
31
|
MAX_QUALITY_OPTION =
|
32
|
-
option(:max_quality, 100, 'Maximum image quality factor '\
|
32
|
+
option(:max_quality, 100, 'Maximum image quality factor ' \
|
33
33
|
'`0`..`100`, ignored in default/lossless mode') do |v, opt_def|
|
34
34
|
if allow_lossy
|
35
35
|
OptionHelpers.limit_with_range(v.to_i, 0..100)
|
@@ -27,10 +27,10 @@ class ImageOptim
|
|
27
27
|
end
|
28
28
|
|
29
29
|
METHOD_OPTION =
|
30
|
-
option(:method, 'ssim', 'Comparison Metric: '\
|
31
|
-
'`mpe` - Mean pixel error, '\
|
32
|
-
'`ssim` - Structural similarity, '\
|
33
|
-
'`ms-ssim` - Multi-scale structural similarity (slow!), '\
|
30
|
+
option(:method, 'ssim', 'Comparison Metric: ' \
|
31
|
+
'`mpe` - Mean pixel error, ' \
|
32
|
+
'`ssim` - Structural similarity, ' \
|
33
|
+
'`ms-ssim` - Multi-scale structural similarity (slow!), ' \
|
34
34
|
'`smallfry` - Linear-weighted BBCQ-like (may be patented)') do |v, opt_def|
|
35
35
|
if %w[mpe ssim ms-ssim smallfry].include? v
|
36
36
|
v
|
@@ -16,7 +16,7 @@ class ImageOptim
|
|
16
16
|
option(:progressive, true, 'Create progressive JPEG file'){ |v| !!v }
|
17
17
|
|
18
18
|
JPEGRESCAN_OPTION =
|
19
|
-
option(:jpegrescan, true, 'Use jpegtran through jpegrescan, '\
|
19
|
+
option(:jpegrescan, true, 'Use jpegtran through jpegrescan, ' \
|
20
20
|
'ignore progressive option'){ |v| !!v }
|
21
21
|
|
22
22
|
def used_bins
|
@@ -9,16 +9,16 @@ class ImageOptim
|
|
9
9
|
# http://optipng.sourceforge.net/
|
10
10
|
class Optipng < Worker
|
11
11
|
LEVEL_OPTION =
|
12
|
-
option(:level, 6, 'Optimization level preset: '\
|
13
|
-
'`0` is least, '\
|
12
|
+
option(:level, 6, 'Optimization level preset: ' \
|
13
|
+
'`0` is least, ' \
|
14
14
|
'`7` is best') do |v|
|
15
15
|
OptionHelpers.limit_with_range(v.to_i, 0..7)
|
16
16
|
end
|
17
17
|
|
18
18
|
INTERLACE_OPTION =
|
19
|
-
option(:interlace, false, TrueFalseNil, 'Interlace: '\
|
20
|
-
'`true` - interlace on, '\
|
21
|
-
'`false` - interlace off, '\
|
19
|
+
option(:interlace, false, TrueFalseNil, 'Interlace: ' \
|
20
|
+
'`true` - interlace on, ' \
|
21
|
+
'`false` - interlace off, ' \
|
22
22
|
'`nil` - as is in original image') do |v|
|
23
23
|
TrueFalseNil.convert(v)
|
24
24
|
end
|
@@ -9,16 +9,16 @@ class ImageOptim
|
|
9
9
|
# https://github.com/shssoichiro/oxipng
|
10
10
|
class Oxipng < Worker
|
11
11
|
LEVEL_OPTION =
|
12
|
-
option(:level, 3, 'Optimization level preset: '\
|
13
|
-
'`0` is least, '\
|
12
|
+
option(:level, 3, 'Optimization level preset: ' \
|
13
|
+
'`0` is least, ' \
|
14
14
|
'`6` is best') do |v|
|
15
15
|
OptionHelpers.limit_with_range(v.to_i, 0..6)
|
16
16
|
end
|
17
17
|
|
18
18
|
INTERLACE_OPTION =
|
19
|
-
option(:interlace, false, TrueFalseNil, 'Interlace: '\
|
20
|
-
'`true` - interlace on, '\
|
21
|
-
'`false` - interlace off, '\
|
19
|
+
option(:interlace, false, TrueFalseNil, 'Interlace: ' \
|
20
|
+
'`true` - interlace on, ' \
|
21
|
+
'`false` - interlace off, ' \
|
22
22
|
'`nil` - as is in original image') do |v|
|
23
23
|
TrueFalseNil.convert(v)
|
24
24
|
end
|
@@ -7,18 +7,18 @@ class ImageOptim
|
|
7
7
|
# http://pmt.sourceforge.net/pngcrush/
|
8
8
|
class Pngcrush < Worker
|
9
9
|
CHUNKS_OPTION =
|
10
|
-
option(:chunks, :alla, Array, 'List of chunks to remove or '\
|
11
|
-
'`:alla` - all except tRNS/transparency or '\
|
10
|
+
option(:chunks, :alla, Array, 'List of chunks to remove or ' \
|
11
|
+
'`:alla` - all except tRNS/transparency or ' \
|
12
12
|
'`:allb` - all except tRNS and gAMA/gamma') do |v|
|
13
13
|
Array(v).map(&:to_s)
|
14
14
|
end
|
15
15
|
|
16
16
|
FIX_OPTION =
|
17
|
-
option(:fix, false, 'Fix otherwise fatal conditions '\
|
17
|
+
option(:fix, false, 'Fix otherwise fatal conditions ' \
|
18
18
|
'such as bad CRCs'){ |v| !!v }
|
19
19
|
|
20
20
|
BRUTE_OPTION =
|
21
|
-
option(:brute, false, 'Brute force try all methods, '\
|
21
|
+
option(:brute, false, 'Brute force try all methods, ' \
|
22
22
|
'very time-consuming and generally not worthwhile'){ |v| !!v }
|
23
23
|
|
24
24
|
BLACKEN_OPTION =
|
@@ -11,11 +11,11 @@ class ImageOptim
|
|
11
11
|
option(:copy_chunks, false, 'Copy optional chunks'){ |v| !!v }
|
12
12
|
|
13
13
|
STRATEGY_OPTION =
|
14
|
-
option(:strategy, 0, 'Strategy: '\
|
15
|
-
'`0` - xtreme, '\
|
16
|
-
'`1` - intense, '\
|
17
|
-
'`2` - longest Match, '\
|
18
|
-
'`3` - huffman Only, '\
|
14
|
+
option(:strategy, 0, 'Strategy: ' \
|
15
|
+
'`0` - xtreme, ' \
|
16
|
+
'`1` - intense, ' \
|
17
|
+
'`2` - longest Match, ' \
|
18
|
+
'`3` - huffman Only, ' \
|
19
19
|
'`4` - uncompressed') do |v|
|
20
20
|
OptionHelpers.limit_with_range(v.to_i, 0..4)
|
21
21
|
end
|
@@ -18,9 +18,9 @@ class ImageOptim
|
|
18
18
|
|
19
19
|
QUALITY_OPTION =
|
20
20
|
option(:quality, '`100..100`, `0..100` in lossy mode',
|
21
|
-
NonNegativeIntegerRange, 'min..max - don\'t '\
|
22
|
-
'save below min, use less colors below max (both in range `0..100`; '\
|
23
|
-
'in yaml - `!ruby/range 0..100`), ignored in default/lossless '\
|
21
|
+
NonNegativeIntegerRange, 'min..max - don\'t ' \
|
22
|
+
'save below min, use less colors below max (both in range `0..100`; ' \
|
23
|
+
'in yaml - `!ruby/range 0..100`), ignored in default/lossless ' \
|
24
24
|
'mode') do |v, opt_def|
|
25
25
|
if allow_lossy
|
26
26
|
if v == opt_def.default
|
@@ -39,9 +39,9 @@ class ImageOptim
|
|
39
39
|
end
|
40
40
|
|
41
41
|
SPEED_OPTION =
|
42
|
-
option(:speed, 3, 'speed/quality trade-off: '\
|
43
|
-
'`1` - slow, '\
|
44
|
-
'`3` - default, '\
|
42
|
+
option(:speed, 3, 'speed/quality trade-off: ' \
|
43
|
+
'`1` - slow, ' \
|
44
|
+
'`3` - default, ' \
|
45
45
|
'`11` - fast & rough') do |v|
|
46
46
|
OptionHelpers.limit_with_range(v.to_i, 1..11)
|
47
47
|
end
|
data/lib/image_optim/worker.rb
CHANGED
@@ -104,7 +104,7 @@ class ImageOptim
|
|
104
104
|
unknown_options = options.reject{ |key, _value| known_keys.include?(key) }
|
105
105
|
return if unknown_options.empty?
|
106
106
|
|
107
|
-
fail ConfigurationError, "unknown options #{unknown_options.inspect} "\
|
107
|
+
fail ConfigurationError, "unknown options #{unknown_options.inspect} " \
|
108
108
|
"for #{self}"
|
109
109
|
end
|
110
110
|
|
@@ -117,8 +117,8 @@ class ImageOptim
|
|
117
117
|
|
118
118
|
def wrap_resolver_error_message(message)
|
119
119
|
name = self.class.bin_sym
|
120
|
-
"#{name} worker: #{message}; please provide proper binary or "\
|
121
|
-
"disable this worker (--no-#{name} argument or "\
|
120
|
+
"#{name} worker: #{message}; please provide proper binary or " \
|
121
|
+
"disable this worker (--no-#{name} argument or " \
|
122
122
|
"`:#{name} => false` through options)"
|
123
123
|
end
|
124
124
|
|
@@ -28,7 +28,7 @@ end
|
|
28
28
|
|
29
29
|
def write_marked(io)
|
30
30
|
io.puts BEGIN_MARKER
|
31
|
-
io.puts '<!-- markdown for worker options is generated by '\
|
31
|
+
io.puts '<!-- markdown for worker options is generated by ' \
|
32
32
|
"`#{Pathname($PROGRAM_NAME).cleanpath}` -->"
|
33
33
|
io.puts
|
34
34
|
|
@@ -52,9 +52,7 @@ end
|
|
52
52
|
|
53
53
|
readme = File.read(README_FILE)
|
54
54
|
if (readme = update_readme(readme))
|
55
|
-
File.
|
56
|
-
f.write readme
|
57
|
-
end
|
55
|
+
File.write(README_FILE, readme)
|
58
56
|
else
|
59
57
|
abort 'Did not update worker options'
|
60
58
|
end
|
data/script/worker_analysis
CHANGED
@@ -11,7 +11,6 @@ require 'shellwords'
|
|
11
11
|
require 'gdbm'
|
12
12
|
require 'digest'
|
13
13
|
require 'erb'
|
14
|
-
require 'ostruct'
|
15
14
|
|
16
15
|
DIR = 'tmp'
|
17
16
|
Pathname(DIR).mkpath
|
@@ -172,7 +171,7 @@ class Analyser
|
|
172
171
|
|
173
172
|
def source_digest
|
174
173
|
@source_digest ||= begin
|
175
|
-
source_path = __getobj__.
|
174
|
+
source_path = __getobj__.class.instance_method(:optimize).source_location[0]
|
176
175
|
Digest::SHA256.file(source_path).hexdigest
|
177
176
|
end
|
178
177
|
end
|
@@ -515,7 +514,7 @@ class Analyser
|
|
515
514
|
def analyse(paths)
|
516
515
|
results = collect_results(paths)
|
517
516
|
|
518
|
-
template = ERB.new(template_path.read,
|
517
|
+
template = ERB.new(template_path.read, trim_mode: '>')
|
519
518
|
by_format = results.group_by(&:format)
|
520
519
|
formats = by_format.keys.sort
|
521
520
|
basenames = Hash[formats.map do |format|
|
@@ -524,13 +523,10 @@ class Analyser
|
|
524
523
|
formats.each do |format|
|
525
524
|
stats = Stats.new('all', by_format[format], worker_ids2names)
|
526
525
|
path = FSPath("#{DIR}/#{basenames[format]}")
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
template_dir: template_path.dirname.relative_path_from(path.dirname),
|
532
|
-
}
|
533
|
-
html = template.result(OpenStruct.new(model).instance_eval{ binding })
|
526
|
+
stats_format = format
|
527
|
+
format_links = basenames
|
528
|
+
template_dir = template_path.dirname.relative_path_from(path.dirname)
|
529
|
+
html = template.result(binding)
|
534
530
|
path.write(html)
|
535
531
|
puts "Created #{path}"
|
536
532
|
end
|
@@ -8,6 +8,7 @@ require 'image_optim/path'
|
|
8
8
|
describe ImageOptim::BinResolver do
|
9
9
|
def stub_env(key, value)
|
10
10
|
allow(ENV).to receive(:[]).with(key).and_return(value)
|
11
|
+
allow(ENV).to receive(:fetch).with(key, nil).and_return(value)
|
11
12
|
end
|
12
13
|
|
13
14
|
before do
|
@@ -17,6 +18,7 @@ describe ImageOptim::BinResolver do
|
|
17
18
|
stub_const('Cmd', ImageOptim::Cmd)
|
18
19
|
|
19
20
|
allow(ENV).to receive(:[]).and_call_original
|
21
|
+
allow(ENV).to receive(:fetch).and_call_original
|
20
22
|
end
|
21
23
|
|
22
24
|
let(:image_optim){ double(:image_optim, verbose: false, pack: false) }
|
@@ -87,7 +89,7 @@ describe ImageOptim::BinResolver do
|
|
87
89
|
expect(resolver.env_path).to eq([
|
88
90
|
'temp_dir',
|
89
91
|
'pack_path',
|
90
|
-
ENV
|
92
|
+
ENV.fetch('PATH', nil),
|
91
93
|
BinResolver::VENDOR_PATH,
|
92
94
|
].join(File::PATH_SEPARATOR))
|
93
95
|
end
|
@@ -105,7 +107,7 @@ describe ImageOptim::BinResolver do
|
|
105
107
|
expect(resolver.resolve!(:ls)).to eq(bin)
|
106
108
|
end
|
107
109
|
expect(resolver.env_path).to eq([
|
108
|
-
ENV
|
110
|
+
ENV.fetch('PATH', nil),
|
109
111
|
BinResolver::VENDOR_PATH,
|
110
112
|
].join(File::PATH_SEPARATOR))
|
111
113
|
end
|
@@ -122,7 +124,7 @@ describe ImageOptim::BinResolver do
|
|
122
124
|
end.to raise_error BinResolver::BinNotFound
|
123
125
|
end
|
124
126
|
expect(resolver.env_path).to eq([
|
125
|
-
ENV
|
127
|
+
ENV.fetch('PATH', nil),
|
126
128
|
BinResolver::VENDOR_PATH,
|
127
129
|
].join(File::PATH_SEPARATOR))
|
128
130
|
end
|
@@ -162,7 +164,7 @@ describe ImageOptim::BinResolver do
|
|
162
164
|
end
|
163
165
|
expect(resolver.env_path).to eq([
|
164
166
|
tmpdir,
|
165
|
-
ENV
|
167
|
+
ENV.fetch('PATH', nil),
|
166
168
|
BinResolver::VENDOR_PATH,
|
167
169
|
].join(File::PATH_SEPARATOR))
|
168
170
|
|
@@ -187,7 +189,7 @@ describe ImageOptim::BinResolver do
|
|
187
189
|
|
188
190
|
after do
|
189
191
|
expect(resolver.env_path).to eq([
|
190
|
-
ENV
|
192
|
+
ENV.fetch('PATH', nil),
|
191
193
|
BinResolver::VENDOR_PATH,
|
192
194
|
].join(File::PATH_SEPARATOR))
|
193
195
|
end
|
@@ -15,7 +15,7 @@ describe ImageOptim::Cache do
|
|
15
15
|
|
16
16
|
let(:cache_dir) do
|
17
17
|
dir = '/somewhere/cache'
|
18
|
-
allow(FileUtils).to receive(:mkpath).with(Regexp.new(Regexp.escape(dir)))
|
18
|
+
allow(FileUtils).to receive(:mkpath).with(Regexp.new(Regexp.escape(dir)), any_args)
|
19
19
|
allow(FileUtils).to receive(:touch)
|
20
20
|
allow(FSPath).to receive(:temp_file_path) do
|
21
21
|
tmp_file
|
@@ -8,7 +8,7 @@ describe ImageOptim::Handler do
|
|
8
8
|
stub_const('Handler', ImageOptim::Handler)
|
9
9
|
end
|
10
10
|
|
11
|
-
it 'uses original as source for first conversion '\
|
11
|
+
it 'uses original as source for first conversion ' \
|
12
12
|
'and two temp files for further conversions' do
|
13
13
|
original = double(:original)
|
14
14
|
allow(original).to receive(:respond_to?).with(:temp_path).and_return(true)
|
data/spec/image_optim_spec.rb
CHANGED
@@ -252,7 +252,7 @@ describe ImageOptim do
|
|
252
252
|
end
|
253
253
|
|
254
254
|
describe 'given block' do
|
255
|
-
it 'optimizes images, yields path and result for each and '\
|
255
|
+
it 'optimizes images, yields path and result for each and ' \
|
256
256
|
'returns array of yield results' do
|
257
257
|
image_optim = ImageOptim.new
|
258
258
|
results = test_images.map do |src|
|
data/spec/spec_helper.rb
CHANGED
@@ -10,7 +10,7 @@ require 'image_optim/path'
|
|
10
10
|
|
11
11
|
ENV['PATH'] = [
|
12
12
|
ImageOptim::Pack.path,
|
13
|
-
ENV
|
13
|
+
ENV.fetch('PATH', nil),
|
14
14
|
].compact.join File::PATH_SEPARATOR
|
15
15
|
|
16
16
|
RSpec.configure do |c|
|
@@ -72,7 +72,7 @@ RSpec::Matchers.define :be_similar_to do |expected, max_difference|
|
|
72
72
|
@diff <= max_difference
|
73
73
|
end
|
74
74
|
failure_message do |actual|
|
75
|
-
"expected #{actual} to have at most #{max_difference} difference from "\
|
75
|
+
"expected #{actual} to have at most #{max_difference} difference from " \
|
76
76
|
"#{expected}, got mean error per pixel of #{@diff}"
|
77
77
|
end
|
78
78
|
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.31.
|
4
|
+
version: 0.31.2
|
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: 2022-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fspath
|
@@ -138,14 +138,20 @@ dependencies:
|
|
138
138
|
requirements:
|
139
139
|
- - "~>"
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version: '1.
|
141
|
+
version: '1.22'
|
142
|
+
- - "!="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: 1.22.2
|
142
145
|
type: :development
|
143
146
|
prerelease: false
|
144
147
|
version_requirements: !ruby/object:Gem::Requirement
|
145
148
|
requirements:
|
146
149
|
- - "~>"
|
147
150
|
- !ruby/object:Gem::Version
|
148
|
-
version: '1.
|
151
|
+
version: '1.22'
|
152
|
+
- - "!="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 1.22.2
|
149
155
|
- !ruby/object:Gem::Dependency
|
150
156
|
name: rubocop-rspec
|
151
157
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,6 +174,8 @@ extensions: []
|
|
168
174
|
extra_rdoc_files: []
|
169
175
|
files:
|
170
176
|
- ".github/workflows/check.yml"
|
177
|
+
- ".github/workflows/codeql.yml"
|
178
|
+
- ".github/workflows/rubocop.yml"
|
171
179
|
- ".gitignore"
|
172
180
|
- ".pre-commit-hooks.yaml"
|
173
181
|
- ".rubocop.yml"
|
@@ -176,7 +184,6 @@ files:
|
|
176
184
|
- Gemfile
|
177
185
|
- LICENSE.txt
|
178
186
|
- README.markdown
|
179
|
-
- Vagrantfile
|
180
187
|
- bin/image_optim
|
181
188
|
- image_optim.gemspec
|
182
189
|
- lib/image_optim.rb
|
@@ -285,7 +292,7 @@ licenses:
|
|
285
292
|
metadata:
|
286
293
|
bug_tracker_uri: https://github.com/toy/image_optim/issues
|
287
294
|
changelog_uri: https://github.com/toy/image_optim/blob/master/CHANGELOG.markdown
|
288
|
-
documentation_uri: https://www.rubydoc.info/gems/image_optim/0.31.
|
295
|
+
documentation_uri: https://www.rubydoc.info/gems/image_optim/0.31.2
|
289
296
|
source_code_uri: https://github.com/toy/image_optim
|
290
297
|
post_install_message: |
|
291
298
|
Rails image assets optimization is extracted into image_optim_rails gem
|
@@ -304,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
304
311
|
- !ruby/object:Gem::Version
|
305
312
|
version: '0'
|
306
313
|
requirements: []
|
307
|
-
rubygems_version: 3.
|
314
|
+
rubygems_version: 3.3.26
|
308
315
|
signing_key:
|
309
316
|
specification_version: 4
|
310
317
|
summary: Command line tool and ruby interface to optimize (lossless compress, optionally
|
data/Vagrantfile
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Vagrant.configure('2') do |config|
|
4
|
-
config.vm.box = 'ubuntu/precise64'
|
5
|
-
|
6
|
-
config.vm.provision 'shell', inline: <<-SH
|
7
|
-
set -e
|
8
|
-
|
9
|
-
cd /vagrant
|
10
|
-
|
11
|
-
echo 'apt-get update...'
|
12
|
-
apt-get update > /dev/null
|
13
|
-
|
14
|
-
echo 'Install git, imagemagick, ruby1.9.1-dev...'
|
15
|
-
apt-get install -y git npm imagemagick ruby1.9.1-dev > /dev/null
|
16
|
-
|
17
|
-
echo 'Install node, npm...'
|
18
|
-
curl -sL https://deb.nodesource.com/setup | sudo bash - > /dev/null
|
19
|
-
sudo apt-get install -y nodejs > /dev/null
|
20
|
-
|
21
|
-
echo 'Update rubygems...'
|
22
|
-
REALLY_GEM_UPDATE_SYSTEM=x gem update --system > /dev/null
|
23
|
-
|
24
|
-
echo 'Install bundler...'
|
25
|
-
gem install bundler > /dev/null
|
26
|
-
|
27
|
-
echo 'Install svgo...'
|
28
|
-
npm install -g -q svgo > /dev/null
|
29
|
-
|
30
|
-
echo 'Install pngout...'
|
31
|
-
curl -s \
|
32
|
-
'http://static.jonof.id.au/dl/kenutils/pngout-20130221-linux.tar.gz' | \
|
33
|
-
tar -xz -C /usr/local/bin --strip-components 2 \
|
34
|
-
--wildcards '*/x86_64/pngout'
|
35
|
-
|
36
|
-
echo 'Bundle...'
|
37
|
-
bundle install --jobs=3 --quiet
|
38
|
-
bundle list
|
39
|
-
SH
|
40
|
-
end
|