sprockets-image_compressor 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/lib/sprockets/image_compressor/base.rb +2 -0
- data/lib/sprockets/image_compressor/png_compressor.rb +7 -1
- data/lib/sprockets/image_compressor/version.rb +1 -1
- data/spec/compressors/png_compressor_spec.rb +7 -0
- data/sprockets-image_compressor.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2a326a020efcd3e6690d8ea8aa955eedbe6d335
|
4
|
+
data.tar.gz: 722575c0af1fed23263fdc86f381ec899508d18b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 983994d84c2ba670d7290be7244ed236d714f9bd0e4d2f7df8ba8dae2201e70fccbbfe6244935fdae509f87a6dc3b461ccf47ca5eb21c051dd0eac5d68144736
|
7
|
+
data.tar.gz: e02729f65fdfc1ee12f523442140443b6543233c649a2caf4cf29d3034e59c1c1b5c4ebbe8ad67454f8c8680969b56cc4139680847553821388a9bdb977bea45
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -14,8 +14,8 @@ module Sprockets
|
|
14
14
|
out_file_path = in_file.path + ".optimized.png"
|
15
15
|
in_file.write content
|
16
16
|
in_file.close
|
17
|
+
|
17
18
|
out = `#{binary_path} #{in_file.path} #{out_file_path} 2>&1`
|
18
|
-
in_file.delete
|
19
19
|
|
20
20
|
File.open out_file_path, "rb" do |out_file|
|
21
21
|
compressed_png_data = out_file.read
|
@@ -23,6 +23,12 @@ module Sprockets
|
|
23
23
|
File.unlink out_file_path
|
24
24
|
end
|
25
25
|
compressed_png_data
|
26
|
+
|
27
|
+
rescue Errno::ENOENT => e
|
28
|
+
# error during compression so out_file not found
|
29
|
+
# return original content as a fallback
|
30
|
+
warn "sprockets-image_compressor: PNG compression failed... returning original."
|
31
|
+
content
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
@@ -37,4 +37,11 @@ describe Sprockets::ImageCompressor::PngCompressor do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
describe "#compress" do
|
42
|
+
it "returns uncompressable content as-is with a warning" do
|
43
|
+
compressor.should_receive(:warn)
|
44
|
+
compressor.compress("asdf").should == "asdf"
|
45
|
+
end
|
46
|
+
end
|
40
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets-image_compressor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Losslessly compress images in the Rails asset pipeline
|
56
70
|
email:
|
57
71
|
- micah@botandrose.com
|
@@ -109,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
123
|
version: '0'
|
110
124
|
requirements: []
|
111
125
|
rubyforge_project: sprockets-image_compressor
|
112
|
-
rubygems_version: 2.0
|
126
|
+
rubygems_version: 2.2.0
|
113
127
|
signing_key:
|
114
128
|
specification_version: 4
|
115
129
|
summary: Losslessly compress images in the Rails asset pipeline
|