summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'www-apps/redmine')
-rw-r--r--www-apps/redmine/Manifest8
-rw-r--r--www-apps/redmine/files/10_redmine_vhost.conf12
-rw-r--r--www-apps/redmine/files/redmine-1.4.1-bundler.patch15
-rw-r--r--www-apps/redmine/files/redmine-2.initd45
-rw-r--r--www-apps/redmine/files/redmine-rubytree-r8214.patch261
-rw-r--r--www-apps/redmine/files/redmine.confd13
-rw-r--r--www-apps/redmine/files/redmine.initd45
-rw-r--r--www-apps/redmine/redmine-2.2.3.ebuild218
8 files changed, 617 insertions, 0 deletions
diff --git a/www-apps/redmine/Manifest b/www-apps/redmine/Manifest
new file mode 100644
index 0000000..1443f54
--- /dev/null
+++ b/www-apps/redmine/Manifest
@@ -0,0 +1,8 @@
+AUX 10_redmine_vhost.conf 343 SHA256 4067d312a5fc8e7f1f98e8917d2e9c296a70a7e9847efaf92a8415d753387435 SHA512 839a01abedd2977f79bde2a55041d4e3e3a72de1e04e2bdc4aa5169b3ec22adce12b2b39d4b991d6e034fcd13fbcd030cba5ecc69ae71a76f7f37d2cdde09edc WHIRLPOOL 7bdb8c8eb7b24b5fa7750f14a5d6d90504b9e95b1c3d07827a1bba320135ff9aca195282bcc86e6964b742cf0dde3690d79065e61fd14145135ab6ff4c10816b
+AUX redmine-1.4.1-bundler.patch 504 SHA256 e3c49d68db8e439d9e9203d7369117bf4c61e322d37752e085d34daf012f3128 SHA512 02a799f692389ba79d58f21b2ff9cc3f0c4bdaf5883b787eaf02d43a687117c69dd57116265a48e5bb6378dac7b2fea7a6abb4e778e97bdba4e67d15c9d0eb7b WHIRLPOOL caafb4228182f736b46253f0542403ae4117549fbfd310c34b5c671d74653529bccf59f7f910a085925a271fa434eddfa46a9281ab477ad945c447de60702f0e
+AUX redmine-2.initd 1335 SHA256 a838196cd2b0982be478ec4651344bdb25f7a487a38a43c85f77d0b9303e6ded SHA512 3cee5e4b162a08acc32af0e163351eedbfd4beca7ad8f1aeb5fcf7845e4cde481d4c21419d1a8a3206f0d0c105d2a271d09bc9a8fb69d2e3fb1e59e21efc4d3c WHIRLPOOL f25dcc1ae799b609bef5b56c1b4a28b91191b3f21a7329ad25ac0162fadc05fc27857ed037fded39b992c06b5ed2408a334963c185a905fb157e5eef87ed43e0
+AUX redmine-rubytree-r8214.patch 8082 SHA256 4fea78ac11b90a44d94bca2f424c0c180ae9d9beb19212b8a88cf157408a5812 SHA512 c292bd850af1ac78252c2b5f4e461756be034933f8d4fc31daafd2c4b3495cd5288810bdc7bbed427dc16eae93d1390afc44ed68c5c068d0f15573f43d68d870 WHIRLPOOL e35fe926db9cb171a06ac81fc85f328538388313690a08bead40f176be040a960a1fb3d5fc3281b42082c8f2801d45a0ba2a3a2275ff2eaff06b763f3d5bb005
+AUX redmine.confd 267 SHA256 2ac6b7dfc2d055554b7ee9380fcf1a49a708bbd866987b775507d7a3b30f2d41 SHA512 4e4a700f1540b5e82df6ca610a94adcb08929f5ca75e605e40372b18ccc395515cdd53451ba2b3e3d9bdf129d9052a7218f6323d526c1ffb2540254d279c8d94 WHIRLPOOL fd6e8c63921d7ab2d73b5b15ff91db64ead03e521325871e21a1d165e313a1e56c607e9d9553504ccdef10a917a85ecdd5502527df159012b471803f4063ea00
+AUX redmine.initd 1328 SHA256 18ede107d4aaa4712515e9d70910e48ce508954c682cccd29d8936fee527249a SHA512 19527695226d166983d08fb0283023084a1bada6c8ced248fdde8e74048aa364bcf467c947a33127580f9a95eb67de9faaea651a3c5a61649eac9302b03d6585 WHIRLPOOL a889c9af02e0a36635dadedda96c8c0e7c6cab75273b2202ee12e618b048d3de6b9590d041d6b94e8ff8ae995dc3f0cba68d647c6e33a30319a20c645dee879c
+DIST redmine-2.2.3.tar.gz 3754504 SHA256 289e8177d41b33f4db380585251728d7e35283392cd12c5f201681599ef3910a SHA512 26dbb61c6341ce4a2109e4311f69d9a24ebc2b9136a6db508ff07471316d785d7c3b53daf433049a781c4a2125d7b9f57f810cb91e76069459c3bc499ea63871 WHIRLPOOL 01b0015fe83341e823cd72f8ea594ba86756af414d905dd7805e826bcc2316f220234afeb4a202b6b2d1d2c7f28adbb6f86a521749cb3571990cb6ea210e9e4c
+EBUILD redmine-2.2.3.ebuild 6622 SHA256 b62090567b5ee7f1d761079b18db6e5df27e842f008047c5fcdb30dc6e21362d SHA512 99ad772c8c6ea6311c14b02d2f8e6ab4fd5e7d1d5b905435ebb023ddeffb4719eb63039c789dfbaeb670918b4c8efb19f2a42ac9408ea14023c11e6b2ec0944c WHIRLPOOL d35807cf21a727d5d795c2d881f0debf2a39d383cf255429d2812538bb45416de2489526f6fd162a27644eee30e097ea7cf122ab9d95ca88f7149ffc47bfc37c
diff --git a/www-apps/redmine/files/10_redmine_vhost.conf b/www-apps/redmine/files/10_redmine_vhost.conf
new file mode 100644
index 0000000..33a117a
--- /dev/null
+++ b/www-apps/redmine/files/10_redmine_vhost.conf
@@ -0,0 +1,12 @@
+<IfModule passenger_module>
+Listen 3000
+<VirtualHost *:3000>
+ DocumentRoot /var/lib/redmine/public
+# RailsEnv production
+ <Directory "/var/lib/redmine/public">
+ Options FollowSymLinks
+ Order allow,deny
+ Allow from all
+ </Directory>
+</VirtualHost>
+</IfModule>
diff --git a/www-apps/redmine/files/redmine-1.4.1-bundler.patch b/www-apps/redmine/files/redmine-1.4.1-bundler.patch
new file mode 100644
index 0000000..adef29a
--- /dev/null
+++ b/www-apps/redmine/files/redmine-1.4.1-bundler.patch
@@ -0,0 +1,15 @@
+diff -Naurb redmine-1.4.1.orig/config/boot.rb redmine-1.4.1/config/boot.rb
+--- redmine-1.4.1.orig/config/boot.rb 2012-04-20 19:01:56.000000000 +0900
++++ redmine-1.4.1/config/boot.rb 2012-04-25 13:00:01.702911764 +0900
+@@ -41,11 +41,6 @@
+ class Boot
+ def run
+ load_initializer
+- Rails::Initializer.class_eval do
+- def load_gems
+- @bundler_loaded ||= Bundler.require :default, Rails.env
+- end
+- end
+ Rails::Initializer.run(:set_load_path)
+ end
+ end
diff --git a/www-apps/redmine/files/redmine-2.initd b/www-apps/redmine/files/redmine-2.initd
new file mode 100644
index 0000000..e4aece8
--- /dev/null
+++ b/www-apps/redmine/files/redmine-2.initd
@@ -0,0 +1,45 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/redmine/files/redmine-2.initd,v 1.1 2013/01/07 13:39:26 matsuu Exp $
+
+RAILS_ENV=${RAILS_ENV:-production}
+REDMINE_DIR=${REDMINE_DIR:-/var/lib/redmine}
+REDMINE_ADDRESS=${REDMINE_ADDRESS:-localhost}
+REDMINE_PORT=${REDMINE_PORT:-3000}
+REDMINE_USER=${REDMINE_USER:-redmine}
+REDMINE_GROUP=${REDMINE_GROUP:-redmine}
+REDMINE_PIDFILE="${REDMINE_DIR}/tmp/pids/server.pid"
+
+depend() {
+ use apache2 git-daemon mysql net postgresql svnserve
+}
+
+start_pre() {
+ if [ ! -e "${REDMINE_DIR}/config/initializers/secret_token.rb" ] ; then
+ eerror "Execute the following command to initlize environment:"
+ eerror
+ eerror "# emerge --config www-apps/redmine"
+ eerror
+ return 1
+ fi
+}
+
+start() {
+ ebegin "Starting redmine"
+ cd "${REDMINE_DIR}"
+ start-stop-daemon --start --quiet --user ${REDMINE_USER}:${REDMINE_GROUP} \
+ --pidfile "${REDMINE_PIDFILE}" \
+ --exec /usr/bin/ruby "${REDMINE_DIR}"/script/rails server -- \
+ --daemon --environment=${RAILS_ENV} \
+ --binding=${REDMINE_ADDRESS} --port=${REDMINE_PORT} \
+ ${REDMINE_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping redmine"
+ cd "${REDMINE_DIR}"
+ start-stop-daemon --signal INT --quiet --pidfile "${REDMINE_PIDFILE}"
+ eend $?
+}
diff --git a/www-apps/redmine/files/redmine-rubytree-r8214.patch b/www-apps/redmine/files/redmine-rubytree-r8214.patch
new file mode 100644
index 0000000..af325ec
--- /dev/null
+++ b/www-apps/redmine/files/redmine-rubytree-r8214.patch
@@ -0,0 +1,261 @@
+Index: test/unit/lib/redmine/menu_manager/menu_item_test.rb
+===================================================================
+--- test/unit/lib/redmine/menu_manager/menu_item_test.rb (リビジョン 8213)
++++ test/unit/lib/redmine/menu_manager/menu_item_test.rb (リビジョン 8214)
+@@ -114,7 +114,7 @@
+
+ def test_has_children
+ parent_item = get_menu_item(:test_menu, :parent)
+- assert parent_item.hasChildren?
++ assert parent_item.children.present?
+ assert_equal 2, parent_item.children.size
+ assert_equal get_menu_item(:test_menu, :child_menu), parent_item.children[0]
+ assert_equal get_menu_item(:test_menu, :child2_menu), parent_item.children[1]
+Index: config/environment.rb
+===================================================================
+--- config/environment.rb (リビジョン 8213)
++++ config/environment.rb (リビジョン 8214)
+@@ -54,7 +54,6 @@
+ # It will automatically turn deliveries on
+ config.action_mailer.perform_deliveries = false
+
+- config.gem 'rubytree', :lib => 'tree'
+ config.gem 'coderay', :version => '~>1.0.0'
+
+ # Load any local configuration that is kept out of source control
+Index: lib/redmine/menu_manager.rb
+===================================================================
+--- lib/redmine/menu_manager.rb (リビジョン 8213)
++++ lib/redmine/menu_manager.rb (リビジョン 8214)
+@@ -15,93 +15,6 @@
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+-require 'tree' # gem install rubytree
+-
+-# Monkey patch the TreeNode to add on a few more methods :nodoc:
+-module TreeNodePatch
+- def self.included(base)
+- base.class_eval do
+- attr_reader :last_items_count
+-
+- alias :old_initilize :initialize
+- def initialize(name, content = nil)
+- old_initilize(name, content)
+- @childrenHash ||= {}
+- @last_items_count = 0
+- extend(InstanceMethods)
+- end
+- end
+- end
+-
+- module InstanceMethods
+- # Adds the specified child node to the receiver node. The child node's
+- # parent is set to be the receiver. The child is added as the first child in
+- # the current list of children for the receiver node.
+- def prepend(child)
+- raise "Child already added" if @childrenHash.has_key?(child.name)
+-
+- @childrenHash[child.name] = child
+- @children = [child] + @children
+- child.parent = self
+- return child
+-
+- end
+-
+- # Adds the specified child node to the receiver node. The child node's
+- # parent is set to be the receiver. The child is added at the position
+- # into the current list of children for the receiver node.
+- def add_at(child, position)
+- raise "Child already added" if @childrenHash.has_key?(child.name)
+-
+- @childrenHash[child.name] = child
+- @children = @children.insert(position, child)
+- child.parent = self
+- return child
+-
+- end
+-
+- def add_last(child)
+- raise "Child already added" if @childrenHash.has_key?(child.name)
+-
+- @childrenHash[child.name] = child
+- @children << child
+- @last_items_count += 1
+- child.parent = self
+- return child
+-
+- end
+-
+- # Adds the specified child node to the receiver node. The child node's
+- # parent is set to be the receiver. The child is added as the last child in
+- # the current list of children for the receiver node.
+- def add(child)
+- raise "Child already added" if @childrenHash.has_key?(child.name)
+-
+- @childrenHash[child.name] = child
+- position = @children.size - @last_items_count
+- @children.insert(position, child)
+- child.parent = self
+- return child
+-
+- end
+-
+- # Wrapp remove! making sure to decrement the last_items counter if
+- # the removed child was a last item
+- def remove!(child)
+- @last_items_count -= +1 if child && child.last
+- super
+- end
+-
+-
+- # Will return the position (zero-based) of the current child in
+- # it's parent
+- def position
+- self.parent.children.index(self)
+- end
+- end
+-end
+-Tree::TreeNode.send(:include, TreeNodePatch)
+-
+ module Redmine
+ module MenuManager
+ class MenuError < StandardError #:nodoc:
+@@ -169,7 +82,7 @@
+
+ def display_main_menu?(project)
+ menu_name = project && !project.new_record? ? :project_menu : :application_menu
+- Redmine::MenuManager.items(menu_name).size > 1 # 1 element is the root
++ Redmine::MenuManager.items(menu_name).children.present?
+ end
+
+ def render_menu(menu, project=nil)
+@@ -181,7 +94,7 @@
+ end
+
+ def render_menu_node(node, project=nil)
+- if node.hasChildren? || !node.child_menus.nil?
++ if node.children.present? || !node.child_menus.nil?
+ return render_menu_node_with_children(node, project)
+ else
+ caption, url, selected = extract_node_details(node, project)
+@@ -306,13 +219,13 @@
+ end
+
+ def items(menu_name)
+- @items[menu_name.to_sym] || Tree::TreeNode.new(:root, {})
++ @items[menu_name.to_sym] || MenuNode.new(:root, {})
+ end
+ end
+
+ class Mapper
+ def initialize(menu, items)
+- items[menu] ||= Tree::TreeNode.new(:root, {})
++ items[menu] ||= MenuNode.new(:root, {})
+ @menu = menu
+ @menu_items = items[menu]
+ end
+@@ -398,7 +311,102 @@
+ end
+ end
+
+- class MenuItem < Tree::TreeNode
++ class MenuNode
++ include Enumerable
++ attr_accessor :parent
++ attr_reader :last_items_count, :name
++
++ def initialize(name, content = nil)
++ @name = name
++ @childrenHash ||= {}
++ @children = []
++ @last_items_count = 0
++ end
++
++ def children
++ if block_given?
++ @children.each {|child| yield child}
++ else
++ @children
++ end
++ end
++
++ # Returns the number of descendants + 1
++ def size
++ @children.inject(1) {|sum, node| sum + node.size}
++ end
++
++ def each &block
++ yield self
++ children { |child| child.each(&block) }
++ end
++
++ # Adds a child at first position
++ def prepend(child)
++ raise "Child already added" if @childrenHash.has_key?(child.name)
++
++ @childrenHash[child.name] = child
++ @children = [child] + @children
++ child.parent = self
++ return child
++ end
++
++ # Adds a child at given position
++ def add_at(child, position)
++ raise "Child already added" if @childrenHash.has_key?(child.name)
++
++ @childrenHash[child.name] = child
++ @children = @children.insert(position, child)
++ child.parent = self
++ return child
++ end
++
++ # Adds a child as last child
++ def add_last(child)
++ raise "Child already added" if @childrenHash.has_key?(child.name)
++
++ @childrenHash[child.name] = child
++ @children << child
++ @last_items_count += 1
++ child.parent = self
++ return child
++ end
++
++ # Adds a child
++ def add(child)
++ raise "Child already added" if @childrenHash.has_key?(child.name)
++
++ @childrenHash[child.name] = child
++ position = @children.size - @last_items_count
++ @children.insert(position, child)
++ child.parent = self
++ return child
++ end
++ alias :<< :add
++
++ # Removes a child
++ def remove!(child)
++ @childrenHash.delete(child.name)
++ @children.delete(child)
++ @last_items_count -= +1 if child && child.last
++ child.parent = nil
++ child
++ end
++
++ # Returns the position for this node in it's parent
++ def position
++ self.parent.children.index(self)
++ end
++
++ # Returns the root for this node
++ def root
++ root = self
++ root = root.parent while root.parent
++ root
++ end
++ end
++
++ class MenuItem < MenuNode
+ include Redmine::I18n
+ attr_reader :name, :url, :param, :condition, :parent, :child_menus, :last
+
diff --git a/www-apps/redmine/files/redmine.confd b/www-apps/redmine/files/redmine.confd
new file mode 100644
index 0000000..1c3830a
--- /dev/null
+++ b/www-apps/redmine/files/redmine.confd
@@ -0,0 +1,13 @@
+# /etc/conf.d/redmine: config file for /etc/init.d/redmine
+# Bind to specified address
+# You can set to 0.0.0.0 to accept requests anywhere
+#REDMINE_ADDRESS="localhost"
+
+# Port
+#REDMINE_PORT=3000
+
+# RAILS_ENV
+#RAILS_ENV=production
+
+# additional opts
+#REDMINE_OPTS=""
diff --git a/www-apps/redmine/files/redmine.initd b/www-apps/redmine/files/redmine.initd
new file mode 100644
index 0000000..1368da6
--- /dev/null
+++ b/www-apps/redmine/files/redmine.initd
@@ -0,0 +1,45 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/redmine/files/redmine.initd,v 1.4 2012/03/12 16:41:05 matsuu Exp $
+
+RAILS_ENV=${RAILS_ENV:-production}
+REDMINE_DIR=${REDMINE_DIR:-/var/lib/redmine}
+REDMINE_ADDRESS=${REDMINE_ADDRESS:-localhost}
+REDMINE_PORT=${REDMINE_PORT:-3000}
+REDMINE_USER=${REDMINE_USER:-redmine}
+REDMINE_GROUP=${REDMINE_GROUP:-redmine}
+REDMINE_PIDFILE="${REDMINE_DIR}/tmp/pids/server.pid"
+
+depend() {
+ use apache2 git-daemon mysql net postgresql svnserve
+}
+
+start_pre() {
+ if [ ! -e "${REDMINE_DIR}/config/initializers/session_store.rb" ] ; then
+ eerror "Execute the following command to initlize environment:"
+ eerror
+ eerror "# emerge --config www-apps/redmine"
+ eerror
+ return 1
+ fi
+}
+
+start() {
+ ebegin "Starting redmine"
+ cd "${REDMINE_DIR}"
+ start-stop-daemon --start --quiet --user ${REDMINE_USER}:${REDMINE_GROUP} \
+ --pidfile "${REDMINE_PIDFILE}" \
+ --exec /usr/bin/ruby "${REDMINE_DIR}"/script/server -- \
+ --daemon --environment=${RAILS_ENV} \
+ --binding=${REDMINE_ADDRESS} --port=${REDMINE_PORT} \
+ ${REDMINE_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping redmine"
+ cd "${REDMINE_DIR}"
+ start-stop-daemon --signal INT --quiet --pidfile "${REDMINE_PIDFILE}"
+ eend $?
+}
diff --git a/www-apps/redmine/redmine-2.2.3.ebuild b/www-apps/redmine/redmine-2.2.3.ebuild
new file mode 100644
index 0000000..b932d6d
--- /dev/null
+++ b/www-apps/redmine/redmine-2.2.3.ebuild
@@ -0,0 +1,218 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/redmine/redmine-2.2.0.ebuild,v 1.1 2013/01/07 13:39:26 matsuu Exp $
+
+EAPI="3"
+# ruby19: dev-ruby/rack has no ruby19
+# jruby: dev-ruby/rails has no jruby
+# rbx: dev-ruby/rails has no rbx
+#USE_RUBY="ruby18 ree18"
+USE_RUBY="ruby18 ruby19"
+inherit eutils depend.apache ruby-ng
+
+DESCRIPTION="Redmine is a flexible project management web application written using Ruby on Rails framework"
+HOMEPAGE="http://www.redmine.org/"
+SRC_URI="mirror://rubyforge/${PN}/${P}.tar.gz"
+
+KEYWORDS="~amd64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+#IUSE="bazaar cvs darcs fastcgi git imagemagick mercurial mysql openid passenger postgres sqlite3 subversion"
+IUSE="fastcgi imagemagick ldap openid passenger"
+
+#RDEPEND="$(ruby_implementation_depend ruby18 '>=' -1.8.6)[ssl]"
+
+ruby_add_rdepend "virtual/ruby-ssl
+ virtual/rubygems
+ >=dev-ruby/coderay-1.0.6
+ dev-ruby/i18n:0.6
+ dev-ruby/rake
+ ~dev-ruby/rails-3.2.12:3.2
+ >=dev-ruby/jquery-rails-2.0.2
+ dev-ruby/builder:3
+ fastcgi? ( dev-ruby/fcgi )
+ imagemagick? ( >=dev-ruby/rmagick-2 )
+ ldap? ( >=dev-ruby/ruby-net-ldap-0.3.1 )
+ openid? (
+ >=dev-ruby/ruby-openid-2.1.4
+ >=dev-ruby/rack-openid-0.2.1
+ )
+ passenger? ( www-apache/passenger )
+ "
+# ruby_targets_ruby18? (
+# >=dev-ruby/fastercsv-1.5
+# postgres? ( >=dev-ruby/pg-0.11 )
+# sqlite3? ( dev-ruby/sqlite3 )
+# mysql? ( >=dev-ruby/mysql-ruby-2.8.1 )
+# )
+# ruby_targets_ruby19? (
+# postgres? ( >=dev-ruby/pg-0.11 )
+# sqlite3? ( dev-ruby/sqlite3 )
+# mysql? ( dev-ruby/mysql2:0.3 )
+# )
+# ruby_targets_jruby? (
+# dev-ruby/jruby-openssl
+# >=dev-ruby/fastercsv-1.5
+# mysql? ( dev-ruby/activerecord-jdbcmysql-adapter )
+# postgres? ( dev-ruby/activerecord-jdbcpostgresql-adapter )
+# sqlite3? ( dev-ruby/activerecord-jdbcsqlite3-adapter )
+# )
+
+#ruby_add_bdepend ">=dev-ruby/rdoc-2.4.2
+# yard
+# test? (
+# !ruby_targets_ruby19? (
+# >=dev-ruby/shoulda-2.11
+# )
+# ruby_targets_ruby19? (
+# dev-ruby/test-unit
+# )
+# ruby_targets_jruby? (
+# dev-ruby/test-unit
+# )
+# >=dev-ruby/mocha-0.12.3
+# )"
+
+#RDEPEND="${RDEPEND}
+# bazaar ( dev-vcs/bazaar )
+# cvs? ( >=dev-vcs/cvs-1.12 )
+# darcs? ( dev-vcs/darcs )
+# git? ( dev-vcs/git )
+# mercurial? ( dev-vcs/mercurial )
+# subversion? ( >=dev-vcs/subversion-1.3 )"
+
+REDMINE_DIR="/var/lib/${PN}"
+
+pkg_setup() {
+ enewgroup redmine
+ # home directory is required for SCM.
+ enewuser redmine -1 -1 "${REDMINE_DIR}" redmine
+}
+
+all_ruby_prepare() {
+ rm -r log files/delete.me || die
+
+ # bug #406605
+ rm .gitignore .hgignore || die
+
+ rm Gemfile config/preinitializer.rb || die
+
+ echo "CONFIG_PROTECT=\"${EPREFIX}${REDMINE_DIR}/config\"" > "${T}/50${PN}"
+ echo "CONFIG_PROTECT_MASK=\"${EPREFIX}${REDMINE_DIR}/config/locales ${EPREFIX}${REDMINE_DIR}/config/settings.yml\"" >> "${T}/50${PN}"
+}
+
+all_ruby_install() {
+ dodoc doc/{CHANGELOG,INSTALL,README_FOR_APP,RUNNING_TESTS,UPGRADING} || die
+ rm -fr doc || die
+ dodoc README.rdoc || die
+ rm README.rdoc || die
+
+ keepdir /var/log/${PN} || die
+ dosym /var/log/${PN}/ "${REDMINE_DIR}/log" || die
+
+ insinto "${REDMINE_DIR}"
+ doins -r . || die
+ keepdir "${REDMINE_DIR}/files" || die
+ keepdir "${REDMINE_DIR}/public/plugin_assets" || die
+
+ fowners -R redmine:redmine \
+ "${REDMINE_DIR}/config" \
+ "${REDMINE_DIR}/files" \
+ "${REDMINE_DIR}/public/plugin_assets" \
+ "${REDMINE_DIR}/tmp" \
+ /var/log/${PN} || die
+ # for SCM
+ fowners redmine:redmine "${REDMINE_DIR}" || die
+ # bug #406605
+ fperms -R go-rwx \
+ "${REDMINE_DIR}/config" \
+ "${REDMINE_DIR}/files" \
+ "${REDMINE_DIR}/tmp" \
+ /var/log/${PN} || die
+
+ if use passenger ; then
+ has_apache
+ insinto "${APACHE_VHOSTS_CONFDIR}"
+ doins "${FILESDIR}/10_redmine_vhost.conf" || die
+ else
+ newconfd "${FILESDIR}/${PN}.confd" ${PN} || die
+ newinitd "${FILESDIR}/${PN}-2.initd" ${PN} || die
+ keepdir /var/run/${PN} || die
+ fowners -R redmine:redmine /var/run/${PN} || die
+ dosym /var/run/${PN}/ "${REDMINE_DIR}/tmp/pids" || die
+ fi
+ doenvd "${T}/50${PN}" || die
+}
+
+pkg_postinst() {
+ einfo
+ if [ -e "${EPREFIX}${REDMINE_DIR}/config/initializers/session_store.rb" -o -e "${EPREFIX}${REDMINE_DIR}/config/initializers/secret_token.rb" ] ; then
+ elog "Execute the following command to upgrade environment:"
+ elog
+ elog "# emerge --config \"=${CATEGORY}/${PF}\""
+ elog
+ elog "For upgrade instructions take a look at:"
+ elog "http://www.redmine.org/wiki/redmine/RedmineUpgrade"
+ else
+ elog "Execute the following command to initlize environment:"
+ elog
+ elog "# cd ${EPREFIX}${REDMINE_DIR}"
+ elog "# cp config/database.yml.example config/database.yml"
+ elog "# \${EDITOR} config/database.yml"
+ elog "# chown redmine:redmine config/database.yml"
+ elog "# emerge --config \"=${CATEGORY}/${PF}\""
+ elog
+ elog "Installation notes are at official site"
+ elog "http://www.redmine.org/wiki/redmine/RedmineInstall"
+ fi
+ einfo
+}
+
+pkg_config() {
+ if [ ! -e "${EPREFIX}${REDMINE_DIR}/config/database.yml" ] ; then
+ eerror "Copy ${EPREFIX}${REDMINE_DIR}/config/database.yml.example to ${EPREFIX}${REDMINE_DIR}/config/database.yml and edit this file in order to configure your database settings for \"production\" environment."
+ die
+ fi
+
+ local RAILS_ENV=${RAILS_ENV:-production}
+ local RUBY=${RUBY:-ruby18}
+
+ cd "${EPREFIX}${REDMINE_DIR}"
+ if [ -e "${EPREFIX}${REDMINE_DIR}/config/initializers/session_store.rb" ] ; then
+ einfo
+ einfo "Generate secret token."
+ einfo
+ rm config/initializers/session_store.rb || die
+ RAILS_ENV="${RAILS_ENV}" ${RUBY} -S rake generate_secret_token || die
+ fi
+ if [ -e "${EPREFIX}${REDMINE_DIR}/config/initializers/secret_token.rb" ] ; then
+ einfo
+ einfo "Upgrade database."
+ einfo
+
+ einfo "Migrate database."
+ RAILS_ENV="${RAILS_ENV}" ${RUBY} -S rake db:migrate || die
+ einfo "Upgrade the plugin migrations."
+ RAILS_ENV="${RAILS_ENV}" ${RUBY} -S rake redmine:plugins:migrate || die
+ einfo "Clear the cache and the existing sessions."
+ ${RUBY} -S rake tmp:cache:clear || die
+ ${RUBY} -S rake tmp:sessions:clear || die
+ else
+ einfo
+ einfo "Initialize database."
+ einfo
+
+ einfo "Generate a session store secret."
+ ${RUBY} -S rake generate_secret_token || die
+ einfo "Create the database structure."
+ RAILS_ENV="${RAILS_ENV}" ${RUBY} -S rake db:migrate || die
+ einfo "Insert default configuration data in database."
+ RAILS_ENV="${RAILS_ENV}" ${RUBY} -S rake redmine:load_default_data || die
+ einfo
+ einfo "If you use sqlite3. please do not forget to change the ownership of the sqlite files."
+ einfo
+ einfo "# cd \"${EPREFIX}${REDMINE_DIR}\""
+ einfo "# chown redmine:redmine db/ db/*.sqlite3"
+ einfo
+ fi
+}