image_optimizer 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjE3ODlhNDA0YjBhZTdlODNlNGViZmYzNWZjZGU0NmU5NWE5NzJjZg==
5
+ data.tar.gz: !binary |-
6
+ MzM2NGEyZWNkNzdlNGRkOGQ0OTUyMzIzZDYyNWJmYWZiNjFkNWU1Mw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZjUwZTJlZDM1ZTg5NWFiMjk5ZTEzNjAxM2FlYTc0NDA5YjA5OTk5YzAzMjUz
10
+ OWYwZTNlNzEwNzU5MWUzNTA1NGUxM2I5ZDY1MWFhZjE0ODE2OTMyM2NlOGI2
11
+ MTUzYTc0NjkzM2YwMGUzNGFlZmEzNTI3ODYzMjcyMTg5OTFmYmI=
12
+ data.tar.gz: !binary |-
13
+ OTI0YjAwMmU2NDMzNWRlMDllNTczNDU5ZmUwZmUxOWYzMDQzMTc0YWNmZjI4
14
+ MzQ1N2NmZTE2N2Q1YWZjYTljNGQ5OTRkNjA5NjgxYjQxMmM5NmZmZTI1ZGVk
15
+ NDkxMWI3MTRhNzE3MTQ1MGE4MWVlYTVjZGRhM2IxOTQ4OGQ5ZjA=
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ �>��D������D��Ϻ`� F����g�Ym�r�[���{�2i��ʼno�U.Ðn8:?x}���7�ד����$|�Y�/c;H�m.�,/��H
2
+ kr�
data/README.md CHANGED
@@ -7,8 +7,11 @@ ree
7
7
 
8
8
  [![Build Status](https://secure.travis-ci.org/jtescher/image_optimizer.png)]
9
9
  (http://travis-ci.org/jtescher/image_optimizer)
10
- [![Dependency Status](https://gemnasium.com/jtescher/image_optimizer.png)](https://gemnasium.com/jtescher/image_optimizer)
10
+ [![Dependency Status](https://gemnasium.com/jtescher/image_optimizer.png)]
11
+ (https://gemnasium.com/jtescher/image_optimizer)
11
12
  [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/jtescher/image_optimizer)
13
+ [![Coverage Status](https://coveralls.io/repos/jtescher/image_optimizer/badge.png)]
14
+ (https://coveralls.io/r/jtescher/image_optimizer)
12
15
 
13
16
  ## Installation
14
17
 
@@ -0,0 +1,19 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDKjCCAhKgAwIBAgIBADANBgkqhkiG9w0BAQUFADA7MQ0wCwYDVQQDDAR5b3Vy
3
+ MRUwEwYKCZImiZPyLGQBGRYFZW1haWwxEzARBgoJkiaJk/IsZAEZFgNjb20wHhcN
4
+ MTMwNjE0MTkxMjQ4WhcNMTQwNjE0MTkxMjQ4WjA7MQ0wCwYDVQQDDAR5b3VyMRUw
5
+ EwYKCZImiZPyLGQBGRYFZW1haWwxEzARBgoJkiaJk/IsZAEZFgNjb20wggEiMA0G
6
+ CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9WjvJinWV7h9VeLlf4+yHxr1LF/8/
7
+ HHFCKYEs/ZrUJLrpmuUWUrkgpwIbV5FUvqkXoCcCvR2z65lAONZtdvg3ygBBXfl7
8
+ rQaNb/EMMzulmf26ztAtUP0Ipaz0pX/qlzDLkDkhXxUB1rUcxuZ2Rif0HsOtQO5d
9
+ MzQfREsYDtWMileLxcImCxtoE5r+tG2sbJ72gxP0QygAwL+mke//C0wPVCBC9zI2
10
+ fwhZmTD2dmyx0JW8C0YR+38kqtMldCcIQOPRH6ue/JAyfxaosYyNLK5zuUoW1MSR
11
+ l1PMWb3fEDXprbnku496f026FAgDn8TFsWDFw+KhHwTgIYASbgopYqWTAgMBAAGj
12
+ OTA3MAkGA1UdEwQCMAAwHQYDVR0OBBYEFM0KCQLMiOjnsL1TEu5IFFRCar4CMAsG
13
+ A1UdDwQEAwIEsDANBgkqhkiG9w0BAQUFAAOCAQEAscW33q8g0jLkAE8jZnIYjbO3
14
+ hhNpSyXO1JmJEbm5q9v5rDqhj8RTbdd100tFwGc2tIViR9edQ8Z72s9gEAdU6N4P
15
+ HpoYcNOqET8Fqs+o16lbk74on6Gv9S5LZjBQ1UuIqDbENuTzogxY25Yx5dIGHyIo
16
+ 7rzorf4e4KCNFw19BG5M3ijlMvciSGxIPbmJoaSa7m62sudGr3CrEpRgMZBvp1Ea
17
+ ILaPiI1PhVurfov2y0+YT0rbOrv4cWoBWsZ+aww2iSNC5XFhA/8xsK0BltYRF9nP
18
+ HA41UtDxrJkHL3N1z8gPMXSrFT41FR2wgk8+l14P+7g1UTPid2EIwft2xObFeA==
19
+ -----END CERTIFICATE-----
@@ -11,12 +11,17 @@ Gem::Specification.new do |gem|
11
11
  gem.description = %q{A simple image optimizer}
12
12
  gem.summary = %q{Simply optimize images via jpegoptim or OptiPNG}
13
13
  gem.homepage = "https://github.com/jtescher/image_optimizer"
14
+ gem.license = 'MIT'
15
+ gem.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $0 =~ /gem\z/
16
+ gem.cert_chain = ['gem-public_cert.pem']
14
17
 
15
18
  gem.files = `git ls-files`.split($/)
16
19
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
20
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
21
  gem.require_paths = ["lib"]
19
22
 
20
- gem.add_development_dependency "rspec"
21
- gem.add_development_dependency "rake"
23
+ gem.add_development_dependency "rspec", "~> 2.14.1"
24
+ gem.add_development_dependency "rake", "~> 10.1.0"
25
+ gem.add_development_dependency "simplecov", "~> 0.7.1"
26
+ gem.add_development_dependency "coveralls", "~> 0.6.7"
22
27
  end
@@ -27,12 +27,16 @@ class ImageOptimizer
27
27
  end
28
28
 
29
29
  def optimize_jpeg
30
- system "jpegoptim -f --strip-all #{path}"
30
+ system "#{jpeg_optimizer_bin} -f --strip-all #{path}"
31
31
  end
32
32
 
33
33
  def jpeg_optimizer_present?
34
- `which jpegoptim` && $?.success?
34
+ !jpeg_optimizer_bin.nil? && !jpeg_optimizer_bin.empty?
35
+ end
36
+
37
+ def jpeg_optimizer_bin
38
+ @jpeg_optimizer_bin ||= ENV['JPEGOPTIM_BIN'] || `which jpegoptim`.strip
35
39
  end
36
40
 
37
41
  end
38
- end
42
+ end
@@ -16,7 +16,7 @@ class ImageOptimizer
16
16
  end
17
17
  end
18
18
 
19
- private
19
+ private
20
20
 
21
21
  def png_format?
22
22
  ['png', 'gif'].include? extension(path)
@@ -27,12 +27,16 @@ class ImageOptimizer
27
27
  end
28
28
 
29
29
  def optimize_png
30
- system "optipng -o7 #{path}"
30
+ system "#{png_optimizer_bin} -o7 #{path}"
31
31
  end
32
32
 
33
33
  def png_optimizer_present?
34
- `which optipng` && $?.success?
34
+ !png_optimizer_bin.nil? && !png_optimizer_bin.empty?
35
+ end
36
+
37
+ def png_optimizer_bin
38
+ @png_optimzer_bin ||= ENV['OPTIPNG_BIN'] || `which optipng`.strip
35
39
  end
36
40
 
37
41
  end
38
- end
42
+ end
@@ -1,3 +1,3 @@
1
1
  class ImageOptimizer
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -6,15 +6,22 @@ describe ImageOptimizer::JPEGOptimizer do
6
6
  let(:jpeg_optimizer) { ImageOptimizer::JPEGOptimizer.new(file_path) }
7
7
 
8
8
  it 'optimizes the jpeg' do
9
- jpeg_optimizer.stub(:jpeg_optimizer_present? => true)
10
- jpeg_optimizer.should_receive(:system).with("jpegoptim -f --strip-all #{jpeg_optimizer.path}")
9
+ jpeg_optimizer.stub(:jpeg_optimizer_bin => '/usr/local/bin/jpegoptim')
10
+ jpeg_optimizer.should_receive(:system).with("/usr/local/bin/jpegoptim -f --strip-all #{file_path}")
11
11
  jpeg_optimizer.optimize
12
12
  end
13
13
 
14
14
  it 'warns the user if the jpeg optimizing utility is not installed' do
15
- jpeg_optimizer.stub(:jpeg_optimizer_present? => false)
15
+ jpeg_optimizer.stub(:jpeg_optimizer_bin => '')
16
16
  jpeg_optimizer.should_receive(:warn).with('Attempting to optimize a jpeg without jpegoptim installed. Skipping...')
17
17
  jpeg_optimizer.optimize
18
18
  end
19
+
20
+ it 'detects if there is an ENV variable path to jpegoptim' do
21
+ image_optim_jpegoptim_bin_path = '/app/vendor/bundle/ruby/2.0.0/gems/image_optim_bin-0.0.2/bin/jpegoptim'
22
+ ENV['JPEGOPTIM_BIN'] = image_optim_jpegoptim_bin_path
23
+ jpeg_optimizer.should_receive(:system).with("#{image_optim_jpegoptim_bin_path} -f --strip-all #{file_path}")
24
+ jpeg_optimizer.optimize
25
+ end
19
26
  end
20
- end
27
+ end
@@ -6,15 +6,22 @@ describe ImageOptimizer::PNGOptimizer do
6
6
  let(:png_optimizer) { ImageOptimizer::PNGOptimizer.new(file_path) }
7
7
 
8
8
  it 'optimizes the png' do
9
- png_optimizer.stub(:png_optimizer_present? => true)
10
- png_optimizer.should_receive(:system).with("optipng -o7 #{png_optimizer.path}")
9
+ png_optimizer.stub(:png_optimizer_bin => '/usr/local/bin/optipng')
10
+ png_optimizer.should_receive(:system).with("/usr/local/bin/optipng -o7 #{file_path}")
11
11
  png_optimizer.optimize
12
12
  end
13
13
 
14
14
  it 'warns the user if the png optimizing utility is not installed' do
15
- png_optimizer.stub(:png_optimizer_present? => false)
15
+ png_optimizer.stub(:png_optimizer_bin => '')
16
16
  png_optimizer.should_receive(:warn).with('Attempting to optimize a png without optipng installed. Skipping...')
17
17
  png_optimizer.optimize
18
18
  end
19
+
20
+ it 'detects if there is an ENV variable path to optipng' do
21
+ image_optim_optipng_bin_path = '/app/vendor/bundle/ruby/2.0.0/gems/image_optim_bin-0.0.2/bin/optipng'
22
+ ENV['OPTIPNG_BIN'] = image_optim_optipng_bin_path
23
+ png_optimizer.should_receive(:system).with("#{image_optim_optipng_bin_path} -o7 #{file_path}")
24
+ png_optimizer.optimize
25
+ end
19
26
  end
20
- end
27
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,7 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
4
+ SimpleCov.start
5
+
1
6
  $LOAD_PATH << File.expand_path('../../lib', __FILE__)
2
- require 'image_optimizer'
7
+ require 'image_optimizer'
metadata CHANGED
@@ -1,48 +1,98 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_optimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Julian Tescher
9
8
  autorequire:
10
9
  bindir: bin
11
- cert_chain: []
12
- date: 2013-03-25 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - !binary |-
12
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURLakNDQWhLZ0F3SUJB
13
+ Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREE3TVEwd0N3WURWUVFEREFSNWIz
14
+ VnkKTVJVd0V3WUtDWkltaVpQeUxHUUJHUllGWlcxaGFXd3hFekFSQmdvSmtp
15
+ YUprL0lzWkFFWkZnTmpiMjB3SGhjTgpNVE13TmpFME1Ua3hNalE0V2hjTk1U
16
+ UXdOakUwTVRreE1qUTRXakE3TVEwd0N3WURWUVFEREFSNWIzVnlNUlV3CkV3
17
+ WUtDWkltaVpQeUxHUUJHUllGWlcxaGFXd3hFekFSQmdvSmtpYUprL0lzWkFF
18
+ WkZnTmpiMjB3Z2dFaU1BMEcKQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dF
19
+ S0FvSUJBUUM5V2p2SmluV1Y3aDlWZUxsZjQreUh4cjFMRi84LwpISEZDS1lF
20
+ cy9aclVKTHJwbXVVV1Vya2dwd0liVjVGVXZxa1hvQ2NDdlIyejY1bEFPTlp0
21
+ ZHZnM3lnQkJYZmw3CnJRYU5iL0VNTXp1bG1mMjZ6dEF0VVAwSXBhejBwWC9x
22
+ bHpETGtEa2hYeFVCMXJVY3h1WjJSaWYwS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::Dependency
15
41
  name: rspec
16
42
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
43
  requirements:
19
- - - ! '>='
44
+ - - ~>
20
45
  - !ruby/object:Gem::Version
21
- version: '0'
46
+ version: 2.14.1
22
47
  type: :development
23
48
  prerelease: false
24
49
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
50
  requirements:
27
- - - ! '>='
51
+ - - ~>
28
52
  - !ruby/object:Gem::Version
29
- version: '0'
53
+ version: 2.14.1
30
54
  - !ruby/object:Gem::Dependency
31
55
  name: rake
32
56
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
57
  requirements:
35
- - - ! '>='
58
+ - - ~>
36
59
  - !ruby/object:Gem::Version
37
- version: '0'
60
+ version: 10.1.0
38
61
  type: :development
39
62
  prerelease: false
40
63
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
64
  requirements:
43
- - - ! '>='
65
+ - - ~>
44
66
  - !ruby/object:Gem::Version
45
- version: '0'
67
+ version: 10.1.0
68
+ - !ruby/object:Gem::Dependency
69
+ name: simplecov
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ version: 0.7.1
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: 0.7.1
82
+ - !ruby/object:Gem::Dependency
83
+ name: coveralls
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: 0.6.7
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: 0.6.7
46
96
  description: A simple image optimizer
47
97
  email:
48
98
  - jatescher@gmail.com
@@ -56,6 +106,7 @@ files:
56
106
  - LICENSE.txt
57
107
  - README.md
58
108
  - Rakefile
109
+ - gem-public_cert.pem
59
110
  - image_optimizer.gemspec
60
111
  - lib/image_optimizer.rb
61
112
  - lib/image_optimizer/jpeg_optimizer.rb
@@ -67,34 +118,28 @@ files:
67
118
  - spec/image_optimizer_spec.rb
68
119
  - spec/spec_helper.rb
69
120
  homepage: https://github.com/jtescher/image_optimizer
70
- licenses: []
121
+ licenses:
122
+ - MIT
123
+ metadata: {}
71
124
  post_install_message:
72
125
  rdoc_options: []
73
126
  require_paths:
74
127
  - lib
75
128
  required_ruby_version: !ruby/object:Gem::Requirement
76
- none: false
77
129
  requirements:
78
130
  - - ! '>='
79
131
  - !ruby/object:Gem::Version
80
132
  version: '0'
81
- segments:
82
- - 0
83
- hash: 3897120224469232633
84
133
  required_rubygems_version: !ruby/object:Gem::Requirement
85
- none: false
86
134
  requirements:
87
135
  - - ! '>='
88
136
  - !ruby/object:Gem::Version
89
137
  version: '0'
90
- segments:
91
- - 0
92
- hash: 3897120224469232633
93
138
  requirements: []
94
139
  rubyforge_project:
95
- rubygems_version: 1.8.25
140
+ rubygems_version: 2.0.3
96
141
  signing_key:
97
- specification_version: 3
142
+ specification_version: 4
98
143
  summary: Simply optimize images via jpegoptim or OptiPNG
99
144
  test_files:
100
145
  - spec/image_optimizer/jpeg_optimizer_spec.rb
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ 5��$�>��n�F(d�:3o�k ]Őܦ���g�J/�E�@��% ��