michael@764: ## michael@764: ## chiliproj.spec -- OpenPKG RPM Package Specification michael@764: ## Copyright (c) 2013 Michael Schloh von Bennewitz michael@764: ## michael@764: ## Permission to use, copy, modify, and distribute this software for michael@764: ## any purpose with or without fee is hereby granted, provided that michael@764: ## the above copyright notice and this permission notice appear in all michael@764: ## copies. michael@764: ## michael@764: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@764: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@764: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@764: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@764: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@764: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@764: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@764: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@764: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@764: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@764: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@764: ## SUCH DAMAGE. michael@764: ## michael@764: michael@764: # FIXME: GEM_HOME=$HOME/.gem RAILS_ENV=production PATH=$PATH:%{l_prefix}/lib/ruby/gems/1.9.1/bin bundle install --without test development mysql postgres rmagick michael@767: # FIXME: %{l_prefix}/lib/ruby/gems/1.9.1/bin/rake -T (or -D) michael@765: # FIXME: Reduce %post by removing RAILS_ENV=production michael@765: # FIXME: Consider using imagemagick for Gantt? michael@764: # FIXME: bundle exec rails s michael@764: # FIXME: w3m http://localhost:3000/ michael@764: # FIXME: log in with Login: admin and Password: admin michael@764: michael@764: # package version michael@764: %define V_pref 427 michael@764: %define V_rake 10.0.4 michael@764: %define V_activesupport 2.3.18 michael@764: %define V_rack 1.1.6 michael@764: %define V_actionpack 2.3.18 michael@764: %define V_actionmailer 2.3.18 michael@764: %define V_activerecord 2.3.18 michael@764: %define V_activeresource 2.3.18 michael@764: %define V_rails 2.3.18 michael@764: %define V_actsastaggable 2.1.0 michael@764: %define V_coderay 1.0.9 michael@764: %define V_daemons 1.1.9 michael@764: %define V_eventmachine 1.0.3 michael@764: %define V_gravatarify 3.0.0 michael@764: %define V_i18n 0.4.2 michael@764: %define V_json 1.7.7 michael@764: %define V_liquid 2.3.0 michael@764: %define V_mysql2 0.2.18 michael@764: %define V_netldap 0.3.1 michael@764: %define V_rdoc 4.0.1 michael@764: %define V_rubyopenid 2.1.8 michael@764: %define V_rubytree 0.5.3 michael@764: %define V_sqlite3 1.3.7 michael@764: %define V_thin 1.5.1 michael@764: %define V_tzinfo 0.3.37 michael@764: %define V_bundler 1.3.4 michael@764: michael@764: # package information michael@764: Name: chiliproj michael@764: Summary: Comprehensive Rails-based Project Manager michael@764: URL: http://www.chiliproject.org/ michael@764: Vendor: Felix Schaefer et al. michael@764: Packager: Michael Schloh von Bennewitz michael@764: Distribution: Europalab Networks Production michael@764: Class: EVAL michael@764: Group: Calendar michael@764: License: GPL michael@765: Version: 20130401 michael@764: Release: 20120800 michael@764: michael@764: # list of sources michael@764: Source0: http://www.chiliproject.org/attachments/download/%{V_pref}/chiliproject-%{version}.tar.bz2 michael@764: Source1: rc.chiliproj michael@764: Source2: Gemfile.lock michael@764: Source3: http://rubygems.org/downloads/rake-%{V_rake}.gem michael@764: Source4: http://rubygems.org/downloads/activesupport-%{V_activesupport}.gem michael@764: Source5: http://rubygems.org/downloads/rack-%{V_rack}.gem michael@764: Source6: http://rubygems.org/downloads/actionpack-%{V_actionpack}.gem michael@764: Source7: http://rubygems.org/downloads/actionmailer-%{V_actionmailer}.gem michael@764: Source8: http://rubygems.org/downloads/activerecord-%{V_activerecord}.gem michael@764: Source9: http://rubygems.org/downloads/activeresource-%{V_activeresource}.gem michael@764: Source10: http://rubygems.org/downloads/rails-%{V_rails}.gem michael@764: Source11: http://rubygems.org/downloads/acts-as-taggable-on-%{V_actsastaggable}.gem michael@764: Source12: http://rubygems.org/downloads/coderay-%{V_coderay}.gem michael@764: Source13: http://rubygems.org/downloads/daemons-%{V_daemons}.gem michael@764: Source14: http://rubygems.org/downloads/eventmachine-%{V_eventmachine}.gem michael@764: Source15: http://rubygems.org/downloads/gravatarify-%{V_gravatarify}.gem michael@764: Source16: http://rubygems.org/downloads/i18n-%{V_i18n}.gem michael@764: Source17: http://rubygems.org/downloads/json-%{V_json}.gem michael@764: Source18: http://rubygems.org/downloads/liquid-%{V_liquid}.gem michael@764: Source19: http://rubygems.org/downloads/mysql2-%{V_mysql2}.gem michael@764: Source20: http://rubygems.org/downloads/net-ldap-%{V_netldap}.gem michael@764: Source21: http://rubygems.org/downloads/rdoc-%{V_rdoc}.gem michael@764: Source22: http://rubygems.org/downloads/ruby-openid-%{V_rubyopenid}.gem michael@764: Source23: http://rubygems.org/downloads/rubytree-%{V_rubytree}.gem michael@764: Source24: http://rubygems.org/downloads/sqlite3-%{V_sqlite3}.gem michael@764: Source25: http://rubygems.org/downloads/thin-%{V_thin}.gem michael@764: Source26: http://rubygems.org/downloads/tzinfo-%{V_tzinfo}.gem michael@764: Source27: http://rubygems.org/downloads/bundler-%{V_bundler}.gem michael@764: michael@764: # build information michael@764: BuildPreReq: OpenPKG, openpkg >= 20100101, ruby < 2.0.0, ruby-rails, ruby-thin michael@764: PreReq: OpenPKG, openpkg >= 20100101, ruby < 2.0.0, ruby-rails, ruby-thin michael@764: michael@764: %description michael@764: ChiliProject is a web based project management system. It supports michael@764: your team throughout the complete project life cycle, from setting michael@764: up and discussing a project plan, over tracking issues and reporting michael@764: work progress to collaboratively sharing knowledge. michael@764: michael@764: %track michael@764: prog chiliproj:chiliproj = { michael@764: version = %{version} michael@764: url = http://www.chiliproject.org/attachments/download/ michael@764: regex = (\d+) michael@764: url = http://www.chiliproject.org/attachments/download/__NEWVER__/ michael@764: regex = chiliproject-(__VER__)\.tar.bz2 michael@764: } michael@764: prog chiliproj:rake = { michael@764: version = %{V_rake} michael@764: url = http://rubygems.org/gems/rake michael@764: regex = rake-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:activesupport = { michael@764: version = %{V_activesupport} michael@764: url = http://rubygems.org/gems/activesupport michael@764: regex = activesupport-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:rack = { michael@764: version = %{V_rack} michael@764: url = http://rubygems.org/gems/rack michael@764: regex = rack-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:actionpack = { michael@764: version = %{V_actionpack} michael@764: url = http://rubygems.org/gems/actionpack michael@764: regex = actionpack-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:actionmailer = { michael@764: version = %{V_actionmailer} michael@764: url = http://rubygems.org/gems/actionmailer michael@764: regex = actionmailer-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:activerecord = { michael@764: version = %{V_activerecord} michael@764: url = http://rubygems.org/gems/activerecord michael@764: regex = activerecord-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:activeresource = { michael@764: version = %{V_activeresource} michael@764: url = http://rubygems.org/gems/activeresource michael@764: regex = activeresource-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:rails = { michael@764: version = %{V_rails} michael@764: url = http://rubygems.org/gems/rails michael@764: regex = rails-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:actsastaggable = { michael@764: version = %{V_actsastaggable} michael@764: url = http://rubygems.org/gems/acts-as-taggable-on michael@764: regex = acts-as-taggable-on-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:coderay = { michael@764: version = %{V_coderay} michael@764: url = http://rubygems.org/gems/coderay michael@764: regex = coderay-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:daemons = { michael@764: version = %{V_daemons} michael@764: url = http://rubygems.org/gems/daemons michael@764: regex = daemons-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:eventmachine = { michael@764: version = %{V_eventmachine} michael@764: url = http://rubygems.org/gems/eventmachine michael@764: regex = eventmachine-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:gravatarify = { michael@764: version = %{V_gravatarify} michael@764: url = http://rubygems.org/gems/gravatarify michael@764: regex = gravatarify-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:i18n = { michael@764: version = %{V_i18n} michael@764: url = http://rubygems.org/gems/i18n michael@764: regex = i18n-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:json = { michael@764: version = %{V_json} michael@764: url = http://rubygems.org/gems/json michael@764: regex = json-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:liquid = { michael@764: version = %{V_liquid} michael@764: url = http://rubygems.org/gems/liquid michael@764: regex = liquid-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:mysql2 = { michael@764: version = %{V_mysql2} michael@764: url = http://rubygems.org/gems/mysql2 michael@764: regex = mysql2-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:netldap = { michael@764: version = %{V_netldap} michael@764: url = http://rubygems.org/gems/net-ldap michael@764: regex = net-ldap-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:rdoc = { michael@764: version = %{V_rdoc} michael@764: url = http://rubygems.org/gems/rdoc michael@764: regex = rdoc-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:rubyopenid = { michael@764: version = %{V_rubyopenid} michael@764: url = http://rubygems.org/gems/ruby-openid michael@764: regex = ruby-openid-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:rubytree = { michael@764: version = %{V_rubytree} michael@764: url = http://rubygems.org/gems/rubytree michael@764: regex = rubytree-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:sqlite3 = { michael@764: version = %{V_sqlite3} michael@764: url = http://rubygems.org/gems/sqlite3 michael@764: regex = sqlite3-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:thin = { michael@764: version = %{V_thin} michael@764: url = http://rubygems.org/gems/thin michael@764: regex = thin-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:tzinfo = { michael@764: version = %{V_tzinfo} michael@764: url = http://rubygems.org/gems/tzinfo michael@764: regex = tzinfo-(__VER__)\.gem michael@764: } michael@764: prog chiliproj:bundler = { michael@764: version = %{V_bundler} michael@764: url = http://rubygems.org/gems/bundler michael@764: regex = bundler-(__VER__)\.gem michael@764: } michael@764: michael@764: %prep michael@764: %setup -q -n chiliproject-%{version} michael@764: %{l_shtool} subst \ michael@764: -e 's;# \(ENV\[.RAILS_ENV.\] ||= .production.\);\1;' \ michael@764: config/environment.rb michael@767: %{l_shtool} subst \ michael@767: -e 's;.*<%= l(:text_powered_by.*;;' \ michael@767: app/views/layouts/base.rhtml michael@764: michael@764: %build michael@764: michael@764: %install michael@764: RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` michael@764: export GEM_HOME=$RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION michael@764: %{l_shtool} mkdir -f -p -m 755 $GEM_HOME michael@765: %{l_shtool} mkdir -f -p $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj/public/plugin_assets michael@765: %{l_shtool} mkdir -f -p $RPM_BUILD_ROOT%{l_prefix}/var/chiliproj michael@764: %{l_tar} cf - . | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj michael@764: %{l_prefix}/bin/gem install --local %{SOURCE3} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE4} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE5} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE6} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE7} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE8} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE9} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE10} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE11} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE12} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE13} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE14} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE15} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE16} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE17} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE18} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE19} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE20} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE21} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE22} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE23} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE24} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE25} michael@764: %{l_prefix}/bin/gem install --local %{SOURCE27} michael@764: michael@764: # install configuration michael@764: ( cd $RPM_BUILD_ROOT%{l_prefix}/lib/chiliproj michael@764: cp %{SOURCE Gemfile.lock} . michael@764: echo 'gem "thin"' >>Gemfile michael@764: cp config/configuration.yml.example config/configuration.yml michael@764: cp config/additional_environment.rb.example config/additional_environment.rb michael@764: echo "ENV['GEM_PATH'] = '%{l_prefix}/lib/ruby/gems/$RUBY_VERSION:%{l_prefix}/lib/chiliproj/gems/$RUBY_VERSION'" >>config/additional_environment.rb michael@765: %{l_shtool} mkdir -f -p -m 755 .bundle # prime bundler with configuration michael@765: echo 'BUNDLE_WITHOUT: test:de:development:postgres:mysql:rmagick' >.bundle/config michael@764: cat >config/database.yml </dev/null 2>&1 \ michael@767: # exec rake -s db:create \ michael@767: # RAILS_ENV=production michael@764: # insert default configuration into database michael@765: echo 'Populating ChiliProject initial database...' michael@764: echo 'en' | \ michael@767: $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ michael@767: exec rake redmine:load_default_data >/dev/null \ michael@767: RAILS_ENV=production michael@765: # correct permissions of generated files michael@765: chown %{l_nusr}:%{l_mgrp} \ michael@765: $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ michael@765: $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ michael@767: $RPM_INSTALL_PREFIX/lib/chiliproj/db \ michael@765: $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ michael@765: $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* michael@765: chmod 0664 \ michael@765: $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ michael@765: $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ michael@765: $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ michael@765: $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* michael@767: chmod 0775 \ michael@767: $RPM_INSTALL_PREFIX/lib/chiliproj/db \ michael@767: $RPM_INSTALL_PREFIX/lib/chiliproj/db/migrate michael@764: ) || exit $? michael@767: echo 'ChiliProject postinstallation finished.' michael@764: fi michael@765: # after upgrade, restart service michael@765: [ $1 -eq 2 ] || exit 0 michael@767: RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` michael@767: ( cd $RPM_INSTALL_PREFIX/lib/chiliproj michael@767: ## migrate existing database michael@767: #echo 'Migrating ChiliProject existing database...' michael@767: #VERBOSE=false RAILS_ENV=production \ michael@767: # $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ michael@767: # exec rake db:migrate michael@767: ) || exit $? michael@765: eval `%{l_rc} chiliproj status 2>/dev/null` michael@765: [ ".$chiliproj_active" = .yes ] && %{l_rc} chiliproj restart michael@765: exit 0 michael@764: michael@765: %preun michael@765: # before erase, stop service and remove log files michael@765: [ $1 -eq 0 ] || exit 0 michael@765: %{l_rc} chiliproj stop 2>/dev/null michael@765: rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/db 2>/dev/null || true michael@765: rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/public 2>/dev/null || true michael@765: rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers 2>/dev/null || true michael@765: rm -rf $RPM_INSTALL_PREFIX/lib/chiliproj/log 2>/dev/null || true michael@765: rm -f $RPM_INSTALL_PREFIX/var/chiliproj/*.log 2>/dev/null || true michael@765: rm -f $RPM_INSTALL_PREFIX/var/chiliproj/*.pid 2>/dev/null || true michael@765: exit 0 michael@765: