mojo_magick 0.5.6 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +25 -0
- data/.github/dependabot.yml +8 -0
- data/.rubocop-common.yml +99 -0
- data/.rubocop-performance.yml +2 -0
- data/.rubocop.yml +11 -0
- data/.ruby-version +1 -1
- data/Gemfile +6 -1
- data/Gemfile.lock +53 -11
- data/README.md +35 -4
- data/Rakefile +14 -12
- data/examples/animated_gif.rb +11 -14
- data/examples/composite.rb +11 -14
- data/init.rb +1 -3
- data/lib/image_magick/fonts.rb +4 -11
- data/lib/mojo_magick.rb +115 -106
- data/lib/mojo_magick/command_status.rb +3 -2
- data/lib/mojo_magick/commands.rb +32 -0
- data/lib/mojo_magick/errors.rb +1 -1
- data/lib/mojo_magick/font.rb +4 -7
- data/lib/mojo_magick/opt_builder.rb +24 -35
- data/lib/mojo_magick/util/font_parser.rb +43 -0
- data/lib/mojo_magick/util/parser.rb +11 -60
- data/lib/mojo_magick/version.rb +1 -1
- data/mojo_magick.gemspec +19 -15
- data/test/fixtures/roll with it.jpg +0 -0
- data/test/font_parser_test.rb +29 -0
- data/test/font_test.rb +22 -28
- data/test/mojo_magick_test.rb +288 -283
- data/test/opt_builder_test.rb +105 -89
- data/test/test_helper.rb +6 -5
- metadata +63 -18
- data/lib/image_magick/resource_limits.rb +0 -96
- data/lib/initializers/hash.rb +0 -8
- data/test/fonts_test.rb +0 -12
- data/test/parser_test.rb +0 -30
- data/test/resource_limits_test.rb +0 -51
data/lib/initializers/hash.rb
DELETED
data/test/fonts_test.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require File::join(File::dirname(__FILE__), 'test_helper')
|
2
|
-
|
3
|
-
class FontsTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
def test_get_fonts
|
6
|
-
fonts = MojoMagick::get_fonts
|
7
|
-
assert fonts.is_a? Array
|
8
|
-
assert fonts.length > 1
|
9
|
-
assert fonts.first.name
|
10
|
-
assert (fonts.first.name.is_a? String)
|
11
|
-
end
|
12
|
-
end
|
data/test/parser_test.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require File::join(File::dirname(__FILE__), 'test_helper')
|
2
|
-
|
3
|
-
IDENTIFY_FONT_RESPONSE =<<EOF
|
4
|
-
|
5
|
-
Font: Zapf-Dingbats
|
6
|
-
family: Zapf Dingbats
|
7
|
-
style: Normal
|
8
|
-
stretch: Normal
|
9
|
-
weight: 400
|
10
|
-
glyphs: /System/Library/Fonts/ZapfDingbats.ttf
|
11
|
-
|
12
|
-
Font: Zapfino
|
13
|
-
family: Zapfino
|
14
|
-
style: Italic
|
15
|
-
stretch: Normal
|
16
|
-
weight: 400
|
17
|
-
glyphs: /Library/Fonts/Zapfino.ttf
|
18
|
-
|
19
|
-
|
20
|
-
EOF
|
21
|
-
|
22
|
-
class ParserTest < MiniTest::Unit::TestCase
|
23
|
-
|
24
|
-
def test_parse_fonts
|
25
|
-
parser = MojoMagick::Util::Parser.new
|
26
|
-
parsed_fonts = parser.parse_fonts(IDENTIFY_FONT_RESPONSE)
|
27
|
-
assert_equal parsed_fonts.length, 2
|
28
|
-
assert_equal parsed_fonts[1].style, 'Italic'
|
29
|
-
end
|
30
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require File::join(File::dirname(__FILE__), 'test_helper')
|
2
|
-
|
3
|
-
class ResourceLimitsTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@orig_limits = MojoMagick::get_default_limits
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_set_limits
|
10
|
-
# set area to 32mb limit
|
11
|
-
MojoMagick::set_limits(:area => '32mb')
|
12
|
-
new_limits = MojoMagick::get_current_limits
|
13
|
-
assert_equal '32mb', new_limits[:area].downcase
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_get_limits
|
17
|
-
assert(@orig_limits.size >= 7)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_resource_limits
|
21
|
-
orig_limits_test = @orig_limits.dup
|
22
|
-
orig_limits_test.delete_if do |resource, value|
|
23
|
-
assert [:throttle, :area, :map, :disk, :memory, :file, :thread, :time].include?(resource), "Found unexpected resource #{resource}"
|
24
|
-
true
|
25
|
-
end
|
26
|
-
assert_equal 0, orig_limits_test.size
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_get_current_limits
|
30
|
-
# remove limits on area
|
31
|
-
MojoMagick::remove_limits(:area)
|
32
|
-
new_limits = MojoMagick::get_current_limits
|
33
|
-
assert_equal @orig_limits[:area], new_limits[:area]
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_set_limits
|
37
|
-
# set memory to 64 mb, disk to 0 and
|
38
|
-
MojoMagick::set_limits(:memory => '64mb', :disk => '0b')
|
39
|
-
new_limits = MojoMagick::get_current_limits(:show_actual_values => true)
|
40
|
-
assert_equal 61, new_limits[:memory]
|
41
|
-
assert_equal 0, new_limits[:disk]
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_unset_limits
|
45
|
-
# return to original/default limit values
|
46
|
-
MojoMagick::unset_limits
|
47
|
-
new_limits = MojoMagick::get_current_limits
|
48
|
-
assert_equal @orig_limits, new_limits
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|