image_optim 0.26.3 → 0.26.4

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.appveyor.yml +9 -2
  3. data/.rubocop.yml +8 -2
  4. data/.travis.yml +9 -8
  5. data/CHANGELOG.markdown +4 -0
  6. data/Gemfile +5 -1
  7. data/LICENSE.txt +1 -1
  8. data/README.markdown +3 -1
  9. data/Vagrantfile +2 -0
  10. data/bin/image_optim +1 -0
  11. data/image_optim.gemspec +3 -3
  12. data/lib/image_optim.rb +2 -0
  13. data/lib/image_optim/bin_resolver.rb +2 -0
  14. data/lib/image_optim/bin_resolver/bin.rb +2 -0
  15. data/lib/image_optim/bin_resolver/comparable_condition.rb +2 -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 +2 -0
  19. data/lib/image_optim/cache_path.rb +2 -0
  20. data/lib/image_optim/cmd.rb +2 -0
  21. data/lib/image_optim/config.rb +3 -1
  22. data/lib/image_optim/configuration_error.rb +2 -0
  23. data/lib/image_optim/handler.rb +2 -0
  24. data/lib/image_optim/hash_helpers.rb +2 -0
  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 +2 -0
  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 +2 -0
  31. data/lib/image_optim/runner.rb +2 -0
  32. data/lib/image_optim/runner/glob_helpers.rb +3 -1
  33. data/lib/image_optim/runner/option_parser.rb +3 -2
  34. data/lib/image_optim/space.rb +3 -1
  35. data/lib/image_optim/true_false_nil.rb +2 -0
  36. data/lib/image_optim/worker.rb +1 -0
  37. data/lib/image_optim/worker/advpng.rb +2 -0
  38. data/lib/image_optim/worker/class_methods.rb +2 -0
  39. data/lib/image_optim/worker/gifsicle.rb +2 -0
  40. data/lib/image_optim/worker/jhead.rb +3 -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 +2 -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 +3 -2
  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 +2 -0
  54. data/spec/image_optim/cache_path_spec.rb +2 -0
  55. data/spec/image_optim/cache_spec.rb +2 -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 +2 -0
  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 +1 -0
  74. data/spec/spec_helper.rb +2 -0
  75. metadata +5 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec91f27b4e53d23a3516908c5714011fb47bbc251e95ef9952acc62948d123af
4
- data.tar.gz: 8b5a675e29709e03bf5ca0567ae742f8d4d7f3d7e90f89ac5ef8c1935c594555
3
+ metadata.gz: 00401e7aa20de4af81903c0c1ddac9d9cbb9eda7d17377f1fdf69dbe3280e346
4
+ data.tar.gz: 748fcdbedccbb2bb67082c1fd97b678a9aa1c383d1d91f9089a9a3f84ff1eb3e
5
5
  SHA512:
6
- metadata.gz: 847ee0b721a90d761ccfa4948c979e532dfd53d52f2e4c82e9df1e3301bcaba6a4217f98ae5cd5be2bcd7407339614710bd95ef381e9d422e778a4674ddeb81b
7
- data.tar.gz: 7f5b009a16df3c671ebc9a8c934cb499fd7ac47a0a464d33130ab1197ffa4b9c1f2767467226124dbd78281bcffd7864c058d8f3ff9fe7b58addfd3b6411ace7
6
+ metadata.gz: 33e4f3be57b23b3752b6992f50b6e8400c43f3273b404c9fe390107ccab85d947e4c69687f12d5e361df6f439568c7233eafa03bd3b7a6d329b068326b16476f
7
+ data.tar.gz: 19b8dd22e717e0cd06bf32b11fd4a048f6a1543299bb741980ec7c2e06c35b087b1f142570afb07e1471b33aeef5d041a77c4f2b3488e808a848b45673278ed7
@@ -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[-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
@@ -18,13 +18,13 @@ Layout/DotPosition:
18
18
  Layout/EndAlignment:
19
19
  EnforcedStyleAlignWith: variable
20
20
 
21
- Layout/IndentArray:
21
+ Layout/IndentFirstArrayElement:
22
22
  EnforcedStyle: consistent
23
23
 
24
24
  Layout/IndentAssignment:
25
25
  Enabled: false
26
26
 
27
- Layout/IndentHash:
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
 
@@ -11,17 +11,18 @@ rvm:
11
11
  - '2.0.0-p648'
12
12
  - '2.1.10'
13
13
  - '2.2.10'
14
- - '2.3.7'
15
- - '2.4.4'
16
- - '2.5.1'
17
- - 'jruby-9.0.5.0'
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.4'
33
+ rvm: '2.4.6'
33
34
  after_success: bundle exec codeclimate-test-reporter
34
35
  - env: RUBOCOP=✓
35
- rvm: '2.4.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.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:
@@ -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 RUBY_VERSION >= '2.0'
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
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2018 Ivan Kuchin
1
+ Copyright (c) 2012-2019 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
@@ -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-2018 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.
360
+ Copyright (c) 2012-2019 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,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'image_optim'
5
- s.version = '0.26.3'
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
@@ -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'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thread'
2
4
  require 'fspath'
3
5
  require 'image_optim/bin_resolver/error'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/bin_resolver/error'
2
4
  require 'image_optim/bin_resolver/simple_version'
3
5
  require 'image_optim/bin_resolver/comparable_condition'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageOptim
2
4
  class BinResolver
3
5
  # Allows to externalize conditions for an instance of Comparable to use in
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageOptim
2
4
  class BinResolver
3
5
  # Base error during bin resolving
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageOptim
2
4
  class BinResolver
3
5
  # Allows comparision of simple versions, only numbers separated by dots are
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'digest/sha1'
2
4
  require 'fspath'
3
5
  require 'image_optim/cache_path'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/path'
2
4
 
3
5
  class ImageOptim
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'English'
2
4
 
3
5
  class ImageOptim
@@ -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'.freeze
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageOptim
2
4
  class ConfigurationError < StandardError; end
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/path'
2
4
 
3
5
  class ImageOptim
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageOptim
2
4
  # Helper methods to manipulate Hash, mainly used in config
3
5
  module HashHelpers
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_size'
2
4
 
3
5
  class ImageOptim
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageOptim
2
4
  # Denote range of non negative integers for worker option
3
5
  class NonNegativeIntegerRange
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/path'
2
4
 
3
5
  class ImageOptim
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageOptim
2
4
  # Hold information about an option
3
5
  class OptionDefinition
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageOptim
2
4
  # Helper methods for options
3
5
  module OptionHelpers
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fspath'
2
4
  require 'image_optim/image_meta'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim'
2
4
  require 'image_optim/hash_helpers'
3
5
  require 'image_optim/runner/glob_helpers'
@@ -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.zero?
190
+ op.separator nil unless i == 0
190
191
 
191
192
  bin = klass.bin_sym
192
193
  klass.option_definitions.each do |option_definition|
@@ -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.zero?
20
+ number_string = if degree == 0
19
21
  size.to_s
20
22
  else
21
23
  denominator = BASE**degree
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageOptim
2
4
  # Denote ternary value (`true`/`false`/`nil`) for worker option
3
5
  class TrueFalseNil
@@ -1,4 +1,5 @@
1
1
  # encoding: UTF-8
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'image_optim/cmd'
4
5
  require 'image_optim/configuration_error'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
  require 'image_optim/option_helpers'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/bin_resolver'
2
4
  require 'image_optim/option_definition'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
 
3
5
  class ImageOptim
@@ -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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
  require 'image_optim/option_helpers'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
  require 'image_optim/option_helpers'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
 
3
5
  class ImageOptim
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
  require 'image_optim/option_helpers'
3
5
  require 'image_optim/true_false_nil'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
 
3
5
  class ImageOptim
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
  require 'image_optim/option_helpers'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
  require 'image_optim/option_helpers'
3
5
  require 'image_optim/non_negative_integer_range'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/worker'
2
4
 
3
5
  class ImageOptim
@@ -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>-->'.freeze
10
- END_MARKER = '<!---</worker-options>-->'.freeze
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}:"
@@ -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'.freeze
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.zero?
463
+ success_count == 0
463
464
  end
464
465
  end
465
466
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/bin_resolver/comparable_condition'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/bin_resolver/simple_version'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/bin_resolver'
3
5
  require 'image_optim/cmd'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/cache_path'
3
5
  require 'tempfile'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'fspath'
3
5
  require 'image_optim/cache'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/cmd'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/config'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/handler'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/hash_helpers'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/image_meta'
2
4
 
3
5
  describe ImageOptim::ImageMeta do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_optim/optimized_path'
2
4
 
3
5
  describe ImageOptim::OptimizedPath do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/option_definition'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/option_helpers'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/path'
3
5
  require 'tempfile'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/runner/glob_helpers'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/runner/option_parser'
3
5
 
@@ -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
- 0 => ' ',
8
- 1 => ' 1B',
9
- 10 => ' 10B',
10
- 100 => ' 100B',
11
- 1_000 => ' 1000B',
12
- 10_000 => ' 9.8K',
13
- 100_000 => ' 97.7K',
14
- 1_000_000 => '976.6K',
15
- 10_000_000 => ' 9.5M',
16
- 100_000_000 => ' 95.4M',
17
- }.each do |size, space|
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/worker/optipng'
3
5
  require 'image_optim/path'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/worker/pngquant'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim/worker'
3
5
  require 'image_optim/bin_resolver'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'image_optim'
3
5
  require 'image_optim/cmd'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  Dir.chdir(File.dirname(__FILE__))
4
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  Dir.chdir(File.dirname(__FILE__))
4
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if ENV['CODECLIMATE']
2
4
  require 'simplecov'
3
5
  SimpleCov.start
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.3
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: 2018-10-13 00:00:00.000000000 Z
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.3
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
- rubyforge_project: image_optim
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