paperclip-deflater 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: c6313717e77ff2dc91efad8514a9238f11f0baf8
4
- data.tar.gz: 97cfc26dfec85c0594c40433c84c3fbb0574c184
3
+ metadata.gz: 22a6909fe3c491a3b9c08065b60b32bc9f45d1bd
4
+ data.tar.gz: 6e0cab425ade14e89012f15f5827c981dee853b2
5
5
  SHA512:
6
- metadata.gz: e8f4bd0e6faa873e508fef935a4ddc755ea9bd364b11278dbbb1c378fd4de7e6e0888c54d7baba1d440f6c2db1c9b0134b354d88b1c7143bcaf44b9f3d0d3807
7
- data.tar.gz: f9b471131c9b31f72503c5ada1c382538cb5e31d092a2ef34193cb458b06e8897c4fc0e82cb58dc12ddb2506292152c10fda0b16f6e279ad825b650822a75067
6
+ metadata.gz: 19ee0b38ac427b61b74e0a81a0e4914ac2a2e818ffac9aa01f17c1fc59676ca2e2dc03728645e64f3d458f38cb95451c1dcc6c09d981e9882dae782e275350fd
7
+ data.tar.gz: 94959e51bbbcc698971aea0ae4e1dc26f5aa7dea70d4d49920d93cfa9dfcfaa7847d1bb4b1e40c3dc8024485dd53bd6a3f0fda0983e5ea69b86733c79ac56bb4
data/.travis.yml CHANGED
@@ -1,14 +1,23 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 1.9.3
5
- - 2.0.0
6
4
  - 2.1
5
+ - 2.2
6
+ - 2.3
7
+
8
+ install:
9
+ - "gem install bundler"
10
+ - "bundle install --jobs=3 --retry=3"
7
11
 
8
12
  env:
9
13
  -
10
- - PAPERCLIP_VERSION=3.0.0
14
+ - PAPERCLIP_VERSION=3.4.0
15
+ - PAPERCLIP_VERSION=3.5.0
11
16
  - PAPERCLIP_VERSION=4.0.0
17
+ - PAPERCLIP_VERSION=4.1.0
18
+ - PAPERCLIP_VERSION=4.2.0
19
+ - PAPERCLIP_VERSION=4.3.0
20
+ - PAPERCLIP_VERSION=5.0.0
12
21
 
13
22
  script: "bundle exec rake spec"
14
23
 
data/Gemfile CHANGED
@@ -1,5 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "paperclip", "~> #{ENV['PAPERCLIP_VERSION']}" if ENV['PAPERCLIP_VERSION'].to_s != ''
3
+ ruby_version = RUBY_VERSION
4
+ paperclip_version = ENV['PAPERCLIP_VERSION']
5
+
6
+ gem "paperclip", "~> #{paperclip_version}" if paperclip_version
7
+
8
+ gem "activesupport", "< 5.0.0" if ruby_version =~ /^2\.1\./
4
9
 
5
10
  gemspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -1,3 +1,4 @@
1
+ require 'active_support/core_ext/module/delegation'
1
2
  require 'paperclip'
2
3
  require 'paperclip/processors/plain'
3
4
  require 'paperclip/processors/deflater'
@@ -13,16 +13,11 @@ module Paperclip
13
13
  strategy = @gzip_options[:strategy]
14
14
 
15
15
  dst = create_tempfile
16
- begin
17
- gz = Zlib::GzipWriter.new(dst, level, strategy)
16
+ Zlib::GzipWriter.open(dst, level, strategy) do |gz|
18
17
  while chunk = @file.read(16 * 1024) do
19
18
  gz.write chunk
20
19
  end
21
- rescue ::Exception => e
22
- gz.close rescue nil
23
- raise e
24
20
  end
25
- gz.close
26
21
  @file.rewind
27
22
  dst.open
28
23
 
@@ -10,13 +10,14 @@ Gem::Specification.new do |gem|
10
10
  gem.summary = "Deflate Processor for Paperclip"
11
11
  gem.description = "Deflate Processor for Paperclip"
12
12
  gem.license = "MIT"
13
+ gem.required_ruby_version = '~> 2.1'
13
14
 
14
15
  gem.files = `git ls-files`.split("\n")
15
16
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
17
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
18
  gem.require_paths = ['lib']
18
19
 
19
- gem.add_dependency "paperclip", ">= 3.0"
20
+ gem.add_dependency "paperclip", ">= 3.4"
20
21
 
21
22
  gem.add_development_dependency "rake"
22
23
  gem.add_development_dependency "rspec", ">= 3.0"
@@ -15,50 +15,17 @@ describe Paperclip::Processors::Gzip do
15
15
  it "deflates the file" do
16
16
  dst = subject.make
17
17
  data = dst.read
18
- expect(data[0..3]).to eq(result1)
19
18
  # data[4..7] is modified time and it changes
20
- expect(data[8..-1]).to eq(result2)
19
+ expect(data.bytes).to match(result)
21
20
  end
22
21
  end
23
- let(:result1) { "\u001F\x8B\b\u0000" }
24
- let(:result2) { "\u0000\u0003+I-.\xE1\u0002\u0000\xC65\xB9;\u0005\u0000\u0000\u0000" }
22
+ let(:result) { [31, 139, 8, 0, anything, anything, anything, anything, 0, 3, 43, 73, 45, 46, 225, 2, 0, 198, 53, 185, 59, 5, 0, 0, 0] }
25
23
  include_examples "deflate"
26
24
  context "level gzip_options" do
27
- let(:result2) { "\u0002\u0003+I-.\xE1\u0002\u0000\xC65\xB9;\u0005\u0000\u0000\u0000" }
25
+ let(:result) { [31, 139, 8, 0, anything, anything, anything, anything, 2, 3, 43, 73, 45, 46, 225, 2, 0, 198, 53, 185, 59, 5, 0, 0, 0] }
28
26
  let(:options) { {gzip_options: {level: Zlib::BEST_COMPRESSION}} }
29
27
  include_examples "deflate"
30
28
  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
62
29
  end
63
30
  end
64
31
  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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daisuke Taniwaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2016-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paperclip
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '3.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -105,9 +105,9 @@ require_paths:
105
105
  - lib
106
106
  required_ruby_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '2.1'
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - ">="
@@ -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.5
118
+ rubygems_version: 2.5.1
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Deflate Processor for Paperclip
@@ -127,4 +127,3 @@ 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: