From 81399812c7bb31a9df5a7b7dac34facd2db3deb2 Mon Sep 17 00:00:00 2001 From: Jaroslav Hron Date: Fri, 12 Apr 2013 14:35:19 +0200 Subject: new redmine from mva --- www-apps/redmine/Manifest | 2 + www-apps/redmine/files/no_ldap-2.2.2.patch | 11 ++ www-apps/redmine/files/no_ldap-2.2.4.patch | 11 ++ www-apps/redmine/files/no_ldap-2.3.0.patch | 11 ++ www-apps/redmine/files/openid.patch | 270 ++++++++++++++++++++++++++++ www-apps/redmine/files/simple_captcha.patch | 77 ++++++++ www-apps/redmine/redmine-2.2.4.ebuild | 201 +++++++++++++++++++++ 7 files changed, 583 insertions(+) create mode 100644 www-apps/redmine/files/no_ldap-2.2.2.patch create mode 100644 www-apps/redmine/files/no_ldap-2.2.4.patch create mode 100644 www-apps/redmine/files/no_ldap-2.3.0.patch create mode 100644 www-apps/redmine/files/openid.patch create mode 100644 www-apps/redmine/files/simple_captcha.patch create mode 100644 www-apps/redmine/redmine-2.2.4.ebuild diff --git a/www-apps/redmine/Manifest b/www-apps/redmine/Manifest index 1443f54..0087019 100644 --- a/www-apps/redmine/Manifest +++ b/www-apps/redmine/Manifest @@ -5,4 +5,6 @@ AUX redmine-rubytree-r8214.patch 8082 SHA256 4fea78ac11b90a44d94bca2f424c0c180ae 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 +DIST redmine-2.2.4.tar.gz 3754826 SHA256 8465eb42865f7b5972a27fd66f08678244a77f7fc495ccb99978fbdbf8968d7f SHA512 d6ed394de71db1b98d22f47e105b698c798d84887161977d264f1629e8d5e917a0f24fd633378c855243609d9b318d81a81dc4d703198f043a24f01fcbdd6024 WHIRLPOOL fcd3c79dfab006f2eade4d9ae3d6d987731a7e21a7c51727fb184291e98364f6be7b96452ebd33419565069a2cc757d5f2b606ba8c2dcca3d4b685067b333f1b EBUILD redmine-2.2.3.ebuild 6622 SHA256 b62090567b5ee7f1d761079b18db6e5df27e842f008047c5fcdb30dc6e21362d SHA512 99ad772c8c6ea6311c14b02d2f8e6ab4fd5e7d1d5b905435ebb023ddeffb4719eb63039c789dfbaeb670918b4c8efb19f2a42ac9408ea14023c11e6b2ec0944c WHIRLPOOL d35807cf21a727d5d795c2d881f0debf2a39d383cf255429d2812538bb45416de2489526f6fd162a27644eee30e097ea7cf122ab9d95ca88f7149ffc47bfc37c +EBUILD redmine-2.2.4.ebuild 6609 SHA256 5b385c353c781127cfe9c70044ec2f5bc51d8e7d354ae11601b4732345eefcdd SHA512 338209165af6da847f87eccd067fd78bc3bf8d1cada23eef3f4beb008b8ca31bddd65badc9f302e8faf8a835fa4b1d3096a7b095352030429f420f5c22b291ae WHIRLPOOL 4eb50ab5ade6e34450844d79b990291b18ffb9270c263104a0fc9dc8059ebede8205104f4c10d020aa5dfe2433f118ae9ace34f2047934dcbe63707bec531778 diff --git a/www-apps/redmine/files/no_ldap-2.2.2.patch b/www-apps/redmine/files/no_ldap-2.2.2.patch new file mode 100644 index 0000000..ad654be --- /dev/null +++ b/www-apps/redmine/files/no_ldap-2.2.2.patch @@ -0,0 +1,11 @@ +--- lib/redmine.rb.old 2013-02-03 19:09:11.267220350 +0400 ++++ lib/redmine.rb 2013-02-03 19:09:17.992220522 +0400 +@@ -186,8 +186,6 @@ + :html => {:class => 'custom_fields'} + menu.push :enumerations, {:controller => 'enumerations'} + menu.push :settings, {:controller => 'settings'} +- menu.push :ldap_authentication, {:controller => 'auth_sources', :action => 'index'}, +- :html => {:class => 'server_authentication'} + menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true + menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true + end diff --git a/www-apps/redmine/files/no_ldap-2.2.4.patch b/www-apps/redmine/files/no_ldap-2.2.4.patch new file mode 100644 index 0000000..ad654be --- /dev/null +++ b/www-apps/redmine/files/no_ldap-2.2.4.patch @@ -0,0 +1,11 @@ +--- lib/redmine.rb.old 2013-02-03 19:09:11.267220350 +0400 ++++ lib/redmine.rb 2013-02-03 19:09:17.992220522 +0400 +@@ -186,8 +186,6 @@ + :html => {:class => 'custom_fields'} + menu.push :enumerations, {:controller => 'enumerations'} + menu.push :settings, {:controller => 'settings'} +- menu.push :ldap_authentication, {:controller => 'auth_sources', :action => 'index'}, +- :html => {:class => 'server_authentication'} + menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true + menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true + end diff --git a/www-apps/redmine/files/no_ldap-2.3.0.patch b/www-apps/redmine/files/no_ldap-2.3.0.patch new file mode 100644 index 0000000..ad654be --- /dev/null +++ b/www-apps/redmine/files/no_ldap-2.3.0.patch @@ -0,0 +1,11 @@ +--- lib/redmine.rb.old 2013-02-03 19:09:11.267220350 +0400 ++++ lib/redmine.rb 2013-02-03 19:09:17.992220522 +0400 +@@ -186,8 +186,6 @@ + :html => {:class => 'custom_fields'} + menu.push :enumerations, {:controller => 'enumerations'} + menu.push :settings, {:controller => 'settings'} +- menu.push :ldap_authentication, {:controller => 'auth_sources', :action => 'index'}, +- :html => {:class => 'server_authentication'} + menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true + menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true + end diff --git a/www-apps/redmine/files/openid.patch b/www-apps/redmine/files/openid.patch new file mode 100644 index 0000000..2d2644c --- /dev/null +++ b/www-apps/redmine/files/openid.patch @@ -0,0 +1,270 @@ +--- app/controllers/account_controller.rb ++++ app/controllers/account_controller.rb +@@ -29,11 +29,34 @@ class AccountController < ApplicationController + self.logged_user = nil + else + # Authenticate user +- if Setting.openid? && using_open_id? +- open_id_authenticate(params[:openid_url]) +- else +- password_authentication ++ password_authentication ++ end ++ end ++ ++ def openid_login ++ if !Setting.openid? ++ render_404 ++ end ++ if Setting.openid_only? ++ open_id_authenticate('iduser.net') ++ return ++ end ++ @server = '0' ++ if request.get? ++ # Logout user ++ self.logged_user = nil ++ elsif using_open_id? ++ # Authenticate user ++ if params[:server] ++ if params[:server] == '0' ++ params[:openid_url] = 'iduser.net' ++ elsif !simple_captcha_valid? ++ flash.now[:error] = l(:notice_account_invalid_captcha) ++ @server = params[:server] ++ return ++ end + end ++ open_id_authenticate(params[:openid_url]) + end + end + +@@ -153,7 +176,7 @@ class AccountController < ApplicationController + + + def open_id_authenticate(openid_url) +- authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url) do |result, identity_url, registration| ++ authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => url_for(:action => 'openid_login')) do |result, identity_url, registration| + if result.successful? + user = User.find_or_initialize_by_identity_url(identity_url) + if user.new_record? +--- app/models/setting.rb ++++ app/models/setting.rb +@@ -143,6 +143,10 @@ class Setting < ActiveRecord::Base + def self.openid? + Object.const_defined?(:OpenID) && self[:openid].to_i > 0 + end ++ ++ def self.openid_only? ++ Object.const_defined?(:OpenID) && self[:openid_only].to_i > 0 ++ end + + # Checks if settings have changed since the values were read + # and clears the cache hash if it's the case +--- app/views/account/login.rhtml ++++ app/views/account/login.rhtml +@@ -10,12 +10,6 @@ + + <%= password_field_tag 'password', nil, :tabindex => '2' %> + +-<% if Setting.openid? %> +- +- +- <%= text_field_tag "openid_url", nil, :tabindex => '3' %> +- +-<% end %> + + + +--- app/views/settings/_authentication.rhtml ++++ app/views/settings/_authentication.rhtml +@@ -29,6 +29,11 @@ + <%= hidden_field_tag 'settings[openid]', 0 %> + <%= check_box_tag 'settings[openid]', 1, Setting.openid?, :disabled => !Object.const_defined?(:OpenID) %> +

++ ++

++<%= hidden_field_tag 'settings[openid_only]', 0 %> ++<%= check_box_tag 'settings[openid_only]', 1, Setting.openid_only?, :disabled => !Object.const_defined?(:OpenID) %> ++

+ + +
+--- config/locales/en.yml ++++ config/locales/en.yml +@@ -125,6 +125,7 @@ en: + + notice_account_updated: Account was successfully updated. + notice_account_invalid_creditentials: Invalid user or password ++ notice_account_invalid_captcha: You did not enter the correct code. Please try again. + notice_account_password_updated: Password was successfully updated. + notice_account_wrong_password: Wrong password + notice_account_register_done: Account was successfully created. To activate your account, click on the link that was emailed to you. +@@ -265,6 +266,9 @@ en: + field_editable: Editable + field_watcher: Watcher + field_identity_url: OpenID URL ++ field_login_with: Sign In with a ++ field_other_openid: other OpenID ++ field_captcha_valid: Verification + field_content: Content + field_group_by: Group results by + +@@ -311,6 +315,7 @@ en: + setting_file_max_size_displayed: Max size of text files displayed inline + setting_repository_log_display_limit: Maximum number of revisions displayed on file log + setting_openid: Allow OpenID login and registration ++ setting_openid_only: Allow only OpenID + setting_password_min_length: Minimum password length + setting_new_project_user_role_id: Role given to a non-admin user who creates a project + setting_default_projects_modules: Default enabled modules for new projects +@@ -425,6 +430,7 @@ en: + label_information_plural: Information + label_please_login: Please log in + label_register: Register ++ label_openid_register: Register OpenID + label_login_with_open_id_option: or login with OpenID + label_password_lost: Lost password + label_home: Home +@@ -433,6 +438,7 @@ en: + label_my_projects: My projects + label_administration: Administration + label_login: Sign in ++ label_openid_login: Sign in with OpenID + label_logout: Sign out + label_help: Help + label_reported_issues: Reported issues +--- config/locales/ru.yml ++++ config/locales/ru.yml +@@ -315,6 +315,9 @@ ru: + field_hours: час(а,ов) + field_identifier: Уникальный идентификатор + field_identity_url: OpenID URL ++ field_login_with: Войти как ++ field_other_openid: другой OpenID ++ field_captcha_valid: Проверка + field_is_closed: Задача закрыта + field_is_default: Значение по умолчанию + field_is_filter: Используется в качестве фильтра +@@ -543,6 +546,7 @@ ru: + label_loading: Загрузка... + label_logged_as: Вошел как + label_login: Войти ++ label_openid_login: Вход с помощью OpenID + label_login_with_open_id_option: или войти с помощью OpenID + label_logout: Выйти + label_max_size: Максимальный размер +@@ -616,6 +620,7 @@ ru: + label_query_plural: Сохраненные запросы + label_read: Чтение... + label_register: Регистрация ++ label_openid_register: Регистрация OpenID + label_registered_on: Зарегистрирован(а) + label_registration_activation_by_email: активация учетных записей по email + label_registration_automatic_activation: автоматическая активация учетных записей +@@ -736,6 +740,7 @@ ru: + + notice_account_activated: Ваша учетная запись активирована. Вы можете войти. + notice_account_invalid_creditentials: Неправильное имя пользователя или пароль ++ notice_account_invalid_captcha: Вы ввели не верный код. Пожалуйста, попробуйте еще раз. + notice_account_lost_email_sent: Вам отправлено письмо с инструкциями по выбору нового пароля. + notice_account_password_updated: Пароль успешно обновлен. + notice_account_pending: "Ваша учетная запись уже создана и ожидает подтверждения администратора." +@@ -846,6 +851,7 @@ ru: + setting_mail_handler_api_enabled: Включить веб-сервис для входящих сообщений + setting_mail_handler_api_key: API ключ + setting_openid: Разрешить OpenID для входа и регистрации ++ setting_openid_only: Разрешить только OpenID + setting_per_page_options: Количество строк на страницу + setting_plain_text_mail: Только простой текст (без HTML) + setting_protocol: Протокол +--- config/settings.yml ++++ config/settings.yml +@@ -168,5 +168,7 @@ gravatar_enabled: + default: 0 + openid: + default: 0 ++openid_only: ++ default: 0 + gravatar_default: + default: '' +--- lib/redmine.rb ++++ lib/redmine.rb +@@ -124,8 +124,9 @@ Redmine::MenuManager.map :top_menu do |menu| + end + + Redmine::MenuManager.map :account_menu do |menu| +- menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } +- menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } ++ menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? && !Setting.openid_only?} ++ menu.push :openid_login, { :controller => 'account', :action => 'openid_login' }, :if => Proc.new { !User.current.logged? && Setting.openid?} ++ menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? && !Setting.openid_only? } + menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } + menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } + end +--- vendor/plugins/open_id_authentication/lib/open_id_authentication.rb ++++ vendor/plugins/open_id_authentication/lib/open_id_authentication.rb +@@ -118,7 +118,7 @@ module OpenIdAuthentication + # because that's what the specification dictates in order to get browser auto-complete working across sites + def using_open_id?(identity_url = nil) #:doc: + identity_url ||= params[:openid_identifier] || params[:openid_url] +- !identity_url.blank? || params[:open_id_complete] ++ !identity_url.blank? || params[:server] || params[:open_id_complete] + end + + def authenticate_with_open_id(identity_url = nil, options = {}, &block) #:doc: +--- /dev/null ++++ app/views/account/openid_login.rhtml +@@ -0,0 +1,52 @@ ++
++<% form_tag({:action=> "openid_login"}) do %> ++<%= back_url_hidden_field_tag %> ++ ++ ++ ++ ++ ++ style="display:none"<% end %>> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++
++<%= select_tag 'server', ++ options_for_select( [['iduser.net', "0"], ++ [l(:field_other_openid), "1"], ++ ], @server ) %> ++ ++
<%= show_simple_captcha(:label => '') %>
++ <% if Setting.autologin? %> ++ ++ <% end %> ++
++ ++ <%= link_to l(:label_openid_register), 'http://iduser.net/register/' %> ++
++
++<% end %> diff --git a/www-apps/redmine/files/simple_captcha.patch b/www-apps/redmine/files/simple_captcha.patch new file mode 100644 index 0000000..7ab0de3 --- /dev/null +++ b/www-apps/redmine/files/simple_captcha.patch @@ -0,0 +1,77 @@ +--- app/controllers/application_controller.rb ++++ app/controllers/application_controller.rb +@@ -19,6 +19,7 @@ require 'uri' + require 'cgi' + + class ApplicationController < ActionController::Base ++ include SimpleCaptcha::ControllerHelpers + include Redmine::I18n + + layout 'base' +--- config/routes.rb ++++ config/routes.rb +@@ -269,4 +269,6 @@ ActionController::Routing::Routes.draw do |map| + map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' + # Used for OpenID + map.root :controller => 'account', :action => 'login' ++ # Captcha ++ map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha' + end +--- vendor/plugins/simple_captcha/lib/simple_captcha_config.rb ++++ vendor/plugins/simple_captcha/lib/simple_captcha_config.rb +@@ -12,7 +12,7 @@ module SimpleCaptcha #:nodoc + end + + def simple_captcha_key #:nodoc +- session[:simple_captcha] ||= Digest::SHA1.hexdigest(Time.now.to_s + session.session_id.to_s) ++ session[:simple_captcha] ||= Digest::SHA1.hexdigest(Time.now.to_s) + end + + def simple_captcha_value(key = simple_captcha_key) #:nodoc +--- app/controllers/account_controller.rb ++++ app/controllers/account_controller.rb +@@ -92,6 +92,7 @@ class AccountController < ApplicationController + @user = User.new(params[:user]) + @user.admin = false + @user.status = User::STATUS_REGISTERED ++ captcha_valid = simple_captcha_valid? + if session[:auth_source_registration] + @user.status = User::STATUS_ACTIVE + @user.login = session[:auth_source_registration][:login] +@@ -106,13 +107,18 @@ class AccountController < ApplicationController + @user.login = params[:user][:login] + @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] + +- case Setting.self_registration +- when '1' +- register_by_email_activation(@user) +- when '3' +- register_automatically(@user) ++ if !captcha_valid ++ @user.valid? ++ @user.errors.add :base, l(:notice_account_invalid_captcha) + else +- register_manually_by_administrator(@user) ++ case Setting.self_registration ++ when '1' ++ register_by_email_activation(@user) ++ when '3' ++ register_automatically(@user) ++ else ++ register_manually_by_administrator(@user) ++ end + end + end + end +--- app/views/account/register.rhtml ++++ app/views/account/register.rhtml +@@ -37,6 +37,9 @@ + <% @user.custom_field_values.select {|v| v.editable? || v.required?}.each do |value| %> +

<%= custom_field_tag_with_label :user, value %>

+ <% end %> ++ ++

++<%= show_simple_captcha(:label => '') %>

+ +
+ diff --git a/www-apps/redmine/redmine-2.2.4.ebuild b/www-apps/redmine/redmine-2.2.4.ebuild new file mode 100644 index 0000000..6e22ac9 --- /dev/null +++ b/www-apps/redmine/redmine-2.2.4.ebuild @@ -0,0 +1,201 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-apps/redmine/redmine-1.4.1.ebuild,v 1.1 2012/04/25 15:02:00 matsuu Exp $ + +EAPI="5" +USE_RUBY="ruby18 ree18 jruby 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 ldap" + +RDEPEND="|| ( $(ruby_implementation_depend ruby18 '>=' -1.8.6)[ssl] $(ruby_implementation_depend ruby19)[ssl] )" + +ruby_add_rdepend " + dev-ruby/bundler + virtual/rubygems + passenger? ( || ( www-apache/passenger www-servers/nginx[nginx_modules_http_passenger] ) ) + fastcgi? ( + dev-ruby/fcgi + ruby_targets_ruby19? ( + >=dev-ruby/fcgi-0.9.1 + ) + ) +" + +#ruby_add_bdepend ">=dev-ruby/rdoc-2.4.2 +# test? ( +# >=dev-ruby/shoulda-2.10.3 +# >=dev-ruby/edavis10-object_daddy +# >=dev-ruby/mocha +# )" + +RDEPEND="${RDEPEND} + postgres? ( dev-db/postgresql-base ) + sqlite3? ( dev-db/sqlite:3 ) + mysql? ( virtual/mysql ) + bazaar? ( dev-vcs/bzr ) + 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="${REDMINE_DIR:-/var/lib/${PN}}" + +pkg_setup() { + enewgroup "${HTTPD_GROUP:-redmine}" + # home directory is required for SCM. + enewuser "${HTTPD_USER-redmine}" -1 -1 "${REDMINE_DIR}" "${HTTPD_USER:-redmine}" +} + +all_ruby_prepare() { + rm -r log files/delete.me || 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}" + echo "RAILS_ENV=${RAILS_ENV:-production}" >> "${T}/50${PN}" +} + +all_ruby_install() { + local REDMINE_USER REDMINE_GROUP + REDMINE_USER="${HTTPD_USER:-redmine}" + REDMINE_GROUP="${HTTPD_GROUP:-redmine}" + + use ldap || ( + rm app/models/auth_source_ldap.rb + epatch "${FILESDIR}/no_ldap-${PV}.patch" + ) + use openid || rm -rf lib/plugins/open_id_authentication + 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_USER}:${REDMINE_GROUP}" \ + "${REDMINE_DIR}/config" \ + "${REDMINE_DIR}/files" \ + "${REDMINE_DIR}/public/plugin_assets" \ + "${REDMINE_DIR}/tmp" \ + /var/log/${PN} || die + # for SCM + fowners "${REDMINE_USER}:${REDMINE_GROUP}" "${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 + if [[ $APACHE_VERSION -gt 0 ]]; then + insinto "${APACHE_VHOSTS_CONFDIR}" + doins "${FILESDIR}/10_redmine_vhost.conf" || die + fi + else + newconfd "${FILESDIR}/${PN}.confd" ${PN} || die + newinitd "${FILESDIR}/${PN}.initd" ${PN} || die + keepdir /var/run/${PN} || die + fowners -R "${REDMINE_USER}:${REDMINE_GROUP}" /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" ] ; 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 commands to initlize environment:" + elog + elog "# cd ${EPREFIX}${REDMINE_DIR}" + elog "# cp config/database.yml.example config/database.yml" + elog "# \${EDITOR} config/database.yml # (configure your database connection)" + elog "# chown "${REDMINE_USER}:${REDMINE_GROUP}" 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:-ruby} + local without + + without="--without" + use ldap || without="${without} ldap" + use mysql || without="${without} mysql" + use openid || without="${without} openid" + use postgres || without="${without} postgresql" + use imagemagick || without="${without} rmagick" + use sqlite3 || without="${without} sqlite" + without="${without} development test" + + cd "${EPREFIX}${REDMINE_DIR}" + einfo "Installing and updating bundled gems, since it is ONLY way, supported by upstream and many plugins" + RAILS_ENV="${RAILS_ENV}" bundle install --path ./vendor/bundle ${without} + RAILS_ENV="${RAILS_ENV}" bundle update + chown "${REDMINE_USER}":"${REDMINE_GROUP}" -R ./vendor/bundle + if [ -e "${EPREFIX}${REDMINE_DIR}/config/initializers/session_store.rb" ] ; then + einfo + einfo "Upgrade database." + einfo + + einfo "Migrate database." + RAILS_ENV="${RAILS_ENV}" ${RUBY} -S bundle exec rake db:migrate || die + einfo "Upgrade the plugin migrations." + RAILS_ENV="${RAILS_ENV}" ${RUBY} -S bundle exec rake redmine:plugins || die + einfo "Clear the cache and the existing sessions." + ${RUBY} -S bundle exec rake tmp:cache:clear || die + ${RUBY} -S bundle exec rake tmp:sessions:clear || die + else + einfo + einfo "Initialize database." + einfo + + einfo "Generate a session store secret." + ${RUBY} -S bundle exec rake generate_secret_token || die + einfo "Create the database structure." + RAILS_ENV="${RAILS_ENV}" ${RUBY} -S bundle exec rake db:migrate || die + einfo "Insert default configuration data in database." + RAILS_ENV="${RAILS_ENV}" ${RUBY} -S bundle exec rake redmine:load_default_data || die + if use sqlite3; then + einfo + einfo "Please do not forget to change the ownership of the sqlite files." + einfo + einfo "# cd \"${EPREFIX}${REDMINE_DIR}\"" + einfo "# chown "${REDMINE_USER}:${REDMINE_GROUP}" db/ db/*.sqlite3" + einfo + fi + fi +} -- cgit v1.2.3-65-gdbad