Add rbpdf from gx86.
[mjo-overlay.git] / dev-ruby / rbpdf / rbpdf-1.18.5.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/dev-ruby/rbpdf/rbpdf-1.18.5.ebuild,v 1.1 2015/04/11 02:59:00 mjo Exp $
4
5 EAPI=5
6
7 # As long as we conditionally depend on dev-ruby/rails:3.2, we're
8 # helpless to add ruby21 or ruby22 support. It should be possible, it
9 # just hasn't happened yet. See https://github.com/naitoh/rbpdf/issues/9
10 USE_RUBY="ruby19 ruby20"
11
12 RUBY_FAKEGEM_RECIPE_DOC="rdoc"
13 RUBY_FAKEGEM_EXTRADOC="README.md"
14
15 inherit ruby-fakegem
16
17 DESCRIPTION="Ruby on Rails TCPDF plugin"
18 HOMEPAGE="https://github.com/naitoh/rbpdf"
19
20 LICENSE="LGPL-2.1+"
21 SLOT="0"
22 KEYWORDS="~amd64 ~x86"
23 IUSE=""
24
25 # We need to set up a fake Rails environment to run the tests.
26 ruby_add_bdepend "test? ( dev-ruby/rails:3.2 )"
27
28 src_test() {
29 # Create a fake Rails environment once, then do the default ruby-ng
30 # thing. Make sure we use the rails-3.x.y executable.
31 local rails="${ROOT}usr/bin/rails-3.2*"
32
33 $rails new "${T}/dummy" \
34 --skip-javascript \
35 --skip-git \
36 --skip-bundle \
37 --skip-sprockets \
38 --skip-active-record \
39 || die "failed to create rails environment"
40
41 ruby-ng_src_test
42 }
43
44 each_ruby_test() {
45 # The test suite needs to run within a Rails environment, so in
46 # src_test(), we created an empty Rails instance in ${T}/dummy. Now
47 # we copy ourselves into the vendor/plugins directory of that Rails
48 # instance, and run the tests using Rails's Rakefile. Assuming the
49 # tests pass, we remove the plugin again so everything is nice and
50 # tidy for the next ruby implementation.
51 cp -r . "${T}/dummy/vendor/plugins/${PN}" || \
52 die "failed to install plugin"
53 cd "${T}/dummy" || die
54 rake test TEST="vendor/plugins/${PN}/test/*_test.rb" || \
55 die "test suite failed"
56 rm -r "vendor/plugins/${PN}" || die "failed to uninstall plugin"
57 }