paperclip-deflater 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/paperclip/processors/gzip.rb +5 -3
- data/spec/paperclip/processors/gzip_spec.rb +31 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dd150f55ee5cd1546e2fabb1f79de33123dbac6
|
4
|
+
data.tar.gz: 115cfeed1efbb5368788909402f7aeb33180739e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83dfc7c024c791b69b28620adfc8ef1bd05811d4061ad0a648ccf39d6f15e6c1b8ca3f86b582492db74c92b5bcec34d213e57f6132420ea32e5e504a9f3befd9
|
7
|
+
data.tar.gz: f52376327d04a63029eea8c72e0056ebbc405e68b8075460d2dcb5ed2810905f396f5cd1dd630d9cbafd1a98768f0b98a1a2243271e70eec2e31f88bcad4c711
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -15,10 +15,12 @@ module Paperclip
|
|
15
15
|
dst = create_tempfile
|
16
16
|
begin
|
17
17
|
gz = Zlib::GzipWriter.new(dst, level, strategy)
|
18
|
-
gz.write
|
19
|
-
|
20
|
-
gz.close
|
18
|
+
gz.write @file.read
|
19
|
+
rescue ::Exception => e
|
20
|
+
gz.close rescue nil
|
21
|
+
raise e
|
21
22
|
end
|
23
|
+
gz.close
|
22
24
|
@file.rewind
|
23
25
|
dst.open
|
24
26
|
|
@@ -28,6 +28,37 @@ describe Paperclip::Processors::Gzip do
|
|
28
28
|
let(:options) { {gzip_options: {level: Zlib::BEST_COMPRESSION}} }
|
29
29
|
include_examples "deflate"
|
30
30
|
end
|
31
|
+
context "gzip failed to close" do
|
32
|
+
before do
|
33
|
+
@error = RuntimeError.new "error"
|
34
|
+
@writer = {}
|
35
|
+
allow(Zlib::GzipWriter).to receive(:new).and_return @writer
|
36
|
+
allow(@writer).to receive(:write).and_return nil
|
37
|
+
end
|
38
|
+
|
39
|
+
it "raises an error to close" do
|
40
|
+
expect(@writer).to receive(:close).and_raise @error
|
41
|
+
expect {
|
42
|
+
subject.make
|
43
|
+
}.to raise_error @error
|
44
|
+
end
|
45
|
+
end
|
46
|
+
context "gzip failed to write" do
|
47
|
+
before do
|
48
|
+
@error1 = RuntimeError.new "error1"
|
49
|
+
@error2 = RuntimeError.new "error2"
|
50
|
+
@writer = {}
|
51
|
+
allow(Zlib::GzipWriter).to receive(:new).and_return @writer
|
52
|
+
allow(@writer).to receive(:write).and_raise @error1
|
53
|
+
end
|
54
|
+
|
55
|
+
it "does not raise an error to close" do
|
56
|
+
expect(@writer).to receive(:close).and_raise @error2
|
57
|
+
expect {
|
58
|
+
subject.make
|
59
|
+
}.to raise_error @error1
|
60
|
+
end
|
61
|
+
end
|
31
62
|
end
|
32
63
|
end
|
33
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-deflater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daisuke Taniwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paperclip
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.4.
|
118
|
+
rubygems_version: 2.4.5
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Deflate Processor for Paperclip
|
@@ -127,3 +127,4 @@ test_files:
|
|
127
127
|
- spec/paperclip/processors/plain_spec.rb
|
128
128
|
- spec/spec_helper.rb
|
129
129
|
- spec/support/files.rb
|
130
|
+
has_rdoc:
|