summaryrefslogtreecommitdiff
blob: 820398addfeb80ea038a6b5f7a842563c53e4412 (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
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-ruby/fakeweb/fakeweb-1.3.0-r1.ebuild,v 1.3 2014/04/19 07:37:27 graaff Exp $

EAPI=5

USE_RUBY="ruby19 ruby20 ruby21 jruby"

RUBY_FAKEGEM_DOCDIR="html"
RUBY_FAKEGEM_EXTRADOC="CHANGELOG README.rdoc"

inherit ruby-fakegem

DESCRIPTION="Helper for faking web requests in Ruby"
HOMEPAGE="http://github.com/chrisk/fakeweb"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
IUSE=""

ruby_add_bdepend "
	test? (
		dev-ruby/mocha:0.13
		dev-ruby/test-unit
		dev-ruby/samuel
		dev-ruby/right_http_connection
	)"

all_ruby_prepare() {
	# The package bundles samuel and right_http_connection, remove
	# them and use the packages instead.
	rm -r test/vendor || die "failed to remove bundled gems"

	# We don't package sdoc and we don't have the direct template.
	sed -i -e 's/sdoc/rdoc/' -e '/template/d' Rakefile || die

	# Require an old enough version of mocha
	sed -i -e '1igem "mocha", "~> 0.13.0"' test/test_helper.rb || die

	# Use the test-unit gem to make jruby compatible with newer mocha.
	sed -i -e '1igem "test-unit"' test/test_helper.rb || die
}

each_ruby_prepare() {
	case ${RUBY} in
		*ruby2[01])
			# Tests fail on mocking of TCPSocket, but fakeweb itself
			# actually works as evidenced by the thor test suite.
			rm test/test_fake_web_open_uri.rb test/test_allow_net_connect.rb test/test_fake_web.rb || die
			;;
		*jruby)
			# jruby has different deprecation warnings
			rm test/test_deprecations.rb || die
			;;
	esac
}