mini_magick 4.0.2 → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mini_magick might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4305ecb6d70854a5e0d8108ea344872224b2d81
4
- data.tar.gz: 71e89af4b6640415d8d0f883b2ecbd660235493b
3
+ metadata.gz: 515fa07b7af1626798ac776daeb976b9293bd543
4
+ data.tar.gz: dd464c7b331dbd803b5848395cb903afcc22e518
5
5
  SHA512:
6
- metadata.gz: 7be3875ffe3ea305e0c4a87fa41644094240f7b3c1675c7d5c552f866a7d7ffdb56fecbc962974756e9eb91326c27917bddb57b06121e90161b9ca4b25204d52
7
- data.tar.gz: 116882e54bd0f9734a5eae2535b16c816073be328dd494ccece1714c7d7db3f4840d1df456bea8baded535e13b09faaff528c3790c0737485019ffe1ba0b61ef
6
+ metadata.gz: 13ad7339e0cf4fc8ff5e330779c8efc15056852a315a93840dda26c2c37ddd165a47ff701e6c56b16c29204271a942663ef4486dbea63c7fc7ab72fbbf93aa27
7
+ data.tar.gz: cdedf7c55a1096ee90a7dc1450cd217cb7bef7db78316b1a8cdb8caf277745d20a86166cdd20b070f0c396aadfc6d2b342a828fa5fe229950968a8c903776052
@@ -45,6 +45,7 @@ module MiniMagick
45
45
  # @return [Logger]
46
46
  #
47
47
  attr_accessor :logger
48
+
48
49
  ##
49
50
  # If set to `true`, it will `identify` every newly created image, and raise
50
51
  # `MiniMagick::Invalid` if the image is not valid. Useful for validating
@@ -71,10 +72,20 @@ module MiniMagick
71
72
  #
72
73
  attr_accessor :whiny
73
74
 
75
+ ##
76
+ # Instructs MiniMagick how to execute the shell commands. Available
77
+ # APIs are "open3" (default) and "posix-spawn" (requires the "posix-spawn"
78
+ # gem).
79
+ #
80
+ # @return [String]
81
+ #
82
+ attr_accessor :shell_api
83
+
74
84
  def self.extended(base)
75
85
  base.validate_on_create = true
76
86
  base.validate_on_write = true
77
87
  base.whiny = true
88
+ base.shell_api = "open3"
78
89
  end
79
90
 
80
91
  ##
@@ -1,6 +1,4 @@
1
1
  require "mini_magick/logger"
2
-
3
- require "open3"
4
2
  require "timeout"
5
3
 
6
4
  module MiniMagick
@@ -35,14 +33,29 @@ module MiniMagick
35
33
  stdout, stderr, status =
36
34
  MiniMagick.logger.debug(command.join(" ")) do
37
35
  Timeout.timeout(MiniMagick.timeout) do
38
- Open3.capture3(*command)
36
+ send("execute_#{MiniMagick.shell_api.gsub("-", "_")}", *command)
39
37
  end
40
38
  end
41
39
 
42
40
  [stdout, stderr, status.exitstatus]
43
- rescue Errno::ENOENT
41
+ rescue Errno::ENOENT, IOError
44
42
  ["", "executable not found: \"#{command.first}\"", 127]
45
43
  end
46
44
 
45
+ private
46
+
47
+ def execute_open3(*command)
48
+ require "open3"
49
+ Open3.capture3(*command)
50
+ end
51
+
52
+ def execute_posix_spawn(*command)
53
+ require "posix-spawn"
54
+ pid, stdin, stdout, stderr = POSIX::Spawn.popen4(*command)
55
+ Process.waitpid(pid)
56
+
57
+ [stdout.read, stderr.read, $?]
58
+ end
59
+
47
60
  end
48
61
  end
@@ -9,7 +9,7 @@ module MiniMagick
9
9
  module VERSION
10
10
  MAJOR = 4
11
11
  MINOR = 0
12
- TINY = 2
12
+ TINY = 3
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_magick
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Johnson
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-01-09 00:00:00.000000000 Z
15
+ date: 2015-01-29 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake
@@ -42,6 +42,20 @@ dependencies:
42
42
  - - "~>"
43
43
  - !ruby/object:Gem::Version
44
44
  version: 3.1.0
45
+ - !ruby/object:Gem::Dependency
46
+ name: posix-spawn
47
+ requirement: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ type: :development
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
45
59
  description: Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick
46
60
  email:
47
61
  - probablycorey@gmail.com