image_optim 0.24.2 → 0.24.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MTQ3MTQ0OTM1ODJjOWQ1MDUwZDVmZTc1NGFmMDY4ODMzYzRmMGY3Zg==
5
- data.tar.gz: !binary |-
6
- NDU1NzhlYTg5NWViNzhhNDcwYzY1NzJlMGM1NzkwZTAzY2Y1M2IwNQ==
2
+ SHA1:
3
+ metadata.gz: 76bd58bfc7147d344de3180b31eaf30572fdb940
4
+ data.tar.gz: 477c8fb36bab5dcd8abc0fa9714404453e19fc7a
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZTUzMjk0ZGY1YjBjNmNiMmRiZWFiMjMzZjkwZDIwZGI4OWUyNDg4NjdjYWY1
10
- NGE4MjA1ZjFkMTFiMjdhOGE0NDIzZWI3OTRiNjk0YjA1NTRiYmVjZTBlNzFi
11
- ZjIxOWE4MDEwMTEyZGQxMjc5ZGFjZmQ4ZDdmMzBjMmVmNDkyMWI=
12
- data.tar.gz: !binary |-
13
- NGM5YjNjYzUzODVhYjY4ZjE5NjNhOGVmOTU3Y2Y4ZjU5NDI0MTg0Y2E3Mjk2
14
- NzViOGU3YjAxNjQyZGM5NGMyZTU3MmZlOTk1ZDE3Y2E0MTIxNjgyMTdhZDEy
15
- ZGZkMjcyMjExYWIxZjNiYzM3MzczOTllNTU0MjI3MGFmOTEwNzU=
6
+ metadata.gz: c4dbea61152a4b7ae6fb1dd97f2019dd474073863009b7af55000f9e7657e691c43dbc7e11917f477f674536aba80d4e7d9dff588c0026f5e516a215941a5f6c
7
+ data.tar.gz: f120068d0b452500630247676dedbe475b8299127d3aa08e479308fea2731b7f3b06b63291858482d4f90ded3f9137975e11b9e66aa5abb0b067dd53e167e348
@@ -5,9 +5,7 @@ install:
5
5
  - ruby --version
6
6
  - bundle package --all
7
7
 
8
- - ps: git --work-tree=tmp\bin checkout origin/windows-binaries --
9
- advpng.exe gifsicle.exe jhead.exe jpeg-recompress.exe jpegoptim.exe
10
- jpegtran.exe optipng.exe pngcrush.exe pngout.exe pngquant.exe
8
+ - ps: git --work-tree=tmp\bin checkout origin/windows-binaries -- '*.exe'
11
9
 
12
10
  - ps: | # svgo
13
11
  npm install -g svgo
data/.gitignore CHANGED
@@ -7,7 +7,7 @@
7
7
  /coverage/
8
8
  /vendor/
9
9
 
10
- Gemfile.lock
10
+ /Gemfile.lock
11
11
  Makefile
12
12
  *.o
13
13
  *.bundle
@@ -3,6 +3,13 @@ AllCops:
3
3
  - '*.gemspec'
4
4
  - 'vendor/**/*'
5
5
 
6
+ Bundler/OrderedGems:
7
+ Enabled: false
8
+
9
+ Lint/AmbiguousBlockAssociation:
10
+ Exclude:
11
+ - spec/**/*_spec.rb
12
+
6
13
  Lint/EndAlignment:
7
14
  EnforcedStyleAlignWith: variable
8
15
 
@@ -70,6 +77,9 @@ Style/IndentAssignment:
70
77
  Style/IndentHash:
71
78
  EnforcedStyle: consistent
72
79
 
80
+ Style/IndentHeredoc:
81
+ Enabled: false
82
+
73
83
  Style/ParallelAssignment:
74
84
  Enabled: false
75
85
 
@@ -95,3 +105,6 @@ Style/TrailingCommaInArguments:
95
105
 
96
106
  Style/TrailingCommaInLiteral:
97
107
  EnforcedStyleForMultiline: comma
108
+
109
+ Style/SymbolArray:
110
+ Enabled: false
@@ -3,48 +3,39 @@ language: ruby
3
3
  cache:
4
4
  bundler: true
5
5
  directories:
6
- - $(npm root)
7
- - ~/bin
6
+ - $(npm root)
7
+ - ~/bin
8
8
  rvm:
9
- - '1.8'
10
- - '1.9'
11
- - '2.0'
12
- - '2.1'
13
- - '2.2'
14
- - jruby-19mode
15
- - ree
16
- script: |
17
- (
18
- set -ex
19
- if [ -n "$RUBOCOP" ]; then
20
- bundle exec rubocop
21
- else
22
- bundle exec image_optim --info
23
- bundle exec rspec
24
- fi
25
- )
26
- before_install: |
27
- (
28
- set -ex
29
- if [ -z "$RUBOCOP" ]; then
30
- command -v svgo || npm install svgo
31
- command -v pngout || {
32
- mkdir -p ~/bin
33
- 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'
34
- }
35
- fi
36
- )
37
- after_success:
38
- - if [ -n "$CODECLIMATE" ]; then bundle exec codeclimate-test-reporter; fi
9
+ - '1.8.7-p371'
10
+ - '1.9.3-p551'
11
+ - '2.0.0-p648'
12
+ - '2.1.10'
13
+ - '2.2.7'
14
+ - '2.3.4'
15
+ - '2.4.1'
16
+ - 'jruby-1.7.26'
17
+ - 'jruby-9.0.5.0'
18
+ - 'jruby-9.1.5.0'
19
+ script:
20
+ - bundle exec image_optim --info
21
+ - bundle exec rspec
22
+ before_install:
23
+ - mkdir -p ~/bin
24
+ - command -v svgo || npm install svgo
25
+ - 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'
39
26
  matrix:
40
- fast_finish: true
41
27
  include:
42
- - env: CODECLIMATE=true
43
- rvm: '2'
44
- - env: RUBOCOP=true
45
- rvm: '2'
46
- allow_failures:
47
- - rvm: jruby-19mode
28
+ - env: CODECLIMATE=✓
29
+ rvm: '2.4.1'
30
+ after_success: bundle exec codeclimate-test-reporter
31
+ - env: RUBOCOP=✓
32
+ rvm: '2.4.1'
33
+ script: bundle exec rubocop
34
+ before_install:
35
+ - env: CHECK_RUBIES=✓
36
+ rvm: '2.4.1'
37
+ script: bundle exec travis_check_rubies
38
+ before_install:
48
39
  addons:
49
40
  code_climate:
50
41
  repo_token:
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## v0.24.3 (2017-05-04)
6
+
7
+ * Set mode of cache files to `0666 & ~umask`, related to [#147](https://github.com/toy/image_optim/issues/147) [@toy](https://github.com/toy)
8
+
5
9
  ## v0.24.2 (2017-02-18)
6
10
 
7
11
  * Describe `nice` level option [#140](https://github.com/toy/image_optim/issues/140) [@toy](https://github.com/toy)
data/Gemfile CHANGED
@@ -9,3 +9,7 @@ if ENV['CODECLIMATE']
9
9
  gem 'codeclimate-test-reporter'
10
10
  end
11
11
  end
12
+
13
+ if RUBY_VERSION >= '2.0'
14
+ gem 'travis_check_rubies', '~> 0.2'
15
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'image_optim'
5
- s.version = '0.24.2'
5
+ s.version = '0.24.3'
6
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
7
  s.homepage = "http://github.com/toy/#{s.name}"
8
8
  s.authors = ['Ivan Kuchin']
@@ -34,6 +34,7 @@ class ImageOptim
34
34
  if optimized
35
35
  tmp = FSPath.temp_file_path(digest, @cache_dir)
36
36
  FileUtils.mv(optimized, tmp)
37
+ tmp.chmod(0o666 & ~File.umask)
37
38
  tmp.rename(cached)
38
39
  cached_path = CachePath.convert(cached)
39
40
 
@@ -51,9 +51,7 @@ describe ImageOptim::CachePath do
51
51
 
52
52
  it 'changes inode of destination' do
53
53
  skip 'inodes are not supported' unless inodes_supported?
54
- expect do
55
- src.replace(dst)
56
- end.to change{ dst.stat.ino }
54
+ expect{ src.replace(dst) }.to change{ dst.stat.ino }
57
55
  end
58
56
  end
59
57
  end
@@ -69,9 +69,12 @@ describe ImageOptim::Cache do
69
69
  cached_s = cached.to_s
70
70
  expect(FileTest).to receive(:file?).with(cached_s).and_return(false)
71
71
  expect(FileTest).not_to receive(:size?).with(cached_s)
72
- expect(FileUtils).to receive(:mv).with(anything, tmp_file)
72
+ expect(FileUtils).to receive(:mv).with(optimized, tmp_file)
73
73
  expect(tmp_file).to receive(:rename).with(cached)
74
74
 
75
+ allow(File).to receive(:umask).and_return(0o024)
76
+ expect(tmp_file).to receive(:chmod).with(0o642)
77
+
75
78
  expect(cache.fetch(original){ optimized }).to eq(cached)
76
79
  end
77
80
 
@@ -79,10 +82,10 @@ describe ImageOptim::Cache do
79
82
  cached_s = cached.to_s
80
83
  expect(FileTest).to receive(:file?).with(cached_s).and_return(false)
81
84
  expect(FileTest).not_to receive(:size?).with(cached_s)
82
- expect(FileUtils).to receive(:mv).with(anything, tmp_file)
83
- expect(tmp_file).to receive(:rename).with(cached)
85
+ expect(FileUtils).not_to receive(:mv)
86
+ expect(FileUtils).to receive(:touch).with(cached)
84
87
 
85
- expect(cache.fetch(original){ optimized }).to eq(cached)
88
+ expect(cache.fetch(original){ nil }).to eq(nil)
86
89
  end
87
90
  end
88
91
  end
@@ -106,7 +109,7 @@ describe ImageOptim::Cache do
106
109
  expect(FileUtils).not_to receive(:mv)
107
110
  expect(File).not_to receive(:rename)
108
111
 
109
- expect(cache.fetch(original){}).to eq(nil)
112
+ expect(cache.fetch(original){ nil }).to eq(nil)
110
113
  end
111
114
  end
112
115
  end
@@ -68,7 +68,11 @@ describe ImageOptim::OptionDefinition do
68
68
  end
69
69
 
70
70
  context 'when proc given' do
71
- subject{ described_class.new('abc', :def, 'desc', &:inspect) }
71
+ subject do
72
+ # not using &:inspect due to ruby Bug #13087
73
+ # to_s is just to calm rubocop
74
+ described_class.new('abc', :def, 'desc'){ |o| o.inspect.to_s }
75
+ end
72
76
 
73
77
  context 'when option not provided' do
74
78
  it 'returns default passed through proc' do
@@ -88,6 +92,30 @@ describe ImageOptim::OptionDefinition do
88
92
  end
89
93
  end
90
94
  end
95
+
96
+ context 'when proc with arity 2 given' do
97
+ subject do
98
+ described_class.new('abc', :def, 'desc'){ |a, b| [a.inspect, b] }
99
+ end
100
+
101
+ context 'when option not provided' do
102
+ it 'returns default passed through proc' do
103
+ expect(subject.value(nil, {})).to eq([':def', subject])
104
+ end
105
+ end
106
+
107
+ context 'when option is nil' do
108
+ it 'returns nil passed through proc' do
109
+ expect(subject.value(nil, :abc => nil)).to eq(['nil', subject])
110
+ end
111
+ end
112
+
113
+ context 'when option is set' do
114
+ it 'returns value passed through proc' do
115
+ expect(subject.value(nil, :abc => 123)).to eq(['123', subject])
116
+ end
117
+ end
118
+ end
91
119
  end
92
120
 
93
121
  describe '#default_description' do
@@ -97,9 +97,7 @@ describe ImageOptim::Path do
97
97
 
98
98
  it 'changes inode of destination' do
99
99
  skip 'inodes are not supported' unless inodes_supported?
100
- expect do
101
- src.replace(dst)
102
- end.to change{ dst.stat.ino }
100
+ expect{ src.replace(dst) }.to change{ dst.stat.ino }
103
101
  end
104
102
  end
105
103
  end
@@ -204,7 +204,7 @@ describe ImageOptim do
204
204
  image_optim = ImageOptim.new
205
205
  results = test_images.map do |src|
206
206
  dst = double
207
- expect(image_optim).to receive(method).with(src).and_return(dst)
207
+ allow(image_optim).to receive(method).with(src).and_return(dst)
208
208
  [src, dst]
209
209
  end
210
210
  expect(image_optim.send(list_method, test_images)).to eq(results)
@@ -217,7 +217,7 @@ describe ImageOptim do
217
217
  image_optim = ImageOptim.new
218
218
  results = test_images.map do |src|
219
219
  dst = double
220
- expect(image_optim).to receive(method).with(src).and_return(dst)
220
+ allow(image_optim).to receive(method).with(src).and_return(dst)
221
221
  [src, dst, :test]
222
222
  end
223
223
  expect(image_optim.send(list_method, test_images) do |src, dst|
metadata CHANGED
@@ -1,131 +1,145 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_optim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.2
4
+ version: 0.24.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kuchin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-18 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fspath
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: image_size
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: exifr
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.2'
48
- - - ! '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: 1.2.2
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - ~>
55
+ - - "~>"
56
56
  - !ruby/object:Gem::Version
57
57
  version: '1.2'
58
- - - ! '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 1.2.2
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: progress
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ~>
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '3.0'
68
- - - ! '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: 3.0.1
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ~>
75
+ - - "~>"
76
76
  - !ruby/object:Gem::Version
77
77
  version: '3.0'
78
- - - ! '>='
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: 3.0.1
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: in_threads
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - ~>
85
+ - - "~>"
86
86
  - !ruby/object:Gem::Version
87
87
  version: '1.3'
88
88
  type: :runtime
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - ~>
92
+ - - "~>"
93
93
  - !ruby/object:Gem::Version
94
94
  version: '1.3'
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: image_optim_pack
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ~>
99
+ - - "~>"
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0.2'
102
- - - ! '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: 0.2.2
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ~>
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0.2'
112
- - - ! '>='
112
+ - - ">="
113
113
  - !ruby/object:Gem::Version
114
114
  version: 0.2.2
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: rspec
117
117
  requirement: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - ~>
119
+ - - "~>"
120
120
  - !ruby/object:Gem::Version
121
121
  version: '3.0'
122
122
  type: :development
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - ~>
126
+ - - "~>"
127
127
  - !ruby/object:Gem::Version
128
128
  version: '3.0'
129
+ - !ruby/object:Gem::Dependency
130
+ name: rubocop
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: '0.47'
136
+ type: :development
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - "~>"
141
+ - !ruby/object:Gem::Version
142
+ version: '0.47'
129
143
  description:
130
144
  email:
131
145
  executables:
@@ -133,10 +147,10 @@ executables:
133
147
  extensions: []
134
148
  extra_rdoc_files: []
135
149
  files:
136
- - .appveyor.yml
137
- - .gitignore
138
- - .rubocop.yml
139
- - .travis.yml
150
+ - ".appveyor.yml"
151
+ - ".gitignore"
152
+ - ".rubocop.yml"
153
+ - ".travis.yml"
140
154
  - CHANGELOG.markdown
141
155
  - CONTRIBUTING.markdown
142
156
  - Gemfile
@@ -240,29 +254,25 @@ homepage: http://github.com/toy/image_optim
240
254
  licenses:
241
255
  - MIT
242
256
  metadata: {}
243
- post_install_message: ! 'Rails image assets optimization is extracted into image_optim_rails
244
- gem
245
-
246
- You can safely remove `config.assets.image_optim = false` if you are not going to
247
- use that gem
248
-
249
- '
257
+ post_install_message: |
258
+ Rails image assets optimization is extracted into image_optim_rails gem
259
+ You can safely remove `config.assets.image_optim = false` if you are not going to use that gem
250
260
  rdoc_options: []
251
261
  require_paths:
252
262
  - lib
253
263
  required_ruby_version: !ruby/object:Gem::Requirement
254
264
  requirements:
255
- - - ! '>='
265
+ - - ">="
256
266
  - !ruby/object:Gem::Version
257
267
  version: '0'
258
268
  required_rubygems_version: !ruby/object:Gem::Requirement
259
269
  requirements:
260
- - - ! '>='
270
+ - - ">="
261
271
  - !ruby/object:Gem::Version
262
272
  version: '0'
263
273
  requirements: []
264
274
  rubyforge_project: image_optim
265
- rubygems_version: 2.6.4
275
+ rubygems_version: 2.6.11
266
276
  signing_key:
267
277
  specification_version: 4
268
278
  summary: Optimize (lossless compress, optionally lossy) images (jpeg, png, gif, svg)
@@ -317,4 +327,3 @@ test_files:
317
327
  - spec/images/transparency2.png
318
328
  - spec/images/vergroessert.jpg
319
329
  - spec/spec_helper.rb
320
- has_rdoc: