summaryrefslogtreecommitdiff
blob: 2b0ce0ba14cb0623fc299daca09b16e36ebc29a1 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"
inherit eutils confutils
#inherit webapp

DESCRIPTION="Flexible project management web application written using Ruby on Rails framework"
HOMEPAGE="http://www.redmine.org"
if [[ ${PV} = 9999 ]]; then
	inherit subversion
	ESVN_REPO_URI="http://redmine.rubyforge.org/svn/trunk/"
	KEYWORDS=""
else
	SRC_URI="mirror://rubyforge/${PN}/${P/rc/RC}.tar.gz"
	KEYWORDS="~amd64"
	S=${WORKDIR}/${P/rc/RC}
fi

LICENSE="GPL-2"
SLOT="0"
IUSE="cvs darcs git imagemagick mercurial +mysql openid postgres sqlite3 subversion"


# TODO: 
# 1. dev-ruby/actionwebservice (rm vendor/plugins/{actionwebservice)
# 2. tests: doc/RUNNING_TESTS
DEPEND="dev-ruby/rails:2.3
	dev-ruby/activerecord:2.2[mysql?,postgres?,sqlite3?]"

RDEPEND="${DEPEND}
	www-servers/mongrel
	>=dev-ruby/ruby-net-ldap-0.0.4
	>=dev-ruby/coderay-0.7.6.227
	cvs? ( >=dev-util/cvs-1.12 )
	darcs? ( dev-util/darcs )
	git? ( dev-util/git )
	imagemagick? ( dev-ruby/rmagick )
	mercurial? ( dev-util/mercurial )
	openid? ( >=dev-ruby/ruby-openid-2 )
	subversion? ( >=dev-util/subversion-1.3 )"

pkg_setup() {
#	webapp_pkg_setup
	confutils_require_any mysql postgres sqlite3
	enewgroup redmine
	# home directory is required for SCM.
	enewuser redmine -1 -1 -1 redmine
}

src_install() {
	rm files/delete.me
	dodoc doc/{UPGRADING,INSTALL,CHANGELOG}
	rm -fr doc log vendor/plugins/{coderay-*,ruby-net-ldap-*}

	# redmine does not work in case config is symlink. Moving only really
	# important files into /etc/redmine.
	dodir /etc/${PN}
	mv config/database.yml.example "${D}/etc/${PN}/database.yml"
	mv config/email.yml.example "${D}/etc/${PN}/email.yml"
#########################################################
	#webapp_src_preinst
	#cp -R * "${D}/${MY_HTDOCSDIR}"
	#dodir "${MY_HTDOCSDIR}"/{tmp,public/plugin_assets}
	#webapp_serverowned -R ${MY_HTDOCSDIR}/{files,log,tmp,public/plugin_assets}
	#fperms 0755 -R ${MY_HTDOCSDIR}/{files,log,tmp,public/plugin_assets}
	#webapp_configfile "${MY_HTDOCSDIR}/config/database.yml"
	#webapp_configfile "${MY_HTDOCSDIR}/config/email.yml"
	#webapp_configfile "${MY_HTDOCSDIR}/config/settings.yml"
	#webapp_postinst_txt en "${FILESDIR}"/${P}-postinst.en.txt

	#webapp_src_install
#########################################################

	dodir /var/log/${PN}
	dosym /var/log/${PN} /var/lib/${PN}/log

	# This should work in EAPI=3, but not yet... using cp instead :)
	#insinto /var/lib/${PN}
	#doins -r .
	cp -r * "${D}/var/lib/${PN}"
	dosym /etc/${PN}/database.yml /var/lib/${PN}/config/
	dosym /etc/${PN}/email.yml /var/lib/${PN}/config/
	dodir /var/lib/${PN}/files
	fowners -R redmine:redmine /var/lib/${PN}/{files,tmp,public} /var/log/${PN}

	newconfd "${FILESDIR}/redmine.confd" redmine
	newinitd "${FILESDIR}/redmine.initd" redmine
}

pkg_postinst() {
	einfo
	elog "Installation notes are at official site"
	elog "http://www.redmine.org/wiki/redmine/RedmineInstall"
	elog
	elog "For upgrade instructions take a look at:"
	elog "http://www.redmine.org/wiki/redmine/RedmineUpgrade"
	einfo
}