mini_magick 4.13.2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/mini_magick.rb CHANGED
@@ -1,64 +1,39 @@
1
1
  require 'mini_magick/version'
2
2
  require 'mini_magick/configuration'
3
+ require 'mini_magick/utilities'
4
+ require 'mini_magick/tool'
5
+ require 'mini_magick/image'
3
6
 
4
7
  module MiniMagick
5
8
 
6
- extend MiniMagick::Configuration
7
-
8
- ##
9
- # You might want to execute only certain blocks of processing with a
10
- # different CLI, because for example that CLI does that particular thing
11
- # faster. After the block CLI resets to its previous value.
12
- #
13
- # @example
14
- # MiniMagick.with_cli :graphicsmagick do
15
- # # operations that are better done with GraphicsMagick
16
- # end
17
- def self.with_cli(cli)
18
- old_cli = self.cli
19
- self.cli = cli
20
- yield
21
- ensure
22
- self.cli = old_cli
23
- end
9
+ Error = Class.new(RuntimeError)
10
+ Invalid = Class.new(StandardError)
11
+ TimeoutError = Class.new(Error)
24
12
 
25
- ##
26
- # Checks whether the CLI used is ImageMagick.
27
- #
28
- # @return [Boolean]
29
- def self.imagemagick?
30
- cli == :imagemagick
31
- end
13
+ extend MiniMagick::Configuration
32
14
 
33
15
  ##
34
- # Checks whether the CLI used is ImageMagick 7.
16
+ # Checks whether ImageMagick 7 is installed.
35
17
  #
36
18
  # @return [Boolean]
37
19
  def self.imagemagick7?
38
- cli == :imagemagick7
20
+ return @imagemagick7 if defined?(@imagemagick7)
21
+ @imagemagick7 = !!MiniMagick::Utilities.which("magick")
39
22
  end
40
23
 
41
- ##
42
- # Checks whether the CLI used is GraphicsMagick.
43
- #
44
- # @return [Boolean]
45
- def self.graphicsmagick?
46
- cli == :graphicsmagick
24
+ %w[animate compare composite conjure convert display identify import mogrify montage stream].each do |tool|
25
+ name = imagemagick7? && tool == "convert" ? "magick" : tool
26
+ define_singleton_method(tool) do |**options, &block|
27
+ MiniMagick::Tool.new(name, **options, &block)
28
+ end
47
29
  end
48
30
 
49
31
  ##
50
- # Returns ImageMagick's/GraphicsMagick's version.
32
+ # Returns ImageMagick version.
51
33
  #
52
34
  # @return [String]
53
35
  def self.cli_version
54
- output = MiniMagick::Tool::Identify.new(&:version)
36
+ output = MiniMagick.identify(&:version)
55
37
  output[/\d+\.\d+\.\d+(-\d+)?/]
56
38
  end
57
-
58
- class Error < RuntimeError; end
59
- class Invalid < StandardError; end
60
-
61
39
  end
62
-
63
- require 'mini_magick/tool'
64
- require 'mini_magick/image'
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.13.2
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Johnson
@@ -57,7 +57,7 @@ dependencies:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
59
  version: '0'
60
- description: Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick
60
+ description: Manipulate images with minimal use of memory via ImageMagick
61
61
  email:
62
62
  - probablycorey@gmail.com
63
63
  - hcatlin@gmail.com
@@ -72,32 +72,19 @@ files:
72
72
  - MIT-LICENSE
73
73
  - README.md
74
74
  - Rakefile
75
- - lib/mini_gmagick.rb
76
75
  - lib/mini_magick.rb
77
76
  - lib/mini_magick/configuration.rb
78
77
  - lib/mini_magick/image.rb
79
78
  - lib/mini_magick/image/info.rb
80
79
  - lib/mini_magick/shell.rb
81
80
  - lib/mini_magick/tool.rb
82
- - lib/mini_magick/tool/animate.rb
83
- - lib/mini_magick/tool/compare.rb
84
- - lib/mini_magick/tool/composite.rb
85
- - lib/mini_magick/tool/conjure.rb
86
- - lib/mini_magick/tool/convert.rb
87
- - lib/mini_magick/tool/display.rb
88
- - lib/mini_magick/tool/identify.rb
89
- - lib/mini_magick/tool/import.rb
90
- - lib/mini_magick/tool/magick.rb
91
- - lib/mini_magick/tool/mogrify.rb
92
- - lib/mini_magick/tool/mogrify_restricted.rb
93
- - lib/mini_magick/tool/montage.rb
94
- - lib/mini_magick/tool/stream.rb
95
81
  - lib/mini_magick/utilities.rb
96
82
  - lib/mini_magick/version.rb
97
83
  homepage: https://github.com/minimagick/minimagick
98
84
  licenses:
99
85
  - MIT
100
- metadata: {}
86
+ metadata:
87
+ changelog_uri: https://github.com/minimagick/minimagick/releases
101
88
  post_install_message:
102
89
  rdoc_options: []
103
90
  require_paths:
@@ -113,9 +100,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
100
  - !ruby/object:Gem::Version
114
101
  version: '0'
115
102
  requirements:
116
- - You must have ImageMagick or GraphicsMagick installed
103
+ - You must have ImageMagick installed
117
104
  rubygems_version: 3.5.11
118
105
  signing_key:
119
106
  specification_version: 4
120
- summary: Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick
107
+ summary: Manipulate images with minimal use of memory via ImageMagick
121
108
  test_files: []
data/lib/mini_gmagick.rb DELETED
@@ -1,3 +0,0 @@
1
- require 'mini_magick'
2
-
3
- MiniMagick.processor = :gm
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/animate.php
5
- #
6
- class Animate < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("animate", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/compare.php
5
- #
6
- class Compare < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("compare", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/composite.php
5
- #
6
- class Composite < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("composite", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/conjure.php
5
- #
6
- class Conjure < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("conjure", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/convert.php
5
- #
6
- class Convert < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("convert", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/display.php
5
- #
6
- class Display < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("display", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/identify.php
5
- #
6
- class Identify < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("identify", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/import.php
5
- #
6
- class Import < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("import", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/command-line-processing.php
5
- #
6
- class Magick < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("magick", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/mogrify.php
5
- #
6
- class Mogrify < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("mogrify", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,15 +0,0 @@
1
- require "mini_magick/tool/mogrify"
2
-
3
- module MiniMagick
4
- class Tool
5
- ##
6
- # @see http://www.imagemagick.org/script/mogrify.php
7
- #
8
- class MogrifyRestricted < Mogrify
9
- def format(*args)
10
- fail NoMethodError,
11
- "you must call #format on a MiniMagick::Image directly"
12
- end
13
- end
14
- end
15
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/montage.php
5
- #
6
- class Montage < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("montage", *args)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module MiniMagick
2
- class Tool
3
- ##
4
- # @see http://www.imagemagick.org/script/stream.php
5
- #
6
- class Stream < MiniMagick::Tool
7
-
8
- def initialize(*args)
9
- super("stream", *args)
10
- end
11
-
12
- end
13
- end
14
- end