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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f27527628f3ffc673095dd2cc35eed5b7321b5196508f13cb71ec4f0aa242ab4
4
- data.tar.gz: 1c7e6c7f76f2eb37f2982c852b7b21c27b2378192800af0830ce9b606189b6e1
3
+ metadata.gz: 98a64c3718ed021e374723d0e539c6527db4b8195a22e93f0a661cc455088069
4
+ data.tar.gz: b20ecb33aa884b188365acd934dc43cc46aa09e314e5932a2d9f1f931f5370a5
5
5
  SHA512:
6
- metadata.gz: 43500b353fca097c44aa5f4614ea11522312c220a6bc13b5d5c76d643f8e60dc1e4caaf468ff21befc48de7690f05b913f18bce8954e2e651f4c54fc7c2a7799
7
- data.tar.gz: f2cd3b50849d906ddbc5ae25f6d0fc3e3630b90da68f5ba36a4d4e9c63bc5951e796a11c3995507bcdb67724d331b1d18766cd64f679052bcf65b877c831e6fb
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.1.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.0.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.4)
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/mmozjpeg`. To experiment with that code, run `bin/console` for an interactive prompt.
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/[USERNAME]/mmozjpeg.
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
- arg = [cjpeg, parsed_quality, parsed_infile].select { |v| !v.nil? }.flatten!
21
- Open3.capture2(*arg)
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
@@ -1,3 +1,3 @@
1
1
  module Mmozjpeg
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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-03-28 00:00:00.000000000 Z
11
+ date: 2021-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standardrb