summaryrefslogtreecommitdiff
blob: 1492d1de30fcba9162dc5702b42566f0251347a8 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-ruby/aws-s3/aws-s3-0.6.2.ebuild,v 1.1 2009/04/29 18:12:12 flameeyes Exp $

inherit ruby

DESCRIPTION="Client library for Amazon's Simple Storage Service's REST API"
HOMEPAGE="http://amazon.rubyforge.org/"
SRC_URI="mirror://rubyforge/amazon/${P}.tar.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="~amd64"
IUSE="doc test"

RDEPEND="dev-ruby/xml-simple
	dev-ruby/builder
	dev-ruby/mime-types"
DEPEND="${RDEPEND}
	test? ( dev-ruby/ruby-debug
		dev-ruby/flexmock )
	dev-ruby/rake"

USE_RUBY="ruby18"

src_unpack() {
	unpack ${A}

	# Remove extra files generated by Mac OS X during packaging
	find "${S}" -name '._*' -delete

	# As of release 0.6.2 this part is going to break when building
	# with Ruby 1.9; we disable it since we don't need it at all.
	sed -i -e '/^namespace :site/,/^end/ d' "${S}"/Rakefile \
		|| die "sed out of rake's :site namespace failed"
}

src_compile() {
	if use doc; then
		rake doc:rerdoc || die "rake rerdoc failed"
	fi
}

src_test() {
	for ruby in $USE_RUBY; do
		[[ -n `type -p $ruby` ]] && $ruby $(type -p rake) test || die "testsuite failed"
	done
}

src_install() {
	pushd lib
	doruby -r * || die "doruby failed"
	popd

	dobin bin/s3sh || die "dobin failed"

	if use doc; then
		dohtml -r doc/* || die "dohtml failed"
	fi

	dodoc README || die "dodoc failed"

	insinto $(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitedir"]')/../gems/1.8/specifications
	sed -e "s:@VERSION@:${PV}:" "${FILESDIR}"/${PN}.gemspec > "${T}"/${P}.gemspec
	doins "${T}"/${P}.gemspec || die "Unable to install fake gemspec"
}