summaryrefslogtreecommitdiff
blob: fda2ab5eda3420fb1d80b40bc19a999b8818b293 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-ruby/barby/barby-0.5.0.ebuild,v 1.1 2011/09/18 13:40:41 flameeyes Exp $

EAPI=4

USE_RUBY="ruby18 ree18 jruby"

RUBY_FAKEGEM_TASK_TEST="test"

RUBY_FAKEGEM_TASK_DOC="doc"
RUBY_FAKEGEM_DOCDIR="site"

RUBY_FAKEGEM_EXTRADOC="CHANGELOG README"

inherit ruby-fakegem

DESCRIPTION="Ruby barcode generator that doesn't rely on 3rd party libraries."
HOMEPAGE="http://toretore.eu/barby/"

GITHUB_USER="toretore"
SRC_URI="https://github.com/${GITHUB_USER}/${PN}/tarball/v${PV} -> ${P}.tgz"
RUBY_S="${GITHUB_USER}-${PN}-*"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test datamatrix pdf-writer qrcode rmagick prawn png cairo"

USE_RUBY="ruby18 ree18" \
	ruby_add_rdepend "
		datamatrix? ( dev-ruby/semacode )
		pdf-writer? ( dev-ruby/pdf-writer )"

# ruby19 as well, if it worked
USE_RUBY="ruby18 ree18" \
	ruby_add_rdepend "
		rmagick? ( dev-ruby/rmagick )
		cairo? ( dev-ruby/rcairo )"

USE_RUBY="ruby18 ree18 jruby" \
	ruby_add_rdepend "prawn? ( dev-ruby/prawn )"

ruby_add_rdepend "qrcode? ( dev-ruby/rqrcode )
	png? ( dev-ruby/chunky_png )"

ruby_add_bdepend "test? ( dev-ruby/minitest )"

# prawn breaks tests for some reasons, needs to be investigated; code
# still works though.
RESTRICT="prawn? ( test )"

all_ruby_prepare() {
	sed -i -e '/[bB]undler/s:^:#:' test/test_helper.rb
}

each_ruby_prepare() {
	if ! use datamatrix; then
		rm \
			lib/barby/barcode/data_matrix.rb \
			test/data_matrix_test.rb
	fi

	if ! use pdf-writer; then
		rm \
			lib/barby/outputter/pdfwriter_outputter.rb \
			test/outputter/pdfwriter_outputter_test.rb
	fi

	if ! use qrcode; then
		rm \
			lib/barby/barcode/qr_code.rb \
			test/qr_code_test.rb
	fi

	if ! use rmagick; then
		rm \
			lib/barby/outputter/rmagick_outputter.rb \
			test/outputter/rmagick_outputter_test.rb
	fi

	if ! use prawn; then
		rm \
			lib/barby/outputter/prawn_outputter.rb \
			test/outputter/prawn_outputter_test.rb
	fi

	if ! use png; then
		rm \
			lib/barby/outputter/png_outputter.rb \
			test/outputter/png_outputter_test.rb
	fi

	if ! use cairo; then
		rm \
			lib/barby/outputter/cairo_outputter.rb \
			test/outputter/cairo_outputter_test.rb
	fi

	case ${RUBY} in
		*/ruby19)
			rm -f \
				lib/barby/barcode/data_matrix.rb \
				test/data_matrix_test.rb \
				lib/barby/outputter/pdfwriter_outputter.rb \
				test/outputter/pdfwriter_outputter_test.rb \
				lib/barby/outputter/prawn_outputter.rb \
				test/outputter/prawn_outputter_test.rb
			;;
		*/jruby)
			rm -f \
				lib/barby/barcode/data_matrix.rb \
				test/data_matrix_test.rb \
				lib/barby/outputter/pdfwriter_outputter.rb \
				test/outputter/pdfwriter_outputter_test.rb \
				lib/barby/outputter/rmagick_outputter.rb \
				test/outputter/rmagick_outputter_test.rb \
				lib/barby/outputter/cairo_outputter.rb \
				test/outputter/cairo_outputter_test.rb
			;;
	esac
}