image_optim 0.31.0 → 0.31.1

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: 481b027ab78658543ea138ff4d7547a609dca8b31eea02f8cb003318f10c67eb
4
+ data.tar.gz: e11f9f69a28e6a3e7a0028579cb36e78b5dd1457943a884f8071d6de17e7031e
5
5
  SHA512:
6
- metadata.gz: b0395980a804453e3273f779c1217d5dd5b9b7c522e74964070b43f2b3ac433f9f39d5f997a3e9c6594f22d244752910eea1697ac2e570de34e6b0641555b9e8
7
- data.tar.gz: 9de0bebe89071d3aa7bd506b02dc684b53d998dcfccab1debad72bdc244e6fbae6eb0ac2d5871359fe2ffa5cb9e7c5ae8a7dc98829e00e8abef49c017ac3b00c
6
+ metadata.gz: 961044af3b8ef65acbdc6bbce6a278e8aefe246a1ea53a6eceea5bb025f02c7adeecf457843fd2244a5bc21fa0f303094a16f4947cda41fc9ac7372dbcce5f46
7
+ data.tar.gz: ea8dcb08f8fffd1aad10506bdb3ab2bdf0043f30d08b68e2cb0d2195562492d6477619e3bdcf830a9bec9ead04adfe36b195b136fba61a1e7d4f96835c61c854
@@ -32,6 +32,36 @@ jobs:
32
32
  - 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
33
  - run: bundle exec image_optim --info
34
34
  - run: bundle exec rspec
35
+ windows:
36
+ runs-on: windows-latest
37
+ strategy:
38
+ matrix:
39
+ ruby:
40
+ - '2.6'
41
+ - '2.7'
42
+ - '3.0'
43
+ fail-fast: false
44
+ steps:
45
+ - uses: actions/checkout@v2
46
+ - uses: ruby/setup-ruby@v1
47
+ with:
48
+ ruby-version: "${{ matrix.ruby }}"
49
+ bundler-cache: true
50
+ - uses: actions/cache@v2
51
+ with:
52
+ path: "$HOME/bin"
53
+ key: ${{ runner.os }}
54
+ - run: |
55
+ mkdir "$HOME/bin"
56
+ git fetch origin windows-binaries
57
+ git --work-tree="$HOME/bin" checkout origin/windows-binaries -- '*.exe'
58
+ echo "$HOME/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
59
+ - run: |
60
+ choco install --no-progress imagemagick
61
+ ls C:\'Program Files'\ImageMagick* | % FullName | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
62
+ - run: npm install -g svgo
63
+ - run: bundle exec image_optim --info
64
+ - run: bundle exec rspec
35
65
  coverage:
36
66
  runs-on: ubuntu-latest
37
67
  env:
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## v0.31.1 (2021-10-21)
6
+
7
+ * Allow image_size 3 [@toy](https://github.com/toy)
8
+
5
9
  ## v0.31.0 (2021-10-03)
6
10
 
7
11
  * 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/README.markdown CHANGED
@@ -1,6 +1,5 @@
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)
4
3
  [![Code Climate](https://img.shields.io/codeclimate/maintainability/toy/image_optim?logo=codeclimate)](https://codeclimate.com/github/toy/image_optim)
5
4
  [![Code Climate Coverage](https://img.shields.io/codeclimate/coverage/toy/image_optim?logo=codeclimate)](https://codeclimate.com/github/toy/image_optim)
6
5
  [![Depfu](https://img.shields.io/depfu/toy/image_optim)](https://depfu.com/github/toy/image_optim)
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.1'
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,7 +28,7 @@ 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'
@@ -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:
data/spec/spec_helper.rb CHANGED
@@ -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
@@ -71,7 +73,7 @@ RSpec::Matchers.define :be_similar_to do |expected, max_difference|
71
73
  end
72
74
  failure_message do |actual|
73
75
  "expected #{actual} to have at most #{max_difference} difference from "\
74
- "#{expected}, got normalized root-mean-square error of #{@diff}"
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.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: 2021-10-03 00:00:00.000000000 Z
11
+ date: 2021-10-20 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
@@ -167,7 +167,6 @@ executables:
167
167
  extensions: []
168
168
  extra_rdoc_files: []
169
169
  files:
170
- - ".appveyor.yml"
171
170
  - ".github/workflows/check.yml"
172
171
  - ".gitignore"
173
172
  - ".pre-commit-hooks.yaml"
@@ -286,7 +285,7 @@ licenses:
286
285
  metadata:
287
286
  bug_tracker_uri: https://github.com/toy/image_optim/issues
288
287
  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
288
+ documentation_uri: https://www.rubydoc.info/gems/image_optim/0.31.1
290
289
  source_code_uri: https://github.com/toy/image_optim
291
290
  post_install_message: |
292
291
  Rails image assets optimization is extracted into image_optim_rails gem
@@ -305,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
304
  - !ruby/object:Gem::Version
306
305
  version: '0'
307
306
  requirements: []
308
- rubygems_version: 3.2.28
307
+ rubygems_version: 3.2.29
309
308
  signing_key:
310
309
  specification_version: 4
311
310
  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