mini_magick 3.8.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mini_gmagick.rb +2 -1
  3. data/lib/mini_magick/configuration.rb +136 -0
  4. data/lib/mini_magick/image/info.rb +122 -0
  5. data/lib/mini_magick/image.rb +380 -334
  6. data/lib/mini_magick/logger.rb +40 -0
  7. data/lib/mini_magick/shell.rb +48 -0
  8. data/lib/mini_magick/tool/animate.rb +14 -0
  9. data/lib/mini_magick/tool/compare.rb +14 -0
  10. data/lib/mini_magick/tool/composite.rb +14 -0
  11. data/lib/mini_magick/tool/conjure.rb +14 -0
  12. data/lib/mini_magick/tool/convert.rb +14 -0
  13. data/lib/mini_magick/tool/display.rb +14 -0
  14. data/lib/mini_magick/tool/identify.rb +14 -0
  15. data/lib/mini_magick/tool/import.rb +14 -0
  16. data/lib/mini_magick/tool/mogrify.rb +14 -0
  17. data/lib/mini_magick/tool/montage.rb +14 -0
  18. data/lib/mini_magick/tool/stream.rb +14 -0
  19. data/lib/mini_magick/tool.rb +250 -0
  20. data/lib/mini_magick/utilities.rb +23 -50
  21. data/lib/mini_magick/version.rb +5 -5
  22. data/lib/mini_magick.rb +43 -65
  23. data/spec/fixtures/animation.gif +0 -0
  24. data/spec/fixtures/default.jpg +0 -0
  25. data/spec/fixtures/exif.jpg +0 -0
  26. data/spec/fixtures/image.psd +0 -0
  27. data/spec/fixtures/not_an_image.rb +1 -0
  28. data/spec/lib/mini_magick/configuration_spec.rb +66 -0
  29. data/spec/lib/mini_magick/image_spec.rb +367 -406
  30. data/spec/lib/mini_magick/shell_spec.rb +66 -0
  31. data/spec/lib/mini_magick/tool_spec.rb +107 -0
  32. data/spec/lib/mini_magick/utilities_spec.rb +17 -0
  33. data/spec/lib/mini_magick_spec.rb +23 -47
  34. data/spec/spec_helper.rb +17 -25
  35. data/spec/support/helpers.rb +37 -0
  36. metadata +40 -74
  37. data/lib/mini_magick/command_builder.rb +0 -94
  38. data/lib/mini_magick/errors.rb +0 -4
  39. data/spec/files/actually_a_gif.jpg +0 -0
  40. data/spec/files/animation.gif +0 -0
  41. data/spec/files/composited.jpg +0 -0
  42. data/spec/files/erroneous.jpg +0 -0
  43. data/spec/files/layers.psd +0 -0
  44. data/spec/files/leaves (spaced).tiff +0 -0
  45. data/spec/files/not_an_image.php +0 -1
  46. data/spec/files/png.png +0 -0
  47. data/spec/files/simple-minus.gif +0 -0
  48. data/spec/files/simple.gif +0 -0
  49. data/spec/files/trogdor.jpg +0 -0
  50. data/spec/files/trogdor_capitalized.JPG +0 -0
  51. data/spec/lib/mini_magick/command_builder_spec.rb +0 -153
@@ -1,153 +0,0 @@
1
- require 'spec_helper'
2
-
3
- # All tests tagged as `ported` are ported from
4
- # testunit tests and are there for backwards compatibility
5
-
6
- MiniMagick.processor = :mogrify
7
-
8
- describe MiniMagick::CommandBuilder do
9
- before do
10
- @processor = MiniMagick.processor
11
- @processor_path = MiniMagick.processor_path
12
- end
13
-
14
- after do
15
- MiniMagick.processor_path = @processor_path
16
- MiniMagick.processor = @processor
17
- end
18
-
19
- describe 'ported from testunit', :ported => true do
20
- let(:builder) { described_class.new('test') }
21
-
22
- it 'builds a basic command' do
23
- builder.resize '30x40'
24
- expect(builder.args.join(' ')).to eq '-resize 30x40'
25
- end
26
-
27
- it 'builds a full command' do
28
- builder.resize '30x40'
29
- expect(builder.command).to eq 'test -resize 30x40'
30
- end
31
-
32
- describe 'windows only', :if => MiniMagick::Utilities.windows? do
33
- it 'builds a complicated command' do
34
- builder.resize '30x40'
35
- builder.alpha '1 3 4'
36
- builder.resize 'mome fingo'
37
- expect(builder.args.join(' ')).to eq '-resize 30x40 -alpha 1 3 4 -resize mome fingo'
38
- end
39
-
40
- it 'builds a command with multiple options and plus modifier' do
41
- builder.distort.+ 'srt', '0.6 20'
42
- expect(builder.args.join(' ')).to eq '+distort srt 0.6 20'
43
- end
44
-
45
- it 'sets a colorspace correctly' do
46
- builder.set 'colorspace RGB'
47
- expect(builder.command).to eq 'test -set colorspace RGB'
48
- end
49
- end
50
-
51
- describe 'not windows', :if => !MiniMagick::Utilities.windows? do
52
- it 'builds a complicated command' do
53
- builder.resize '30x40'
54
- builder.alpha '1 3 4'
55
- builder.resize 'mome fingo'
56
- expect(builder.args.join(' ')).to eq '-resize 30x40 -alpha 1\ 3\ 4 -resize mome\ fingo'
57
- end
58
-
59
- it 'sets a colorspace correctly' do
60
- builder.set 'colorspace RGB'
61
- expect(builder.command).to eq 'test -set colorspace\ RGB'
62
- end
63
-
64
- it 'builds a command with multiple options and plus modifier' do
65
- builder.distort.+ 'srt', '0.6 20'
66
- expect(builder.args.join(' ')).to eq '\+distort srt 0.6\ 20'
67
- end
68
- end
69
-
70
- describe 'common verbs between morgify and image creation operators' do
71
- context 'mogrify' do
72
- let(:builder) { described_class.new('mogrify') }
73
-
74
- it 'builds the command' do
75
- builder.caption 'caption_text'
76
- expect(builder.command).to eq 'mogrify -caption caption_text'
77
- end
78
- end
79
-
80
- context 'other' do
81
- it 'builds the command' do
82
- builder.caption 'caption_text'
83
- expect(builder.command).to eq 'test caption:caption_text'
84
- end
85
- end
86
- end
87
-
88
- it 'raises error when command is invalid' do
89
- expect {
90
- command = described_class.new('test', 'path')
91
- command.input 2
92
- }.to raise_error
93
- end
94
-
95
- it 'builds a dashed command' do
96
- builder.auto_orient
97
- expect(builder.args.join(' ')).to eq '-auto-orient'
98
- end
99
-
100
- it 'builds a dashed command via send' do
101
- builder.send('auto-orient')
102
- expect(builder.args.join(' ')).to eq '-auto-orient'
103
- end
104
-
105
- it 'builds a canvas command' do
106
- builder.canvas 'black'
107
- expect(builder.args.join(' ')).to eq 'canvas:black'
108
- end
109
-
110
- it 'sets a processor path correctly' do
111
- MiniMagick.processor_path = '/a/strange/path'
112
- builder.auto_orient
113
- expect(builder.command).to eq '/a/strange/path/test -auto-orient'
114
- end
115
-
116
- it 'builds a processor path with processor' do
117
- MiniMagick.processor_path = '/a/strange/path'
118
- MiniMagick.processor = 'processor'
119
- builder.auto_orient
120
- expect(builder.command).to eq '/a/strange/path/processor test -auto-orient'
121
- end
122
- end
123
-
124
- describe 'deprecated' do
125
- let(:builder) { described_class.new('test') }
126
- before { MiniMagick.processor = nil }
127
-
128
- it 'builds a full command' do
129
- builder.resize '30x40'
130
- expect(builder.command).to eq 'test -resize 30x40'
131
- end
132
-
133
- context 'windows only', :if => MiniMagick::Utilities.windows? do
134
- it 'sets a colorspace correctly' do
135
- builder.set 'colorspace RGB'
136
- expect(builder.command).to eq 'test -set colorspace RGB'
137
- end
138
- end
139
-
140
- context 'not windows', :if => !MiniMagick::Utilities.windows? do
141
- it 'sets a colorspace correctly' do
142
- builder.set 'colorspace RGB'
143
- expect(builder.command).to eq 'test -set colorspace\ RGB'
144
- end
145
- end
146
-
147
- it 'sets a processor path correctly' do
148
- MiniMagick.processor_path = '/a/strange/path'
149
- builder.auto_orient
150
- expect(builder.command).to eq '/a/strange/path/test -auto-orient'
151
- end
152
- end
153
- end