mmozjpeg 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +2 -4
- data/lib/mmozjpeg.rb +13 -2
- data/lib/mmozjpeg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98a64c3718ed021e374723d0e539c6527db4b8195a22e93f0a661cc455088069
|
4
|
+
data.tar.gz: b20ecb33aa884b188365acd934dc43cc46aa09e314e5932a2d9f1f931f5370a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94ac9aba37c7736c462ccbdd7e3402e5944d161482ad129f5be71f4adc364eb1ed674ce99ba1f3219cf079754d68ad1ee07acca24069c1af6fb8a2c1401e43ba
|
7
|
+
data.tar.gz: '0841f4904895983d3c0ee9c55beffc466ae9a85a5276f4e2240d6f6d71d841c778cb5ea4539ce6f6c4b31e1dbbb5210aae0a6d1f92f1da485befe21c3d7a1dfb'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mmozjpeg (0.
|
4
|
+
mmozjpeg (0.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -9,12 +9,12 @@ GEM
|
|
9
9
|
ast (2.4.2)
|
10
10
|
diff-lcs (1.4.4)
|
11
11
|
parallel (1.20.1)
|
12
|
-
parser (3.0.
|
12
|
+
parser (3.0.1.0)
|
13
13
|
ast (~> 2.4.1)
|
14
14
|
rainbow (3.0.0)
|
15
15
|
rake (12.3.3)
|
16
16
|
regexp_parser (2.1.1)
|
17
|
-
rexml (3.2.
|
17
|
+
rexml (3.2.5)
|
18
18
|
rspec (3.10.0)
|
19
19
|
rspec-core (~> 3.10.0)
|
20
20
|
rspec-expectations (~> 3.10.0)
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Mmozjpeg
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Wrapper library for mozjpeg.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -36,7 +34,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
36
34
|
|
37
35
|
## Contributing
|
38
36
|
|
39
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/masoo/mmozjpeg.
|
40
38
|
|
41
39
|
|
42
40
|
## License
|
data/lib/mmozjpeg.rb
CHANGED
@@ -7,6 +7,17 @@ module Mmozjpeg
|
|
7
7
|
|
8
8
|
class Cjpeg
|
9
9
|
class << self
|
10
|
+
# Whether cjpeg exists or not?
|
11
|
+
# @return [True] "cjpeg" exists,
|
12
|
+
# [False] "cjpeg" NOT exists
|
13
|
+
def supported?
|
14
|
+
args = ["cjpeg", "-version"]
|
15
|
+
_, s = Open3.capture2(*args)
|
16
|
+
s
|
17
|
+
rescue Errno::ENOENT
|
18
|
+
false
|
19
|
+
end
|
20
|
+
|
10
21
|
def optimize(infile:, outfile: nil, quality: nil, grayscale: nil, rgb: nil,
|
11
22
|
optimize: nil, progressive: nil, targa: nil, arithmetic: nil, dct: nil, icc: nil,
|
12
23
|
restart: nil, maxmemory: nil, memdst: nil, report: nil, verbose: nil, debug: nil,
|
@@ -17,8 +28,8 @@ module Mmozjpeg
|
|
17
28
|
parsed_quality = ["-quality", quality.split(",").map { |v| Integer(v) }.join(",")]
|
18
29
|
end
|
19
30
|
parsed_infile = Pathname(infile).cleanpath.to_s unless infile.nil?
|
20
|
-
|
21
|
-
Open3.capture2(*
|
31
|
+
args = [cjpeg, parsed_quality, parsed_infile].select { |v| !v.nil? }.flatten!
|
32
|
+
Open3.capture2(*args)
|
22
33
|
end
|
23
34
|
end
|
24
35
|
end
|
data/lib/mmozjpeg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmozjpeg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FUNABARA Masao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standardrb
|