summaryrefslogtreecommitdiff
blob: 791b235526e287ce8ac2d49e1da5f96c46e0de68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

USE_RUBY="ruby26 ruby27 ruby30"

RUBY_FAKEGEM_RECIPE_TEST="rspec3"
RUBY_FAKEGEM_EXTRADOC="README.md"

RUBY_FAKEGEM_GEMSPEC="${PN}.gemspec"

RUBY_FAKEGEM_BINWRAP=""

inherit ruby-fakegem

DESCRIPTION="Manipulate images with minimal use of memory"
HOMEPAGE="https://github.com/minimagick/minimagick"
SRC_URI="https://github.com/minimagick/minimagick/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RUBY_S="minimagick-${PV}"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~ppc64 ~riscv ~x86"
IUSE=""

# It's only used at runtime in this case because this extension only
# _calls_ the commands. But when we run tests we're going to need tiff
# and jpeg support at a minimum.
RDEPEND+=" media-gfx/imagemagick"
DEPEND+=" test? ( virtual/imagemagick-tools[jpeg,png,tiff] )"

ruby_add_bdepend "test? ( dev-ruby/mocha dev-ruby/webmock )"

all_ruby_prepare() {
	# remove executable bit from all files
	find "${S}" -type f -exec chmod -x {} +

	sed -i -e '/\([Bb]undler\|pry\)/ s:^:#:' spec/spec_helper.rb || die

	# Don't force a specific formatter but use overall Gentoo defaults.
	sed -i -e '/config.formatter/d' spec/spec_helper.rb || die

	# Avoid broken spec that does not assume . in path name
	sed -i -e '/reformats a layer/,/end/ s:^:#:' spec/lib/mini_magick/image_spec.rb || die

	# Avoid spec broken by recent imagemagick updates
	sed -i -e '/cache files generated from .mpc/askip' spec/lib/mini_magick/image_spec.rb || die
	sed -i -e '/does not hang when parsing verbose data/askip' spec/lib/mini_magick/image_spec.rb || die

	# Avoid graphicsmagick tests because installing both in parallel for
	# tests is hard.
	sed -i -e 's/:graphicsmagick//' spec/spec_helper.rb || die
	sed -i -e '/identifies when gm exists/,/^    end/ s:^:#:' spec/lib/mini_magick/utilities_spec.rb || die
	sed -i -e '/returns GraphicsMagick/,/^    end/ s:^:#:' spec/lib/mini_magick_spec.rb || die
	sed -i -e 's/"GraphicsMagick"//' spec/lib/mini_magick/image_spec.rb || die

	# Avoid posix-spawn tests because is not the default, does not work with ruby30 and appears to be unmaintained.
	sed	-e '/SHELL_APIS.*posix-spawn/ s:^:#:' \
		-e 's/"posix-spawn"//' \
		-i spec/spec_helper.rb || die
}