paperclip-compression 1.0.0 → 2.0.0

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
- SHA1:
3
- metadata.gz: 02a81c110df8dafcfc26ab4001e1cae33e0726d5
4
- data.tar.gz: 0c02d5b5ac7fb8b114a9bb63f9bc9be88faf52b5
2
+ SHA256:
3
+ metadata.gz: e9d963957eb471dbb25da7fd0a1dcf0c01e57da9eefc6d2581d6d7f2716c68f1
4
+ data.tar.gz: a04ab3ab329f5f793ea1b10cbb1c6e587c003274bf1c81b49d696096bbe787f3
5
5
  SHA512:
6
- metadata.gz: '089b87628388b3da6db1c48bd5feb72ecaef07e98689238ef405c685778df26461ab15600c8ee18a96de96f53f8b078f9bc92c9d67be8c851e16c95e3513a47e'
7
- data.tar.gz: 1da2739aa067ceca413c040f99f2e56a59ea02071949c09b2e49ef1b09ca7dc0da30ae6e8c22c27a80fc30b762dc7db56efb47d450db56a38eafd025031f2608
6
+ metadata.gz: c9b6a88b4521f370d6ca62c7a9b1d1916b21a114bf8ff892dbd5ba9e42ff8863484be20d94d727d57ee912850d06140cf88581e3512e0d7718c75a504e359db6
7
+ data.tar.gz: effaba8dc2079b942383ffcc0c057f3e68f716f92321f87fdceab2abc60a3c2a7efda8e14628a851d45496a9ab6d843f72c733275cb6315156ba9c410b7a7d8e
File without changes
File without changes
Binary file
Binary file
@@ -1,11 +1,15 @@
1
1
  module PaperclipCompression
2
+
3
+ ExitStatusError = defined?(Cocaine) ? Cocaine::ExitStatusError : Terrapin::ExitStatusError
4
+ CommandNotFoundError = defined?(Cocaine) ? Cocaine::CommandNotFoundError : Terrapin::CommandNotFoundError
5
+
2
6
  class Base
3
7
 
4
8
  def initialize(file, first_processor)
5
9
  @file = file
6
10
  current_extension = File.extname(file.path)
7
11
  @basename = File.basename(file.path, current_extension)
8
- @dst = Paperclip::TempfileFactory.new.generate("#{@basename}.png")
12
+ @dst = Paperclip::TempfileFactory.new.generate(@basename)
9
13
  @dst_path = File.expand_path(@dst.path)
10
14
  @src_path = File.expand_path(@file.path)
11
15
  @first_processor = first_processor
@@ -45,7 +49,7 @@ module PaperclipCompression
45
49
 
46
50
  def command_path(command)
47
51
  folder = if OS.osx?
48
- 'osx'
52
+ File.join('osx', catalina? ? '64bit' : '32bit')
49
53
  elsif OS.linux?
50
54
  File.join('linux', OS.bits.eql?(64) ? 'x64' : 'x86')
51
55
  elsif OS.windows?
@@ -69,6 +73,11 @@ module PaperclipCompression
69
73
  def copy_to_tempfile
70
74
  FileUtils.cp(@src_path, @dst_path)
71
75
  end
76
+
77
+ def catalina?
78
+ major = OS.host_os.match(/darwin(\d+)/)[1].to_i
79
+ major >= 19
80
+ end
72
81
  end
73
82
 
74
83
  # Informs developers when a method is intended to be defined in # sub-classes.
@@ -12,9 +12,9 @@ module PaperclipCompression
12
12
  def make
13
13
  begin
14
14
  @config.process_file? ? process_file : unprocessed_tempfile
15
- rescue Cocaine::ExitStatusError => e
15
+ rescue ExitStatusError
16
16
  raise Paperclip::Error, "JPEGTRAN : There was an error processing #{@basename}" if @config.whiny
17
- rescue Cocaine::CommandNotFoundError => e
17
+ rescue CommandNotFoundError
18
18
  raise Paperclip::Errors::CommandNotFoundError.new("Could not run 'jpegtran'. Please install jpegtran.")
19
19
  end
20
20
  end
@@ -12,9 +12,9 @@ module PaperclipCompression
12
12
  def make
13
13
  begin
14
14
  @config.process_file? ? process_file : unprocessed_tempfile
15
- rescue Cocaine::ExitStatusError => e
15
+ rescue ExitStatusError
16
16
  raise Paperclip::Error, "OPTIPNG : There was an error processing #{@basename}" if @config.whiny
17
- rescue Cocaine::CommandNotFoundError => e
17
+ rescue CommandNotFoundError
18
18
  raise Paperclip::Errors::CommandNotFoundError.new("Could not run 'optipng'. Please install optipng.")
19
19
  end
20
20
  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: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - İ. Emre Kutlu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-28 00:00:00.000000000 Z
11
+ date: 2021-05-28 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: 4.3.6
19
+ version: 5.2.1
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: 4.3.6
26
+ version: 5.2.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: os
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: 2.2.10
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: 2.2.10
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.1'
61
+ version: 12.3.3
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.1'
68
+ version: 12.3.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -104,8 +104,10 @@ files:
104
104
  - bin/linux/x64/optipng
105
105
  - bin/linux/x86/jpegtran
106
106
  - bin/linux/x86/optipng
107
- - bin/osx/jpegtran
108
- - bin/osx/optipng
107
+ - bin/osx/32bit/jpegtran
108
+ - bin/osx/32bit/optipng
109
+ - bin/osx/64bit/jpegtran
110
+ - bin/osx/64bit/optipng
109
111
  - bin/win32/jpegtran.exe
110
112
  - bin/win32/libjpeg-62.dll
111
113
  - bin/win32/optipng.exe
@@ -136,8 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
138
  - !ruby/object:Gem::Version
137
139
  version: '0'
138
140
  requirements: []
139
- rubyforge_project:
140
- rubygems_version: 2.6.13
141
+ rubygems_version: 3.0.3
141
142
  signing_key:
142
143
  specification_version: 4
143
144
  summary: Image compression for Paperclip