image_optim 0.26.3 → 0.26.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.appveyor.yml +9 -2
- data/.rubocop.yml +8 -2
- data/.travis.yml +9 -8
- data/CHANGELOG.markdown +4 -0
- data/Gemfile +5 -1
- data/LICENSE.txt +1 -1
- data/README.markdown +3 -1
- data/Vagrantfile +2 -0
- data/bin/image_optim +1 -0
- data/image_optim.gemspec +3 -3
- data/lib/image_optim.rb +2 -0
- data/lib/image_optim/bin_resolver.rb +2 -0
- data/lib/image_optim/bin_resolver/bin.rb +2 -0
- data/lib/image_optim/bin_resolver/comparable_condition.rb +2 -0
- data/lib/image_optim/bin_resolver/error.rb +2 -0
- data/lib/image_optim/bin_resolver/simple_version.rb +2 -0
- data/lib/image_optim/cache.rb +2 -0
- data/lib/image_optim/cache_path.rb +2 -0
- data/lib/image_optim/cmd.rb +2 -0
- data/lib/image_optim/config.rb +3 -1
- data/lib/image_optim/configuration_error.rb +2 -0
- data/lib/image_optim/handler.rb +2 -0
- data/lib/image_optim/hash_helpers.rb +2 -0
- data/lib/image_optim/image_meta.rb +2 -0
- data/lib/image_optim/non_negative_integer_range.rb +2 -0
- data/lib/image_optim/optimized_path.rb +2 -0
- data/lib/image_optim/option_definition.rb +2 -0
- data/lib/image_optim/option_helpers.rb +2 -0
- data/lib/image_optim/path.rb +2 -0
- data/lib/image_optim/runner.rb +2 -0
- data/lib/image_optim/runner/glob_helpers.rb +3 -1
- data/lib/image_optim/runner/option_parser.rb +3 -2
- data/lib/image_optim/space.rb +3 -1
- data/lib/image_optim/true_false_nil.rb +2 -0
- data/lib/image_optim/worker.rb +1 -0
- data/lib/image_optim/worker/advpng.rb +2 -0
- data/lib/image_optim/worker/class_methods.rb +2 -0
- data/lib/image_optim/worker/gifsicle.rb +2 -0
- data/lib/image_optim/worker/jhead.rb +3 -1
- data/lib/image_optim/worker/jpegoptim.rb +2 -0
- data/lib/image_optim/worker/jpegrecompress.rb +2 -0
- data/lib/image_optim/worker/jpegtran.rb +2 -0
- data/lib/image_optim/worker/optipng.rb +2 -0
- data/lib/image_optim/worker/pngcrush.rb +2 -0
- data/lib/image_optim/worker/pngout.rb +2 -0
- data/lib/image_optim/worker/pngquant.rb +2 -0
- data/lib/image_optim/worker/svgo.rb +2 -0
- data/script/update_worker_options_in_readme +3 -2
- data/script/worker_analysis +3 -2
- data/spec/image_optim/bin_resolver/comparable_condition_spec.rb +2 -0
- data/spec/image_optim/bin_resolver/simple_version_spec.rb +2 -0
- data/spec/image_optim/bin_resolver_spec.rb +2 -0
- data/spec/image_optim/cache_path_spec.rb +2 -0
- data/spec/image_optim/cache_spec.rb +2 -0
- data/spec/image_optim/cmd_spec.rb +2 -0
- data/spec/image_optim/config_spec.rb +2 -0
- data/spec/image_optim/handler_spec.rb +2 -0
- data/spec/image_optim/hash_helpers_spec.rb +2 -0
- data/spec/image_optim/image_meta_spec.rb +2 -0
- data/spec/image_optim/optimized_path_spec.rb +2 -0
- data/spec/image_optim/option_definition_spec.rb +2 -0
- data/spec/image_optim/option_helpers_spec.rb +2 -0
- data/spec/image_optim/path_spec.rb +2 -0
- data/spec/image_optim/runner/glob_helpers_spec.rb +2 -0
- data/spec/image_optim/runner/option_parser_spec.rb +2 -0
- data/spec/image_optim/space_spec.rb +13 -11
- data/spec/image_optim/worker/optipng_spec.rb +2 -0
- data/spec/image_optim/worker/pngquant_spec.rb +2 -0
- data/spec/image_optim/worker_spec.rb +2 -0
- data/spec/image_optim_spec.rb +2 -0
- data/spec/images/invisiblepixels/generate +1 -0
- data/spec/images/quant/generate +1 -0
- data/spec/spec_helper.rb +2 -0
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00401e7aa20de4af81903c0c1ddac9d9cbb9eda7d17377f1fdf69dbe3280e346
|
4
|
+
data.tar.gz: 748fcdbedccbb2bb67082c1fd97b678a9aa1c383d1d91f9089a9a3f84ff1eb3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33e4f3be57b23b3752b6992f50b6e8400c43f3273b404c9fe390107ccab85d947e4c69687f12d5e361df6f439568c7233eafa03bd3b7a6d329b068326b16476f
|
7
|
+
data.tar.gz: 19b8dd22e717e0cd06bf32b11fd4a048f6a1543299bb741980ec7c2e06c35b087b1f142570afb07e1471b33aeef5d041a77c4f2b3488e808a848b45673278ed7
|
data/.appveyor.yml
CHANGED
@@ -3,6 +3,7 @@ install:
|
|
3
3
|
- mkdir tmp\bin || exit 0
|
4
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
|
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
|
data/.rubocop.yml
CHANGED
@@ -18,13 +18,13 @@ Layout/DotPosition:
|
|
18
18
|
Layout/EndAlignment:
|
19
19
|
EnforcedStyleAlignWith: variable
|
20
20
|
|
21
|
-
Layout/
|
21
|
+
Layout/IndentFirstArrayElement:
|
22
22
|
EnforcedStyle: consistent
|
23
23
|
|
24
24
|
Layout/IndentAssignment:
|
25
25
|
Enabled: false
|
26
26
|
|
27
|
-
Layout/
|
27
|
+
Layout/IndentFirstHashElement:
|
28
28
|
EnforcedStyle: consistent
|
29
29
|
|
30
30
|
Layout/IndentHeredoc:
|
@@ -105,12 +105,18 @@ Style/HashSyntax:
|
|
105
105
|
Style/IfUnlessModifier:
|
106
106
|
Enabled: false
|
107
107
|
|
108
|
+
Style/NumericPredicate:
|
109
|
+
EnforcedStyle: comparison
|
110
|
+
|
108
111
|
Style/ParallelAssignment:
|
109
112
|
Enabled: false
|
110
113
|
|
111
114
|
Style/RescueStandardError:
|
112
115
|
EnforcedStyle: implicit
|
113
116
|
|
117
|
+
Style/SafeNavigation:
|
118
|
+
Enabled: false
|
119
|
+
|
114
120
|
Style/Semicolon:
|
115
121
|
AllowAsExpressionSeparator: true
|
116
122
|
|
data/.travis.yml
CHANGED
@@ -11,17 +11,18 @@ rvm:
|
|
11
11
|
- '2.0.0-p648'
|
12
12
|
- '2.1.10'
|
13
13
|
- '2.2.10'
|
14
|
-
- '2.3.
|
15
|
-
- '2.4.
|
16
|
-
- '2.5.
|
17
|
-
- '
|
14
|
+
- '2.3.8'
|
15
|
+
- '2.4.6'
|
16
|
+
- '2.5.5'
|
17
|
+
- '2.6.3'
|
18
18
|
- 'jruby-9.1.9.0'
|
19
19
|
script:
|
20
20
|
- bundle exec image_optim --info
|
21
21
|
- bundle exec rspec
|
22
22
|
before_install:
|
23
|
+
- gem install rubygems-update || gem install rubygems-update --version '< 3'
|
23
24
|
- gem update --system
|
24
|
-
- gem install bundler
|
25
|
+
- gem install bundler || gem install bundler --version '< 2'
|
25
26
|
- nvm install stable
|
26
27
|
- mkdir -p ~/bin
|
27
28
|
- command -v svgo || npm install -g svgo
|
@@ -29,14 +30,14 @@ before_install:
|
|
29
30
|
matrix:
|
30
31
|
include:
|
31
32
|
- env: CODECLIMATE=✓
|
32
|
-
rvm: '2.4.
|
33
|
+
rvm: '2.4.6'
|
33
34
|
after_success: bundle exec codeclimate-test-reporter
|
34
35
|
- env: RUBOCOP=✓
|
35
|
-
rvm: '2.4.
|
36
|
+
rvm: '2.4.6'
|
36
37
|
script: bundle exec rubocop
|
37
38
|
before_install: gem update --system && gem install bundler
|
38
39
|
- env: CHECK_RUBIES=✓
|
39
|
-
rvm: '2.4.
|
40
|
+
rvm: '2.4.6'
|
40
41
|
script: bundle exec travis_check_rubies
|
41
42
|
before_install: gem update --system && gem install bundler
|
42
43
|
addons:
|
data/CHANGELOG.markdown
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## unreleased
|
4
4
|
|
5
|
+
## v0.26.4 (2019-05-23)
|
6
|
+
|
7
|
+
* Enable frozen string literals [@toy](https://github.com/toy)
|
8
|
+
|
5
9
|
## v0.26.3 (2018-10-13)
|
6
10
|
|
7
11
|
* 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)
|
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,8 @@ if ENV['CODECLIMATE']
|
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
13
|
-
if
|
15
|
+
if ENV['CHECK_RUBIES']
|
14
16
|
gem 'travis_check_rubies', '~> 0.2'
|
15
17
|
end
|
18
|
+
|
19
|
+
gem 'rspec-expectations', '!= 3.8.3' # https://github.com/rspec/rspec-expectations/issues/1113
|
data/LICENSE.txt
CHANGED
data/README.markdown
CHANGED
@@ -27,6 +27,8 @@ Based on [ImageOptim.app](http://imageoptim.com/).
|
|
27
27
|
|
28
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
29
|
|
30
|
+
A test application with latest `image_optim` and `image_optim_pack` is available on heroku: https://iopack.herokuapp.com/.
|
31
|
+
|
30
32
|
## Gem installation
|
31
33
|
|
32
34
|
```sh
|
@@ -355,4 +357,4 @@ In separate file [CHANGELOG.markdown](CHANGELOG.markdown).
|
|
355
357
|
|
356
358
|
## Copyright
|
357
359
|
|
358
|
-
Copyright (c) 2012-
|
360
|
+
Copyright (c) 2012-2019 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.
|
data/Vagrantfile
CHANGED
data/bin/image_optim
CHANGED
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.26.
|
5
|
+
s.version = '0.26.4'
|
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, pngcrush, pngout, pngquant, svgo)}
|
7
7
|
s.homepage = "http://github.com/toy/#{s.name}"
|
8
8
|
s.authors = ['Ivan Kuchin']
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.metadata = {
|
14
14
|
'bug_tracker_uri' => "https://github.com/toy/#{s.name}/issues",
|
15
|
-
'changelog_uri' => "https://github.com/toy/#{s.name}/CHANGELOG.markdown",
|
15
|
+
'changelog_uri' => "https://github.com/toy/#{s.name}/blob/master/CHANGELOG.markdown",
|
16
16
|
'documentation_uri' => "https://www.rubydoc.info/gems/#{s.name}/#{s.version}",
|
17
17
|
'source_code_uri' => "https://github.com/toy/#{s.name}",
|
18
18
|
}
|
@@ -35,7 +35,7 @@ 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.2'
|
38
|
+
if RUBY_VERSION >= '2.2' && !Gem.win_platform? && !defined?(JRUBY_VERSION)
|
39
39
|
s.add_development_dependency 'rubocop', '~> 0.59'
|
40
40
|
end
|
41
41
|
end
|
data/lib/image_optim.rb
CHANGED
data/lib/image_optim/cache.rb
CHANGED
data/lib/image_optim/cmd.rb
CHANGED
data/lib/image_optim/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'image_optim/option_helpers'
|
2
4
|
require 'image_optim/configuration_error'
|
3
5
|
require 'image_optim/hash_helpers'
|
@@ -18,7 +20,7 @@ class ImageOptim
|
|
18
20
|
end
|
19
21
|
|
20
22
|
# Local config path at `./.image_optim.yml`
|
21
|
-
LOCAL_PATH = './.image_optim.yml'
|
23
|
+
LOCAL_PATH = './.image_optim.yml'
|
22
24
|
|
23
25
|
class << self
|
24
26
|
# Read options at path: expand path (warn on failure), return {} if file
|
data/lib/image_optim/handler.rb
CHANGED
data/lib/image_optim/path.rb
CHANGED
data/lib/image_optim/runner.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class ImageOptim
|
2
4
|
class Runner
|
3
5
|
# Helper methods for glob
|
@@ -21,7 +23,7 @@ class ImageOptim
|
|
21
23
|
.* # what is left
|
22
24
|
)
|
23
25
|
\z
|
24
|
-
/x
|
26
|
+
/x.freeze
|
25
27
|
|
26
28
|
# Expand curly braces in glob as fnmatch in ruby before 2.0 doesn't
|
27
29
|
# support them
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'image_optim'
|
4
5
|
require 'image_optim/true_false_nil'
|
@@ -42,7 +43,7 @@ class ImageOptim
|
|
42
43
|
# don't try to wrap if there is too little space for description
|
43
44
|
return text if wrapped_width < 20
|
44
45
|
|
45
|
-
wrapped = ''
|
46
|
+
wrapped = ''.dup
|
46
47
|
text.split("\n").each do |line|
|
47
48
|
if line.length <= columns
|
48
49
|
wrapped << line << "\n"
|
@@ -186,7 +187,7 @@ ImageOptim::Runner::OptionParser::DEFINE = proc do |op, options|
|
|
186
187
|
ImageOptim::Worker.klasses.each_with_index do |klass, i|
|
187
188
|
next if klass.option_definitions.empty?
|
188
189
|
|
189
|
-
op.separator nil unless i
|
190
|
+
op.separator nil unless i == 0
|
190
191
|
|
191
192
|
bin = klass.bin_sym
|
192
193
|
klass.option_definitions.each do |option_definition|
|
data/lib/image_optim/space.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class ImageOptim
|
2
4
|
# Present size in readable form as fixed length string
|
3
5
|
module Space
|
@@ -15,7 +17,7 @@ class ImageOptim
|
|
15
17
|
else
|
16
18
|
log_denominator = Math.log(size.abs) / Math.log(BASE)
|
17
19
|
degree = [log_denominator.floor, SIZE_SYMBOLS.length - 1].min
|
18
|
-
number_string = if degree
|
20
|
+
number_string = if degree == 0
|
19
21
|
size.to_s
|
20
22
|
else
|
21
23
|
denominator = BASE**degree
|
data/lib/image_optim/worker.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'image_optim/worker'
|
2
4
|
require 'exifr/jpeg'
|
3
5
|
|
@@ -7,7 +9,7 @@ class ImageOptim
|
|
7
9
|
#
|
8
10
|
# Jhead internally uses jpegtran which should be on path
|
9
11
|
class Jhead < Worker
|
10
|
-
ORIENTED = 2..8 # not top-left
|
12
|
+
ORIENTED = (2..8).freeze # not top-left
|
11
13
|
|
12
14
|
# Works on jpegs
|
13
15
|
def image_formats
|
@@ -1,13 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
3
4
|
|
4
5
|
require 'bundler/setup'
|
5
6
|
|
6
7
|
require 'image_optim'
|
7
8
|
|
8
9
|
README_FILE = File.expand_path('../../README.markdown', __FILE__)
|
9
|
-
BEGIN_MARKER = '<!---<worker-options>-->'
|
10
|
-
END_MARKER = '<!---</worker-options>-->'
|
10
|
+
BEGIN_MARKER = '<!---<worker-options>-->'
|
11
|
+
END_MARKER = '<!---</worker-options>-->'
|
11
12
|
|
12
13
|
def write_worker_options(io, klass)
|
13
14
|
io.puts "### #{klass.bin_sym}:"
|
data/script/worker_analysis
CHANGED
@@ -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 'bundler/setup'
|
5
6
|
|
@@ -12,7 +13,7 @@ require 'digest'
|
|
12
13
|
require 'erb'
|
13
14
|
require 'ostruct'
|
14
15
|
|
15
|
-
DIR = 'tmp'
|
16
|
+
DIR = 'tmp'
|
16
17
|
Pathname(DIR).mkpath
|
17
18
|
|
18
19
|
Array.class_eval do
|
@@ -459,7 +460,7 @@ class Analyser
|
|
459
460
|
end
|
460
461
|
|
461
462
|
def unused?
|
462
|
-
success_count
|
463
|
+
success_count == 0
|
463
464
|
end
|
464
465
|
end
|
465
466
|
|
@@ -1,20 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'image_optim/space'
|
3
5
|
|
4
6
|
describe ImageOptim::Space do
|
5
7
|
describe '.space' do
|
6
8
|
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
}.each do |
|
9
|
+
' ' => 0,
|
10
|
+
' 1B' => 1,
|
11
|
+
' 10B' => 10,
|
12
|
+
' 100B' => 100,
|
13
|
+
' 1000B' => 1_000,
|
14
|
+
' 9.8K' => 10_000,
|
15
|
+
' 97.7K' => 100_000,
|
16
|
+
'976.6K' => 1_000_000,
|
17
|
+
' 9.5M' => 10_000_000,
|
18
|
+
' 95.4M' => 100_000_000,
|
19
|
+
}.each do |space, size|
|
18
20
|
it "converts #{size} to #{space}" do
|
19
21
|
expect(described_class.space(size)).to eq(space)
|
20
22
|
end
|
data/spec/image_optim_spec.rb
CHANGED
data/spec/images/quant/generate
CHANGED
data/spec/spec_helper.rb
CHANGED
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.26.
|
4
|
+
version: 0.26.4
|
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: 2019-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fspath
|
@@ -262,8 +262,8 @@ licenses:
|
|
262
262
|
- MIT
|
263
263
|
metadata:
|
264
264
|
bug_tracker_uri: https://github.com/toy/image_optim/issues
|
265
|
-
changelog_uri: https://github.com/toy/image_optim/CHANGELOG.markdown
|
266
|
-
documentation_uri: https://www.rubydoc.info/gems/image_optim/0.26.
|
265
|
+
changelog_uri: https://github.com/toy/image_optim/blob/master/CHANGELOG.markdown
|
266
|
+
documentation_uri: https://www.rubydoc.info/gems/image_optim/0.26.4
|
267
267
|
source_code_uri: https://github.com/toy/image_optim
|
268
268
|
post_install_message: |
|
269
269
|
Rails image assets optimization is extracted into image_optim_rails gem
|
@@ -282,8 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
282
|
- !ruby/object:Gem::Version
|
283
283
|
version: '0'
|
284
284
|
requirements: []
|
285
|
-
|
286
|
-
rubygems_version: 2.7.7
|
285
|
+
rubygems_version: 3.0.3
|
287
286
|
signing_key:
|
288
287
|
specification_version: 4
|
289
288
|
summary: Command line tool and ruby interface to optimize (lossless compress, optionally
|