png_quantizator 0.1.0 → 0.1.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d7dc995617bb0d74176532d50d16c6c1c1b94a8b
4
+ data.tar.gz: d93546109649a9f7047e55fdc666c96d27d2048f
5
+ SHA512:
6
+ metadata.gz: 5b075ad74169d8cd4ab45b5dd4f858275c036312512c037588c0f07684d14ec4620aed564e41e536be7549a40e4f582e8488a0465c5e5ec084143e260e6d6542
7
+ data.tar.gz: 6a9aa1b6dfd5c25f9687c690b32e34093add1309981ec4311654929248f56a349b27009ec54a6477dce05b3c24100845b582a4fe575c9b3c9fad08537b347ca8
@@ -14,9 +14,9 @@ module PngQuantizator
14
14
  @file_path = file_path
15
15
  end
16
16
 
17
- def quantize!
17
+ def quantize!(colors = 256)
18
18
  Tempfile.open([SecureRandom.hex(16), ".png"]) do |temp_path|
19
- res = quantize_to(temp_path)
19
+ res = quantize_to(temp_path, colors)
20
20
  FileUtils.cp(temp_path, @file_path)
21
21
 
22
22
  temp_path.close
@@ -25,10 +25,10 @@ module PngQuantizator
25
25
  end
26
26
  end
27
27
 
28
- def quantize_to(destination_path)
29
- raise PngQuantError, "pngquant not found" unless which("pngquant")
28
+ def quantize_to(destination_path, colors = 256)
29
+ raise PngQuantError, "pngquant not found in PATH=#{ENV['PATH']}" unless which("pngquant")
30
30
 
31
- exit_code, err_msg = Open3.popen3("pngquant 256") do |stdin, stdout, stderr, wait_thr|
31
+ exit_code, err_msg = Open3.popen3("pngquant #{colors}") do |stdin, stdout, stderr, wait_thr|
32
32
  stdin.write(File.read(@file_path))
33
33
 
34
34
  File.open(destination_path, "w") do |f|
@@ -1,3 +1,3 @@
1
1
  module PngQuantizator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: png_quantizator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Roger Campos
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-04 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: Small wrapper around pngquant
@@ -34,8 +31,8 @@ executables: []
34
31
  extensions: []
35
32
  extra_rdoc_files: []
36
33
  files:
37
- - .gitignore
38
- - .travis.yml
34
+ - ".gitignore"
35
+ - ".travis.yml"
39
36
  - Gemfile
40
37
  - LICENSE.txt
41
38
  - README.md
@@ -48,33 +45,26 @@ files:
48
45
  - spec/png_quantizator/image_spec.rb
49
46
  homepage: ''
50
47
  licenses: []
48
+ metadata: {}
51
49
  post_install_message:
52
50
  rdoc_options: []
53
51
  require_paths:
54
52
  - lib
55
53
  required_ruby_version: !ruby/object:Gem::Requirement
56
- none: false
57
54
  requirements:
58
- - - ! '>='
55
+ - - ">="
59
56
  - !ruby/object:Gem::Version
60
57
  version: '0'
61
- segments:
62
- - 0
63
- hash: -2814703
64
58
  required_rubygems_version: !ruby/object:Gem::Requirement
65
- none: false
66
59
  requirements:
67
- - - ! '>='
60
+ - - ">="
68
61
  - !ruby/object:Gem::Version
69
62
  version: '0'
70
- segments:
71
- - 0
72
- hash: -2814703
73
63
  requirements: []
74
64
  rubyforge_project:
75
- rubygems_version: 1.8.24
65
+ rubygems_version: 2.2.2
76
66
  signing_key:
77
- specification_version: 3
67
+ specification_version: 4
78
68
  summary: Small wrapper around pngquant
79
69
  test_files:
80
70
  - spec/data/sample.jpg