image_optim 0.31.0 → 0.31.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e80e82d67e3434476f0bdf332b14b6369601010aaeef7ab7b901515d0c03565c
4
- data.tar.gz: 16f304385c879cf1afc0073d7d037fb548d6c260f57e2b94cdcdd974f3cd4b4e
3
+ metadata.gz: 7197f37a1a5cd0a61248ccd4ef6b08f2c05ff8f084866da48f76b038bac4e4ec
4
+ data.tar.gz: 7be50ee48142fd8775022855624a7ea642436b11d8ca260f322742a7814d513a
5
5
  SHA512:
6
- metadata.gz: b0395980a804453e3273f779c1217d5dd5b9b7c522e74964070b43f2b3ac433f9f39d5f997a3e9c6594f22d244752910eea1697ac2e570de34e6b0641555b9e8
7
- data.tar.gz: 9de0bebe89071d3aa7bd506b02dc684b53d998dcfccab1debad72bdc244e6fbae6eb0ac2d5871359fe2ffa5cb9e7c5ae8a7dc98829e00e8abef49c017ac3b00c
6
+ metadata.gz: 02dbbb2520b6250fc2a5262c2c0524a42519e3a969683efe95b384f0e0cc5b4247638e74e5766ce016ccc462f3646f3ab7e7bf363299b1f6e79894b59af69df2
7
+ data.tar.gz: 6673410e57ba7e01f0f146678f2b74e8bbdcd97ccccb320679f24acb860ea46be229b2184383ee59e5a7bac6a4977f506e113a68bf53f975c1b296e9e28310d1
@@ -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,10 +31,40 @@ 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
37
+ windows:
38
+ runs-on: windows-latest
39
+ strategy:
40
+ matrix:
41
+ ruby:
42
+ - '2.6'
43
+ - '2.7'
44
+ - '3.0'
45
+ - '3.1'
46
+ fail-fast: false
47
+ steps:
48
+ - uses: actions/checkout@v2
49
+ - uses: ruby/setup-ruby@v1
50
+ with:
51
+ ruby-version: "${{ matrix.ruby }}"
52
+ bundler-cache: true
53
+ - uses: actions/cache@v2
54
+ with:
55
+ path: "$HOME/bin"
56
+ key: ${{ runner.os }}
57
+ - run: |
58
+ mkdir "$HOME/bin"
59
+ git fetch origin windows-binaries
60
+ git --work-tree="$HOME/bin" checkout origin/windows-binaries -- '*.exe'
61
+ echo "$HOME/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
62
+ - run: |
63
+ choco install --no-progress imagemagick
64
+ ls C:\'Program Files'\ImageMagick* | % FullName | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
65
+ - run: npm install -g svgo
66
+ - run: bundle exec image_optim --info
67
+ - run: bundle exec rspec
35
68
  coverage:
36
69
  runs-on: ubuntu-latest
37
70
  env:
@@ -40,20 +73,10 @@ jobs:
40
73
  - uses: actions/checkout@v2
41
74
  - uses: ruby/setup-ruby@v1
42
75
  with:
43
- ruby-version: '3.0'
76
+ ruby-version: '3.1'
44
77
  bundler-cache: true
45
78
  - run: sudo npm install -g svgo
46
- - 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'
47
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'
48
80
  - uses: paambaati/codeclimate-action@v2.7.5
49
81
  with:
50
82
  coverageCommand: bundle exec rspec
51
- rubocop:
52
- runs-on: ubuntu-latest
53
- steps:
54
- - uses: actions/checkout@v2
55
- - uses: ruby/setup-ruby@v1
56
- with:
57
- ruby-version: '3.0'
58
- bundler-cache: true
59
- - 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
@@ -142,6 +142,9 @@ Style/Semicolon:
142
142
  Style/SignalException:
143
143
  EnforcedStyle: semantic
144
144
 
145
+ Style/SlicingWithRange:
146
+ Enabled: false
147
+
145
148
  Style/SymbolArray:
146
149
  Enabled: false
147
150
 
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## v0.31.2 (2022-11-27)
6
+
7
+ * Support jruby 9.4 [@toy](https://github.com/toy)
8
+
9
+ ## v0.31.1 (2021-10-21)
10
+
11
+ * Allow image_size 3 [@toy](https://github.com/toy)
12
+
5
13
  ## v0.31.0 (2021-10-03)
6
14
 
7
15
  * Add support for Oxipng [#167](https://github.com/toy/image_optim/issues/167) [#190](https://github.com/toy/image_optim/pull/190) [@oblakeerickson](https://github.com/oblakeerickson)
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2021 Ivan Kuchin
1
+ Copyright (c) 2012-2022 Ivan Kuchin
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.markdown CHANGED
@@ -1,6 +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
- [![AppVeyor Status](https://img.shields.io/appveyor/build/toy/image-optim/master?label=windows&logo=appveyor)](https://ci.appveyor.com/project/toy/image-optim)
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)
4
5
  [![Code Climate](https://img.shields.io/codeclimate/maintainability/toy/image_optim?logo=codeclimate)](https://codeclimate.com/github/toy/image_optim)
5
6
  [![Code Climate Coverage](https://img.shields.io/codeclimate/coverage/toy/image_optim?logo=codeclimate)](https://codeclimate.com/github/toy/image_optim)
6
7
  [![Depfu](https://img.shields.io/depfu/toy/image_optim)](https://depfu.com/github/toy/image_optim)
@@ -28,7 +29,7 @@ Based on [ImageOptim.app](http://imageoptim.com/).
28
29
 
29
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).
30
31
 
31
- A test application with latest `image_optim` and `image_optim_pack` is available on heroku: https://iopack.herokuapp.com/.
32
+ A test application with latest `image_optim` and `image_optim_pack` is available on render: https://iopack.onrender.com/.
32
33
 
33
34
  ## Gem installation
34
35
 
@@ -71,6 +72,18 @@ If you want to check latest changes:
71
72
  gem 'image_optim', :git => 'git://github.com/toy/image_optim.git'
72
73
  ```
73
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
+
74
87
  ## Binaries location
75
88
 
76
89
  Simplest way for `image_optim` to locate binaries is to install them in common location present in `PATH` (see [Binaries installation](#binaries-installation)).
@@ -101,7 +114,7 @@ Besides permanently setting environment variables in `~/.profile`, `~/.bash_prof
101
114
 
102
115
  ### Binaries pack
103
116
 
104
- Easiest way to get latest versions of most binaries for `image_optim` for Linux, Mac OS X, FreeBSD and OpenBSD is by installing [`image_optim_pack`](https://github.com/toy/image_optim_pack) gem.
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.
105
118
 
106
119
  Check installation instructions in [Gem installation](#gem-installation) section.
107
120
 
@@ -164,7 +177,7 @@ sudo port install advancecomp gifsicle jhead jpegoptim jpeg optipng pngcrush png
164
177
  ### OS X: Brew
165
178
 
166
179
  ```bash
167
- 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
168
181
  ```
169
182
 
170
183
  ### oxipng installation (optional)
@@ -338,6 +351,11 @@ Worker has no options
338
351
  * `:interlace` — Interlace: `true` - interlace on, `false` - interlace off, `nil` - as is in original image *(defaults to `false`)*
339
352
  * `:strip` — Remove all auxiliary chunks *(defaults to `true`)*
340
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
+
341
359
  ### pngcrush:
342
360
  * `:chunks` — List of chunks to remove or `:alla` - all except tRNS/transparency or `:allb` - all except tRNS and gAMA/gamma *(defaults to `:alla`)*
343
361
  * `:fix` — Fix otherwise fatal conditions such as bad CRCs *(defaults to `false`)*
@@ -372,4 +390,4 @@ In separate file [CHANGELOG.markdown](CHANGELOG.markdown).
372
390
 
373
391
  ## Copyright
374
392
 
375
- Copyright (c) 2012-2021 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.
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.0'
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']
@@ -28,15 +28,15 @@ You can safely remove `config.assets.image_optim = false` if you are not going t
28
28
  EOF
29
29
 
30
30
  s.add_dependency 'fspath', '~> 3.0'
31
- s.add_dependency 'image_size', '>= 1.5', '< 3'
31
+ s.add_dependency 'image_size', '>= 1.5', '< 4'
32
32
  s.add_dependency 'exifr', '~> 1.2', '>= 1.2.2'
33
33
  s.add_dependency 'progress', '~> 3.0', '>= 3.0.1'
34
34
  s.add_dependency 'in_threads', '~> 1.3'
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.4' && !Gem.win_platform? && !defined?(JRUBY_VERSION)
39
- s.add_development_dependency 'rubocop', '~> 1.0'
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['PATH'],
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[env_name]
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\'t exist" unless File.exist?(path)
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
 
@@ -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['XDG_CONFIG_HOME'] || '~/.config', 'image_optim.yml')
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
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'image_optim/path'
4
4
 
5
+ require 'delegate'
6
+
5
7
  class ImageOptim
6
8
  # Holds optimized image with reference to original and its size
7
9
  class OptimizedPath < DelegateClass(Path)
@@ -84,7 +84,7 @@ ImageOptim::Runner::OptionParser::DEFINE = proc do |op, options|
84
84
  ImageOptim::TrueFalseNil.add_to_option_parser(op)
85
85
  ImageOptim::NonNegativeIntegerRange.add_to_option_parser(op)
86
86
 
87
- op.banner = <<-TEXT.gsub(/^\s*\|/, '') # rubocop:disable Layout/DotPosition
87
+ op.banner = <<-TEXT.gsub(/^\s*\|/, '')
88
88
  |#{ImageOptim.full_version}
89
89
  |
90
90
  |Usage:
@@ -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
@@ -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.open(README_FILE, 'w') do |f|
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
@@ -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__.method(:optimize).source_location[0]
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, nil, '>')
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
- model = {
528
- stats_format: format,
529
- stats: stats,
530
- format_links: basenames,
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['PATH'],
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['PATH'],
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['PATH'],
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['PATH'],
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['PATH'],
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)
@@ -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['PATH'],
13
+ ENV.fetch('PATH', nil),
14
14
  ].compact.join File::PATH_SEPARATOR
15
15
 
16
16
  RSpec.configure do |c|
@@ -23,16 +23,18 @@ RSpec.configure do |c|
23
23
  c.order = :random
24
24
  end
25
25
 
26
+ IMAGEMAGICK_PREFIX = ImageOptim::Cmd.capture('which magick').empty? ? [] : %w[magick]
27
+
26
28
  def flatten_animation(image)
27
29
  if image.image_format == :gif
28
30
  flattened = image.temp_path
29
- command = %W[
31
+ command = (IMAGEMAGICK_PREFIX + %W[
30
32
  convert
31
33
  #{image}
32
34
  -coalesce
33
35
  -append
34
36
  #{flattened}
35
- ].shelljoin
37
+ ]).shelljoin
36
38
  expect(ImageOptim::Cmd.run(command)).to be_truthy
37
39
  flattened
38
40
  else
@@ -43,7 +45,7 @@ end
43
45
  def mepp(image_a, image_b)
44
46
  coalesce_a = flatten_animation(image_a)
45
47
  coalesce_b = flatten_animation(image_b)
46
- output = ImageOptim::Cmd.capture(%W[
48
+ output = ImageOptim::Cmd.capture((IMAGEMAGICK_PREFIX + %W[
47
49
  compare
48
50
  -metric MEPP
49
51
  -alpha Background
@@ -51,7 +53,7 @@ def mepp(image_a, image_b)
51
53
  #{coalesce_b.to_s.shellescape}
52
54
  #{ImageOptim::Path::NULL}
53
55
  2>&1
54
- ].join(' '))
56
+ ]).join(' '))
55
57
  unless [0, 1].include?($CHILD_STATUS.exitstatus)
56
58
  fail "compare #{image_a} with #{image_b} failed with `#{output}`"
57
59
  end
@@ -70,8 +72,8 @@ RSpec::Matchers.define :be_similar_to do |expected, max_difference|
70
72
  @diff <= max_difference
71
73
  end
72
74
  failure_message do |actual|
73
- "expected #{actual} to have at most #{max_difference} difference from "\
74
- "#{expected}, got normalized root-mean-square error of #{@diff}"
75
+ "expected #{actual} to have at most #{max_difference} difference from " \
76
+ "#{expected}, got mean error per pixel of #{@diff}"
75
77
  end
76
78
  end
77
79
 
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.0
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: 2021-10-03 00:00:00.000000000 Z
11
+ date: 2022-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fspath
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '1.5'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '3'
36
+ version: '4'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '1.5'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '3'
46
+ version: '4'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: exifr
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -138,14 +138,20 @@ dependencies:
138
138
  requirements:
139
139
  - - "~>"
140
140
  - !ruby/object:Gem::Version
141
- version: '1.0'
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.0'
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
@@ -167,8 +173,9 @@ executables:
167
173
  extensions: []
168
174
  extra_rdoc_files: []
169
175
  files:
170
- - ".appveyor.yml"
171
176
  - ".github/workflows/check.yml"
177
+ - ".github/workflows/codeql.yml"
178
+ - ".github/workflows/rubocop.yml"
172
179
  - ".gitignore"
173
180
  - ".pre-commit-hooks.yaml"
174
181
  - ".rubocop.yml"
@@ -177,7 +184,6 @@ files:
177
184
  - Gemfile
178
185
  - LICENSE.txt
179
186
  - README.markdown
180
- - Vagrantfile
181
187
  - bin/image_optim
182
188
  - image_optim.gemspec
183
189
  - lib/image_optim.rb
@@ -286,7 +292,7 @@ licenses:
286
292
  metadata:
287
293
  bug_tracker_uri: https://github.com/toy/image_optim/issues
288
294
  changelog_uri: https://github.com/toy/image_optim/blob/master/CHANGELOG.markdown
289
- documentation_uri: https://www.rubydoc.info/gems/image_optim/0.31.0
295
+ documentation_uri: https://www.rubydoc.info/gems/image_optim/0.31.2
290
296
  source_code_uri: https://github.com/toy/image_optim
291
297
  post_install_message: |
292
298
  Rails image assets optimization is extracted into image_optim_rails gem
@@ -305,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
311
  - !ruby/object:Gem::Version
306
312
  version: '0'
307
313
  requirements: []
308
- rubygems_version: 3.2.28
314
+ rubygems_version: 3.3.26
309
315
  signing_key:
310
316
  specification_version: 4
311
317
  summary: Command line tool and ruby interface to optimize (lossless compress, optionally
data/.appveyor.yml DELETED
@@ -1,55 +0,0 @@
1
- version: '{build}-{branch}'
2
- install:
3
- - mkdir tmp\bin || exit 0
4
- - set PATH=C:\Ruby25-x64\bin;%cd%\tmp\bin;%PATH%
5
- - ruby --version
6
- - gem --version
7
- - bundle package --all
8
-
9
- - ps: Install-Product node
10
-
11
- - ps: git --work-tree=tmp\bin checkout origin/windows-binaries -- '*.exe'
12
-
13
- - ps: | # svgo
14
- npm install -g svgo
15
-
16
- - ps: | # ImageMagick
17
- if ((-not (test-path tmp/bin/convert.exe)) -or (-not (test-path tmp/bin/compare.exe)) -or (-not (test-path tmp/bin/magic.xml))) {
18
- choco install -y imagemagick.tool
19
- cp C:\ProgramData\chocolatey\lib\imagemagick.tool\tools\convert.exe tmp\bin
20
- cp C:\ProgramData\chocolatey\lib\imagemagick.tool\tools\compare.exe tmp\bin
21
- cp C:\ProgramData\chocolatey\lib\imagemagick.tool\tools\magic.xml tmp\bin
22
- }
23
-
24
- - bundle exec image_optim --info --allow-lossy --no-pack
25
- cache:
26
- - tmp/bin
27
- build: off
28
- test_script:
29
- - ps: |
30
- $path = $env:Path
31
- $rubypaths = ls -Path C:\Ruby*\bin
32
- foreach ($rubypath in $rubypaths) {
33
- $env:Path = "$rubypath;" + $path
34
- ruby -e "abort unless RUBY_VERSION > '2.3'"
35
- if ($LASTEXITCODE -gt 0) {
36
- continue
37
- }
38
-
39
- echo "################################ $rubypath ################################"
40
- ruby --version
41
- gem --version
42
- bundle package --all
43
- bundle install --local -j4
44
- bundle exec rspec
45
- if ($LASTEXITCODE -gt 0) {
46
- exit 1
47
- }
48
- rm tmp/optimize_test -recurse -force
49
- cp spec/images tmp/optimize_test -recurse -force
50
- bundle exec image_optim --allow-lossy -r tmp/optimize_test
51
- if ($LASTEXITCODE -gt 0) {
52
- exit 1
53
- }
54
- }
55
- $env:Path = $path
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