media-sound/xmms2-9999.ebuild: allow 'epatch_user' in 'src_prepare()'
[slyfox-gentoo.git] / dev-ruby / dbi / dbi-0.4.3.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/dev-ruby/dbi/dbi-0.4.3.ebuild,v 1.3 2012/09/09 08:23:03 graaff Exp $
4
5 EAPI=4
6 USE_RUBY="ruby18"
7
8 inherit ruby-ng
9
10 DESCRIPTION="Ruby/DBI - a database independent interface for accessing databases - similar to Perl's DBI"
11 HOMEPAGE="http://ruby-dbi.rubyforge.org"
12 SRC_URI="mirror://rubyforge/ruby-dbi/${P}.tar.gz"
13
14 LICENSE="BSD"
15 SLOT="0"
16 KEYWORDS="amd64 ppc x86"
17 IUSE="examples odbc postgres mysql sqlite sqlite3 test"
18
19 ruby_add_bdepend "test? ( virtual/ruby-test-unit )"
20 ruby_add_rdepend "dev-ruby/deprecated:2"
21
22 PDEPEND="
23         mysql?    ( dev-ruby/dbd-mysql )
24         postgres? ( dev-ruby/dbd-pg )
25         odbc?     ( dev-ruby/dbd-odbc )
26         sqlite?   ( dev-ruby/dbd-sqlite )
27         sqlite3?  ( dev-ruby/dbd-sqlite3 )"
28
29 S="${WORKDIR}/${MY_P}"
30
31 all_ruby_prepare() {
32         sed -i -e '/test_available_drivers/,/^   end/ s:^:#:' test/dbi/tc_dbi.rb || die
33         sed -i -e "s/gem 'deprecated'/gem 'deprecated', '~>2.0'/" lib/dbi/columninfo.rb lib/dbi.rb || die
34 }
35
36 each_ruby_configure() {
37         ${RUBY} setup.rb config --prefix=/usr
38 }
39
40 each_ruby_test() {
41         ${RUBY} test/ts_dbi.rb || die "Tests failed."
42 }
43
44 each_ruby_install() {
45         ${RUBY} setup.rb install \
46                 --prefix="${D}" || die "setup.rb install failed"
47 }
48
49 all_ruby_install() {
50         dodoc ChangeLog README
51
52         if use examples ; then
53                 cp -pPR examples "${D}/usr/share/doc/${PF}" || die "cp examples failed"
54         fi
55 }
56
57 pkg_postinst() {
58         if ! (use mysql || use postgres || use odbc || use sqlite || use sqlite3)
59         then
60                 elog "${P} now comes with external database drivers."
61                 elog "Be sure to set the right USE flags for ${PN} or emerge the drivers manually:"
62                 elog "They are called dev-ruby/dbd-{mysql,odbc,pg,sqlite,sqlite3}"
63         fi
64 }