image_optim 0.26.1 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +5 -5
  2. data/.appveyor.yml +10 -3
  3. data/.rubocop.yml +51 -13
  4. data/.travis.yml +22 -17
  5. data/CHANGELOG.markdown +24 -0
  6. data/Gemfile +3 -1
  7. data/LICENSE.txt +1 -1
  8. data/README.markdown +27 -7
  9. data/Vagrantfile +2 -0
  10. data/bin/image_optim +1 -0
  11. data/image_optim.gemspec +12 -7
  12. data/lib/image_optim.rb +7 -0
  13. data/lib/image_optim/bin_resolver.rb +5 -0
  14. data/lib/image_optim/bin_resolver/bin.rb +45 -19
  15. data/lib/image_optim/bin_resolver/comparable_condition.rb +3 -0
  16. data/lib/image_optim/bin_resolver/error.rb +2 -0
  17. data/lib/image_optim/bin_resolver/simple_version.rb +2 -0
  18. data/lib/image_optim/cache.rb +3 -0
  19. data/lib/image_optim/cache_path.rb +7 -2
  20. data/lib/image_optim/cmd.rb +2 -0
  21. data/lib/image_optim/config.rb +7 -1
  22. data/lib/image_optim/configuration_error.rb +2 -0
  23. data/lib/image_optim/handler.rb +4 -0
  24. data/lib/image_optim/hash_helpers.rb +4 -2
  25. data/lib/image_optim/image_meta.rb +2 -0
  26. data/lib/image_optim/non_negative_integer_range.rb +2 -0
  27. data/lib/image_optim/optimized_path.rb +3 -1
  28. data/lib/image_optim/option_definition.rb +2 -0
  29. data/lib/image_optim/option_helpers.rb +2 -0
  30. data/lib/image_optim/path.rb +22 -5
  31. data/lib/image_optim/runner.rb +3 -0
  32. data/lib/image_optim/runner/glob_helpers.rb +3 -1
  33. data/lib/image_optim/runner/option_parser.rb +4 -2
  34. data/lib/image_optim/space.rb +3 -1
  35. data/lib/image_optim/true_false_nil.rb +4 -2
  36. data/lib/image_optim/worker.rb +5 -0
  37. data/lib/image_optim/worker/advpng.rb +2 -0
  38. data/lib/image_optim/worker/class_methods.rb +6 -1
  39. data/lib/image_optim/worker/gifsicle.rb +2 -0
  40. data/lib/image_optim/worker/jhead.rb +4 -1
  41. data/lib/image_optim/worker/jpegoptim.rb +2 -0
  42. data/lib/image_optim/worker/jpegrecompress.rb +2 -0
  43. data/lib/image_optim/worker/jpegtran.rb +2 -0
  44. data/lib/image_optim/worker/optipng.rb +2 -0
  45. data/lib/image_optim/worker/pngcrush.rb +2 -0
  46. data/lib/image_optim/worker/pngout.rb +7 -0
  47. data/lib/image_optim/worker/pngquant.rb +2 -0
  48. data/lib/image_optim/worker/svgo.rb +2 -0
  49. data/script/update_worker_options_in_readme +3 -2
  50. data/script/worker_analysis +14 -4
  51. data/spec/image_optim/bin_resolver/comparable_condition_spec.rb +2 -0
  52. data/spec/image_optim/bin_resolver/simple_version_spec.rb +2 -0
  53. data/spec/image_optim/bin_resolver_spec.rb +4 -2
  54. data/spec/image_optim/cache_path_spec.rb +51 -25
  55. data/spec/image_optim/cache_spec.rb +4 -0
  56. data/spec/image_optim/cmd_spec.rb +2 -0
  57. data/spec/image_optim/config_spec.rb +2 -0
  58. data/spec/image_optim/handler_spec.rb +2 -0
  59. data/spec/image_optim/hash_helpers_spec.rb +2 -0
  60. data/spec/image_optim/image_meta_spec.rb +2 -0
  61. data/spec/image_optim/optimized_path_spec.rb +2 -0
  62. data/spec/image_optim/option_definition_spec.rb +2 -0
  63. data/spec/image_optim/option_helpers_spec.rb +2 -0
  64. data/spec/image_optim/path_spec.rb +51 -25
  65. data/spec/image_optim/runner/glob_helpers_spec.rb +2 -0
  66. data/spec/image_optim/runner/option_parser_spec.rb +2 -0
  67. data/spec/image_optim/space_spec.rb +13 -11
  68. data/spec/image_optim/worker/optipng_spec.rb +2 -0
  69. data/spec/image_optim/worker/pngquant_spec.rb +2 -0
  70. data/spec/image_optim/worker_spec.rb +2 -0
  71. data/spec/image_optim_spec.rb +2 -0
  72. data/spec/images/invisiblepixels/generate +1 -0
  73. data/spec/images/quant/generate +3 -2
  74. data/spec/spec_helper.rb +3 -0
  75. metadata +33 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ee767f813631dc2d9c8e6fa29215c7a03fc27c47
4
- data.tar.gz: 1e6475763f0e1f2966d9f6eef4ae5b39e1daa700
2
+ SHA256:
3
+ metadata.gz: 2761c4a4a3488017b46d04acf157daa592537169ea05fcbeaf865928b0457618
4
+ data.tar.gz: 89c7fbe11f6b99cf3f1e8c4f3336fd122c1b16afd71fd56b1d0cbd6ab88c52c1
5
5
  SHA512:
6
- metadata.gz: 059eb206df2283758e5e937728b57a0e9aa558b791a2b07a01eb6087b3fdd268dfb9520b9b9f35b63e6fd604f7f26e2c3f53589818ef6c887a1e1d178282b758
7
- data.tar.gz: 6fc6ac440fdb1661372d038c1bdb50eed3a782b04846a22de2757cb2e8c770de665ca6d5ab1d90f91025c078a44ff684177522469c6af733ea216c13ec179280
6
+ metadata.gz: facf38c901cbbd1ba0b8222637845b2e96dc8491e4a55b20a779be53e9ff6e14e561b2ab056aa9182205dd96df20ed0b25c8d8b5a1b3ebe721344ef5384bc7fc
7
+ data.tar.gz: f2d2f1d4179cce616a1024445d8a30b15367a4a156a0a085fa0d8b177f38e44aaff930788b90de6e8226e7b4c022eb1877794aceee5e62cd7e7c1153554238e3
@@ -1,8 +1,9 @@
1
1
  version: '{build}-{branch}'
2
2
  install:
3
3
  - mkdir tmp\bin || exit 0
4
- - set PATH=%cd%\tmp\bin;%PATH%
4
+ - set PATH=C:\Ruby25-x64\bin;%cd%\tmp\bin;%PATH%
5
5
  - ruby --version
6
+ - gem --version
6
7
  - bundle package --all
7
8
 
8
9
  - ps: git --work-tree=tmp\bin checkout origin/windows-binaries -- '*.exe'
@@ -26,10 +27,16 @@ test_script:
26
27
  - ps: |
27
28
  $path = $env:Path
28
29
  $rubypaths = ls -Path C:\Ruby*\bin
29
- foreach ($rubypath in $rubypaths[-2, -1]) {
30
- echo "################################################################################"
30
+ foreach ($rubypath in $rubypaths) {
31
31
  $env:Path = "$rubypath;" + $path
32
+ ruby -e "abort unless RUBY_VERSION > '2.3'"
33
+ if ($LASTEXITCODE -gt 0) {
34
+ continue
35
+ }
36
+
37
+ echo "################################ $rubypath ################################"
32
38
  ruby --version
39
+ gem --version
33
40
  bundle package --all
34
41
  bundle install --local -j4
35
42
  bundle exec rspec
@@ -2,6 +2,7 @@ AllCops:
2
2
  Exclude:
3
3
  - '*.gemspec'
4
4
  - 'vendor/**/*'
5
+ NewCops: enable
5
6
 
6
7
  Bundler/OrderedGems:
7
8
  Enabled: false
@@ -9,26 +10,36 @@ Bundler/OrderedGems:
9
10
  Layout/AccessModifierIndentation:
10
11
  EnforcedStyle: outdent
11
12
 
13
+ Layout/AssignmentIndentation:
14
+ Enabled: false
15
+
12
16
  Layout/CaseIndentation:
13
17
  EnforcedStyle: end
14
18
 
15
19
  Layout/DotPosition:
16
20
  EnforcedStyle: trailing
17
21
 
18
- Layout/IndentArray:
22
+ Layout/EndAlignment:
23
+ EnforcedStyleAlignWith: variable
24
+
25
+ Layout/FirstArrayElementIndentation:
19
26
  EnforcedStyle: consistent
20
27
 
21
- Layout/IndentAssignment:
28
+ Layout/FirstHashElementIndentation:
29
+ EnforcedStyle: consistent
30
+
31
+ Layout/HeredocIndentation:
22
32
  Enabled: false
23
33
 
24
- Layout/IndentHash:
25
- EnforcedStyle: consistent
34
+ Layout/LineLength:
35
+ Max: 120
26
36
 
27
- Layout/IndentHeredoc:
37
+ Layout/RescueEnsureAlignment:
28
38
  Enabled: false
29
39
 
30
40
  Layout/SpaceBeforeBlockBraces:
31
41
  EnforcedStyle: no_space
42
+ EnforcedStyleForEmptyBraces: no_space
32
43
 
33
44
  Layout/SpaceInsideHashLiteralBraces:
34
45
  EnforcedStyle: no_space
@@ -37,17 +48,17 @@ Lint/AmbiguousBlockAssociation:
37
48
  Exclude:
38
49
  - spec/**/*_spec.rb
39
50
 
40
- Lint/EndAlignment:
41
- EnforcedStyleAlignWith: variable
42
-
43
51
  Lint/NestedPercentLiteral:
44
52
  Enabled: false
45
53
 
46
- Lint/UnneededSplatExpansion:
54
+ Lint/RedundantRequireStatement:
55
+ Enabled: false
56
+
57
+ Lint/RedundantSplatExpansion:
47
58
  Enabled: false
48
59
 
49
60
  Metrics/AbcSize:
50
- Max: 30
61
+ Max: 33
51
62
 
52
63
  Metrics/BlockLength:
53
64
  Exclude:
@@ -59,18 +70,21 @@ Metrics/ClassLength:
59
70
  Max: 150
60
71
 
61
72
  Metrics/CyclomaticComplexity:
62
- Max: 10
73
+ Max: 11
63
74
 
64
75
  Metrics/MethodLength:
65
76
  Max: 25
66
77
 
67
78
  Metrics/PerceivedComplexity:
68
- Max: 8
79
+ Max: 10
69
80
 
70
81
  Security/MarshalLoad:
71
82
  Exclude:
72
83
  - 'script/worker_analysis'
73
84
 
85
+ Style/AccessorGrouping:
86
+ Enabled: false
87
+
74
88
  Style/Alias:
75
89
  EnforcedStyle: prefer_alias_method
76
90
 
@@ -83,21 +97,42 @@ Style/EmptyCaseCondition:
83
97
  Style/Encoding:
84
98
  Enabled: false
85
99
 
100
+ Style/ExpandPathArguments:
101
+ Enabled: false
102
+
86
103
  Style/FormatStringToken:
87
104
  Enabled: false
88
105
 
106
+ Style/HashEachMethods:
107
+ Enabled: true
108
+
89
109
  Style/HashSyntax:
90
110
  EnforcedStyle: hash_rockets
91
111
 
112
+ Style/HashTransformKeys:
113
+ Enabled: false
114
+
115
+ Style/HashTransformValues:
116
+ Enabled: false
117
+
92
118
  Style/IfUnlessModifier:
93
119
  Enabled: false
94
120
 
121
+ Style/NumericPredicate:
122
+ EnforcedStyle: comparison
123
+
124
+ Style/OptionalBooleanParameter:
125
+ Enabled: false
126
+
95
127
  Style/ParallelAssignment:
96
128
  Enabled: false
97
129
 
98
130
  Style/RescueStandardError:
99
131
  EnforcedStyle: implicit
100
132
 
133
+ Style/SafeNavigation:
134
+ Enabled: false
135
+
101
136
  Style/Semicolon:
102
137
  AllowAsExpressionSeparator: true
103
138
 
@@ -110,5 +145,8 @@ Style/SymbolArray:
110
145
  Style/TrailingCommaInArguments:
111
146
  EnforcedStyleForMultiline: no_comma
112
147
 
113
- Style/TrailingCommaInLiteral:
148
+ Style/TrailingCommaInArrayLiteral:
149
+ EnforcedStyleForMultiline: comma
150
+
151
+ Style/TrailingCommaInHashLiteral:
114
152
  EnforcedStyleForMultiline: comma
@@ -1,4 +1,5 @@
1
1
  sudo: false
2
+ dist: trusty
2
3
  language: ruby
3
4
  cache:
4
5
  bundler: true
@@ -6,38 +7,42 @@ cache:
6
7
  - $(npm root)
7
8
  - ~/bin
8
9
  rvm:
9
- - '1.8.7-p371'
10
+ - '1.8.7-p374'
10
11
  - '1.9.3-p551'
11
12
  - '2.0.0-p648'
12
13
  - '2.1.10'
13
- - '2.2.8'
14
- - '2.3.5'
15
- - '2.4.2'
16
- - 'jruby-9.0.5.0'
17
- - 'jruby-9.1.9.0'
14
+ - '2.2.10'
15
+ - '2.3.8'
16
+ - '2.4.10'
17
+ - '2.5.8'
18
+ - '2.6.6'
19
+ - '2.7.1'
20
+ - 'jruby-9.2.11.1'
18
21
  script:
19
22
  - bundle exec image_optim --info
20
23
  - bundle exec rspec
21
24
  before_install:
22
- - gem update --system
23
- - gem update bundler
25
+ - 'echo "gem: --no-ri --no-rdoc --no-document" > ~/.gemrc'
26
+ - gem install rubygems-update || gem install rubygems-update --version '< 3'
27
+ - update_rubygems
28
+ - gem install bundler || gem install bundler --version '< 2'
24
29
  - nvm install stable
25
30
  - mkdir -p ~/bin
26
31
  - command -v svgo || npm install -g svgo
27
- - command -v pngout || curl -L "http://static.jonof.id.au/dl/kenutils/pngout-20130221-linux.tar.gz" | tar -xz -C ~/bin --strip-components 2 --wildcards '*/x86_64/pngout'
32
+ - command -v pngout || curl -L "https://www.jonof.id.au/files/kenutils/pngout-20200115-linux.tar.gz" | tar -xz -C ~/bin --strip-components 2 --wildcards '*/amd64/pngout'
28
33
  matrix:
29
34
  include:
30
- - env: CODECLIMATE=✓
31
- rvm: '2.4.2'
35
+ - env: CODECLIMATE=1
36
+ rvm: '2.4.10'
32
37
  after_success: bundle exec codeclimate-test-reporter
33
- - env: RUBOCOP=✓
34
- rvm: '2.4.2'
38
+ - env: RUBOCOP=1
39
+ rvm: '2.4.10'
35
40
  script: bundle exec rubocop
36
- before_install:
37
- - env: CHECK_RUBIES=✓
38
- rvm: '2.4.2'
41
+ before_install: gem update --system && gem install bundler
42
+ - env: CHECK_RUBIES=1
43
+ rvm: '2.4.10'
39
44
  script: bundle exec travis_check_rubies
40
- before_install:
45
+ before_install: gem update --system && gem install bundler
41
46
  addons:
42
47
  code_climate:
43
48
  repo_token:
@@ -2,6 +2,30 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## v0.27.0 (2020-08-27)
6
+
7
+ * Use `.tmp` as the extension for temporary file if it needs to be created for atomic replacement [#178](https://github.com/toy/image_optim/issues/178) [@toy](https://github.com/toy)
8
+ * Don't create a temporary file in destination directory for atomic replacement if temporary directory is on same device as destination [#178](https://github.com/toy/image_optim/issues/178) [@toy](https://github.com/toy)
9
+
10
+ ## v0.26.5 (2019-07-14)
11
+
12
+ * Remove deprecated `rubyforge_project` attribute from gemspec [rubygems/rubygems#2436](https://github.com/rubygems/rubygems/pull/2436) [@toy](https://github.com/toy)
13
+
14
+ ## v0.26.4 (2019-05-23)
15
+
16
+ * Enable frozen string literals [@toy](https://github.com/toy)
17
+
18
+ ## v0.26.3 (2018-10-13)
19
+
20
+ * Handle `vnone` version of `advpng` that was erroneously produced for `ubuntu` and `homebrew` [#165](https://github.com/toy/image_optim/issues/165) [@toy](https://github.com/toy)
21
+
22
+ ## v0.26.2 (2018-08-15)
23
+
24
+ * Ignore segmentation fault for `pngout` <= `20150920` [#158](https://github.com/toy/image_optim/issues/158) [@toy](https://github.com/toy)
25
+ * Allow `image_size` 2.x [@toy](https://github.com/toy)
26
+ * Add instructions for installing `svgo` in project folder [#156](https://github.com/toy/image_optim/issues/156) [@brian-kephart](https://github.com/brian-kephart)
27
+ * Show full bin search path in verbose output [@toy](https://github.com/toy)
28
+
5
29
  ## v0.26.1 (2017-12-14)
6
30
 
7
31
  * Require `'date'` which is used in parsing pngout version [toy/image_optim_pack#14](https://github.com/toy/image_optim_pack/issues/14) [@toy](https://github.com/toy)
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
@@ -10,6 +12,6 @@ if ENV['CODECLIMATE']
10
12
  end
11
13
  end
12
14
 
13
- if RUBY_VERSION >= '2.0'
15
+ if ENV['CHECK_RUBIES']
14
16
  gem 'travis_check_rubies', '~> 0.2'
15
17
  end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2017 Ivan Kuchin
1
+ Copyright (c) 2012-2020 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
@@ -1,14 +1,14 @@
1
1
  [![Gem Version](https://img.shields.io/gem/v/image_optim.svg?style=flat)](https://rubygems.org/gems/image_optim)
2
2
  [![Build Status](https://img.shields.io/travis/toy/image_optim/master.svg?style=flat)](https://travis-ci.org/toy/image_optim)
3
3
  [![AppVeyor Status](https://img.shields.io/appveyor/ci/toy/image-optim/master.svg?style=flat&label=windows)](https://ci.appveyor.com/project/toy/image-optim)
4
- [![Code Climate](https://img.shields.io/codeclimate/github/toy/image_optim.svg?style=flat)](https://codeclimate.com/github/toy/image_optim)
5
- [![Code Climate Coverage](https://img.shields.io/codeclimate/coverage/github/toy/image_optim.svg?style=flat)](https://codeclimate.com/github/toy/image_optim)
6
- [![Dependency Status](https://img.shields.io/gemnasium/toy/image_optim.svg?style=flat)](https://gemnasium.com/toy/image_optim)
4
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/toy/image_optim.svg?style=flat)](https://codeclimate.com/github/toy/image_optim)
5
+ [![Code Climate Coverage](https://img.shields.io/codeclimate/c/toy/image_optim.svg?style=flat)](https://codeclimate.com/github/toy/image_optim)
6
+ [![Depfu](https://badges.depfu.com/badges/221b4832fa96f613aa5401f7cb4030ac/overview.svg)](https://depfu.com/github/toy/image_optim)
7
7
  [![Inch CI](https://inch-ci.org/github/toy/image_optim.svg?branch=master&style=flat)](https://inch-ci.org/github/toy/image_optim)
8
8
 
9
9
  # image_optim
10
10
 
11
- Optimize (lossless compress, optionally lossy) images (jpeg, png, gif, svg) using external utilities:
11
+ Command line tool and ruby interface to optimize (lossless compress, optionally lossy) jpeg, png, gif and svg images using external utilities:
12
12
 
13
13
  * [advpng](http://advancemame.sourceforge.net/doc-advpng.html) from [AdvanceCOMP](http://advancemame.sourceforge.net/comp-readme.html)
14
14
  (will use [zopfli](https://code.google.com/p/zopfli/) on default/maximum level 4)
@@ -25,7 +25,9 @@ Optimize (lossless compress, optionally lossy) images (jpeg, png, gif, svg) usin
25
25
 
26
26
  Based on [ImageOptim.app](http://imageoptim.com/).
27
27
 
28
- Documentation for [latest version](http://rubydoc.info/gems/image_optim/frames) and [master](http://rubydoc.info/github/toy/image_optim/master/frames).
28
+ 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
+
30
+ A test application with latest `image_optim` and `image_optim_pack` is available on heroku: https://iopack.herokuapp.com/.
29
31
 
30
32
  ## Gem installation
31
33
 
@@ -58,7 +60,7 @@ With version:
58
60
 
59
61
  <!---<update-version>-->
60
62
  ```ruby
61
- gem 'image_optim', '~> 0.26'
63
+ gem 'image_optim', '~> 0.27'
62
64
  ```
63
65
  <!---</update-version>-->
64
66
 
@@ -178,6 +180,20 @@ _Note: pngout is free to use even in commercial soft, but you can not redistribu
178
180
  npm install -g svgo
179
181
  ```
180
182
 
183
+ If you prefer to install `svgo` to your project directory, use one of the following commands instead:
184
+
185
+ ```bash
186
+ npm install svgo
187
+
188
+ yarn add svgo
189
+ ```
190
+
191
+ When installing `svgo` to the project directory, you must add the following to your environment:
192
+
193
+ ```
194
+ SVGO_BIN='node_modules/svgo/bin/svgo'
195
+ ```
196
+
181
197
  ### jpeg-recompress installation (optional)
182
198
 
183
199
  Download and install the `jpeg-recompress` binary from the [JPEG-Archive Releases](https://github.com/danielgtaylor/jpeg-archive/releases) page,
@@ -261,6 +277,10 @@ optipng:
261
277
  level: 5
262
278
  ```
263
279
 
280
+ ### Temporary directory
281
+
282
+ `image_optim` uses standard ruby library for creating temporary files. Temporary directory can be changed using one of `TMPDIR`, `TMP` or `TEMP` environment variables.
283
+
264
284
  ## Options
265
285
 
266
286
  * `:nice` — Nice level, priority of all used tools with higher value meaning lower priority, in range `-20..19`, negative values can be set only if run by root user *(defaults to `10`)*
@@ -341,4 +361,4 @@ In separate file [CHANGELOG.markdown](CHANGELOG.markdown).
341
361
 
342
362
  ## Copyright
343
363
 
344
- Copyright (c) 2012-2017 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.
364
+ Copyright (c) 2012-2020 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Vagrant.configure('2') do |config|
2
4
  config.vm.box = 'ubuntu/precise64'
3
5
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: UTF-8
3
+ # frozen_string_literal: true
3
4
 
4
5
  require 'image_optim/runner'
5
6
  require 'image_optim/runner/option_parser'
@@ -2,13 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'image_optim'
5
- s.version = '0.26.1'
6
- s.summary = %q{Optimize (lossless compress, optionally lossy) images (jpeg, png, gif, svg) using external utilities (advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegrescan, jpegtran, optipng, pngcrush, pngout, pngquant, svgo)}
7
- s.homepage = "http://github.com/toy/#{s.name}"
5
+ s.version = '0.27.0'
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, pngcrush, pngout, pngquant, svgo)}
7
+ s.homepage = "https://github.com/toy/#{s.name}"
8
8
  s.authors = ['Ivan Kuchin']
9
9
  s.license = 'MIT'
10
10
 
11
- s.rubyforge_project = s.name
11
+ s.metadata = {
12
+ 'bug_tracker_uri' => "https://github.com/toy/#{s.name}/issues",
13
+ 'changelog_uri' => "https://github.com/toy/#{s.name}/blob/master/CHANGELOG.markdown",
14
+ 'documentation_uri' => "https://www.rubydoc.info/gems/#{s.name}/#{s.version}",
15
+ 'source_code_uri' => "https://github.com/toy/#{s.name}",
16
+ }
12
17
 
13
18
  s.files = `git ls-files`.split("\n")
14
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -21,14 +26,14 @@ You can safely remove `config.assets.image_optim = false` if you are not going t
21
26
  EOF
22
27
 
23
28
  s.add_dependency 'fspath', '~> 3.0'
24
- s.add_dependency 'image_size', '~> 1.5'
29
+ s.add_dependency 'image_size', '>= 1.5', '< 3'
25
30
  s.add_dependency 'exifr', '~> 1.2', '>= 1.2.2'
26
31
  s.add_dependency 'progress', '~> 3.0', '>= 3.0.1'
27
32
  s.add_dependency 'in_threads', '~> 1.3'
28
33
 
29
34
  s.add_development_dependency 'image_optim_pack', '~> 0.2', '>= 0.2.2'
30
35
  s.add_development_dependency 'rspec', '~> 3.0'
31
- if RUBY_VERSION >= '2.1'
32
- s.add_development_dependency 'rubocop', '~> 0.52'
36
+ if RUBY_VERSION >= '2.2' && !Gem.win_platform? && !defined?(JRUBY_VERSION)
37
+ s.add_development_dependency 'rubocop', '~> 0.59', '!= 0.78.0'
33
38
  end
34
39
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/bin_resolver'
2
4
  require 'image_optim/cache'
3
5
  require 'image_optim/config'
@@ -83,6 +85,8 @@ class ImageOptim
83
85
 
84
86
  @bin_resolver = BinResolver.new(self)
85
87
 
88
+ $stderr << "PATH: #{@bin_resolver.env_path}\n" if verbose
89
+
86
90
  @workers_by_format = Worker.create_all_by_format(self) do |klass|
87
91
  config.for_worker(klass)
88
92
  end
@@ -116,6 +120,7 @@ class ImageOptim
116
120
  end
117
121
 
118
122
  return unless optimized
123
+
119
124
  OptimizedPath.new(optimized, original)
120
125
  end
121
126
 
@@ -124,6 +129,7 @@ class ImageOptim
124
129
  def optimize_image!(original)
125
130
  original = Path.convert(original)
126
131
  return unless (result = optimize_image(original))
132
+
127
133
  result.replace(original)
128
134
  OptimizedPath.new(original, result.original_size)
129
135
  end
@@ -132,6 +138,7 @@ class ImageOptim
132
138
  def optimize_image_data(original_data)
133
139
  format = ImageMeta.format_for_data(original_data)
134
140
  return unless format
141
+
135
142
  Path.temp_file %W[image_optim .#{format}] do |temp|
136
143
  temp.binmode
137
144
  temp.write(original_data)