paperclip-compression 0.3.14 → 0.3.15

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: 6a5cf8c88323bef243c6b228ec1d80980311e8f1
4
- data.tar.gz: cbdf5ddc159ed2c1028bedc5092a2216f3c045ae
3
+ metadata.gz: b5e6025be6d4db41946555942cda449ee985a716
4
+ data.tar.gz: 36236659c1f48e5db3b2724c16d957ad73788eb6
5
5
  SHA512:
6
- metadata.gz: 5e343ed58bae8ff9e91993f6f3f1d00bc19afc232c6dee3bc6569f2b6fb55624de1b8ec9947b0b7837567eb201ddf30825945c62fe768caf99aeb7068191787f
7
- data.tar.gz: 59233dfcf82fe3d2d8a1ffb4b1d8956ef76b4c91eb94002c270783206cf4e6e558306169b3a24f7ea8d834d8bea127291f78d2d4abf8b5784cc43fe55ab6b467
6
+ metadata.gz: 2b9af3eb2cb407807c98eacc671aa544f1135174477f87cadaf9ac15d6c3d8eb04207844ea55854e139d971bbf368f92b681a9c9e6624e09bddb11fc77466bb3
7
+ data.tar.gz: 9c255db790ce26f068d50ea6f7ddaf5abec57d015aae2ff74cea986cd30e505d62514a6b33c62fff9bef65dec59688029620a5a17315b689c7947b8793cc9232
@@ -17,6 +17,23 @@ module PaperclipCompression
17
17
  new(file, first_processor, options).make
18
18
  end
19
19
 
20
+ def process_file
21
+ # Close output file so compressors which require exclusive file rights
22
+ # work.
23
+ @dst.close
24
+
25
+ # Execute the child-compressor classes implementation of how to compress
26
+ # the output
27
+ compress
28
+
29
+ # Re-open the output file so downstream paperclip-middleware may
30
+ # read/write/etc. without having to re-open the file.
31
+ @dst.open
32
+
33
+ # Return the destination file for downstream paperclip processors.
34
+ @dst
35
+ end
36
+
20
37
  protected
21
38
 
22
39
  def process_file?
@@ -49,6 +66,11 @@ module PaperclipCompression
49
66
 
50
67
  private
51
68
 
69
+ def compress
70
+ fail MustImplementInSubClassesException,
71
+ 'compress is overridden on a per compressor basis.'
72
+ end
73
+
52
74
  def first_processor?
53
75
  @first_processor
54
76
  end
@@ -73,4 +95,7 @@ module PaperclipCompression
73
95
  FileUtils.cp(@src_path, @dst_path)
74
96
  end
75
97
  end
98
+
99
+ # Informs developers when a method is intended to be defined in # sub-classes.
100
+ class MustImplementInSubClassesException < Exception; end
76
101
  end
@@ -24,12 +24,10 @@ module PaperclipCompression
24
24
  JPEGTRAN_DEFAULT_OPTS
25
25
  end
26
26
 
27
- def process_file
28
- # close dst file, so jpegtran can write it
29
- @dst.close
30
- Paperclip.run(command_path('jpegtran'), "#{@cli_opts} :src_path > :dst_path", src_path: @src_path, dst_path: @dst_path)
31
- @dst.open
32
- @dst
27
+ def compress
28
+ Paperclip.run(command_path('jpegtran'),
29
+ "#{@cli_opts} :src_path > :dst_path",
30
+ src_path: @src_path, dst_path: @dst_path)
33
31
  end
34
32
  end
35
33
  end
@@ -24,10 +24,10 @@ module PaperclipCompression
24
24
  OPTIPNG_DEFAULT_OPTS
25
25
  end
26
26
 
27
- def process_file
28
- Paperclip.run(command_path('optipng'), "#{@cli_opts} -clobber :src_path -out :dst_path", src_path: @src_path, dst_path: @dst_path)
29
- @dst
27
+ def compress
28
+ Paperclip.run(command_path('optipng'),
29
+ "#{@cli_opts} -clobber :src_path -out :dst_path",
30
+ src_path: @src_path, dst_path: @dst_path)
30
31
  end
31
-
32
32
  end
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-compression
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.14
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - "İ. Emre Kutlu"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paperclip