mini_magick 4.9.3 → 4.9.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
  SHA256:
3
- metadata.gz: 64f0a10a42282ac51172d0bcf2309a1cd4e8d6b8704ff516415b9e5b5685ada5
4
- data.tar.gz: f09955027bb2cf88fb2f8158e1378d83e4999201b717be3ebf362966b6770db8
3
+ metadata.gz: 3ab4ce03957b9a0f941f9bd2c34a5dcab63faffac5143eb6e7c90d7d860b57c5
4
+ data.tar.gz: 7bd78f0c862f1ca72b34e3c6fc4d14297adfa9dd6bc36218a35ef68c235320b5
5
5
  SHA512:
6
- metadata.gz: 108822b3868f6a43a92c711950d81ed6cbb63aacfc9646a7b19625fcaf666b247af8f7729949f16d3e66d16890d5f887b458bb2a0ff66a106a67c81ac61175cf
7
- data.tar.gz: 76d7a867d165ae823e8386a396b554605dcb4c4bb9d34a2b7e071bfa46e3bfb0b8bbb3729bc9b69676edd64913c9acd2ff1ced4d824593a7d199a3f152707665
6
+ metadata.gz: 16c4bfa3744a2bea117bff0118afcbf89fac2f3d9e92c5c8af2b095f6c1381c1d000bede5086ccffd72ecca8152845cde11a5ff762186bd90793ee5d83e03a77
7
+ data.tar.gz: fe593ad2a7bfd4b6f2d9892533fd5347046e7dfb6cfd8e3bc6049cb1ae7686f5af60c23f33254175bca4728a58bdeeab2b9bfb873ebd94c46f14e68e086f002f
@@ -11,16 +11,12 @@ module MiniMagick
11
11
  # @return [Symbol] `:imagemagick`, `:imagemagick7`, or `:graphicsmagick`
12
12
  #
13
13
  attr_accessor :cli
14
- # @private (for backwards compatibility)
15
- attr_accessor :processor
16
14
 
17
15
  ##
18
16
  # If you don't have the CLI tools in your PATH, you can set the path to the
19
17
  # executables.
20
18
  #
21
- # @return [String]
22
- #
23
- attr_accessor :cli_path
19
+ attr_writer :cli_path
24
20
  # @private (for backwards compatibility)
25
21
  attr_accessor :processor_path
26
22
 
@@ -43,12 +39,12 @@ module MiniMagick
43
39
  #
44
40
  attr_accessor :timeout
45
41
  ##
46
- # When set to `true`, it outputs each command to STDOUT in their shell
42
+ # When get to `true`, it outputs each command to STDOUT in their shell
47
43
  # version.
48
44
  #
49
45
  # @return [Boolean]
50
46
  #
51
- attr_accessor :debug
47
+ attr_reader :debug
52
48
  ##
53
49
  # Logger for {#debug}, default is `MiniMagick::Logger.new(STDOUT)`, but
54
50
  # you can override it, for example if you want the logs to be written to
@@ -119,12 +115,14 @@ module MiniMagick
119
115
  imagemagick7: "magick",
120
116
  }
121
117
 
118
+ # @private (for backwards compatibility)
122
119
  def processor
123
120
  @processor ||= CLI_DETECTION.values.detect do |processor|
124
121
  MiniMagick::Utilities.which(processor)
125
122
  end
126
123
  end
127
124
 
125
+ # @private (for backwards compatibility)
128
126
  def processor=(processor)
129
127
  @processor = processor.to_s
130
128
 
@@ -135,11 +133,27 @@ module MiniMagick
135
133
  end
136
134
  end
137
135
 
136
+ ##
137
+ # Get [ImageMagick](http://www.imagemagick.org) or
138
+ # [GraphicsMagick](http://www.graphicsmagick.org).
139
+ #
140
+ # @return [Symbol] `:imagemagick` or `:graphicsmagick`
141
+ #
138
142
  def cli
139
- @cli || CLI_DETECTION.key(processor) or
140
- fail MiniMagick::Error, "You must have ImageMagick or GraphicsMagick installed"
143
+ if instance_variable_defined?("@cli")
144
+ instance_variable_get("@cli")
145
+ else
146
+ cli = CLI_DETECTION.key(processor) or
147
+ fail MiniMagick::Error, "You must have ImageMagick or GraphicsMagick installed"
148
+
149
+ instance_variable_set("@cli", cli)
150
+ end
141
151
  end
142
152
 
153
+ ##
154
+ # Set whether you want to use [ImageMagick](http://www.imagemagick.org) or
155
+ # [GraphicsMagick](http://www.graphicsmagick.org).
156
+ #
143
157
  def cli=(value)
144
158
  @cli = value
145
159
 
@@ -150,10 +164,26 @@ module MiniMagick
150
164
  end
151
165
  end
152
166
 
167
+ ##
168
+ # If you set the path of CLI tools, you can get the path of the
169
+ # executables.
170
+ #
171
+ # @return [String]
172
+ #
153
173
  def cli_path
154
- @cli_path || @processor_path
174
+ if instance_variable_defined?("@cli_path")
175
+ instance_variable_get("@cli_path")
176
+ else
177
+ processor_path = instance_variable_get("@processor_path") if instance_variable_defined?("@processor_path")
178
+
179
+ instance_variable_set("@cli_path", processor_path)
180
+ end
155
181
  end
156
182
 
183
+ ##
184
+ # When set to `true`, it outputs each command to STDOUT in their shell
185
+ # version.
186
+ #
157
187
  def debug=(value)
158
188
  warn "MiniMagick.debug is deprecated and will be removed in MiniMagick 5. Use `MiniMagick.logger.level = Logger::DEBUG` instead."
159
189
  logger.level = value ? Logger::DEBUG : Logger::INFO
@@ -82,17 +82,15 @@ module MiniMagick
82
82
  def self.open(path_or_url, ext = nil, options = {})
83
83
  options, ext = ext, nil if ext.is_a?(Hash)
84
84
 
85
- ext ||=
86
- if File.exist?(path_or_url)
87
- File.extname(path_or_url)
88
- else
89
- File.extname(URI(path_or_url).path)
90
- end
85
+ uri = URI(path_or_url.to_s)
91
86
 
87
+ ext ||= File.extname(uri.path)
92
88
  ext.sub!(/:.*/, '') # hack for filenames or URLs that include a colon
93
89
 
94
- Kernel.open(path_or_url, "rb", options) do |file|
95
- read(file, ext)
90
+ if uri.is_a?(URI::HTTP) || uri.is_a?(URI::FTP)
91
+ uri.open(options) { |file| read(file, ext) }
92
+ else
93
+ File.open(uri.to_s, "rb", options) { |file| read(file, ext) }
96
94
  end
97
95
  end
98
96
 
@@ -141,7 +141,7 @@ module MiniMagick
141
141
  end
142
142
 
143
143
  key, _, value = line.partition(/:[\s]/).map(&:strip)
144
- hash = key_stack.inject(details_hash) { |h, k| h.fetch(k) }
144
+ hash = key_stack.inject(details_hash) { |_hash, _key| _hash.fetch(_key) }
145
145
  if value.empty?
146
146
  hash[key] = {}
147
147
  key_stack.push key
@@ -9,7 +9,7 @@ module MiniMagick
9
9
  module VERSION
10
10
  MAJOR = 4
11
11
  MINOR = 9
12
- TINY = 3
12
+ TINY = 4
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.9.3
4
+ version: 4.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Johnson
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2019-02-24 00:00:00.000000000 Z
16
+ date: 2019-07-11 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rake
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  requirements:
157
157
  - You must have ImageMagick or GraphicsMagick installed
158
- rubygems_version: 3.0.1
158
+ rubygems_version: 3.0.3
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick