diff -r fd2bc92f4dee -r 3ee660c5bc4f chiliproj/chiliproj.spec --- a/chiliproj/chiliproj.spec Mon Apr 01 20:12:48 2013 +0200 +++ b/chiliproj/chiliproj.spec Tue Apr 02 20:44:50 2013 +0200 @@ -22,6 +22,7 @@ ## # 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 +# FIXME: %{l_prefix}/lib/ruby/gems/1.9.1/bin/rake -T (or -D) # FIXME: Reduce %post by removing RAILS_ENV=production # FIXME: Consider using imagemagick for Gantt? # FIXME: bundle exec rails s @@ -248,6 +249,9 @@ %{l_shtool} subst \ -e 's;# \(ENV\[.RAILS_ENV.\] ||= .production.\);\1;' \ config/environment.rb + %{l_shtool} subst \ + -e 's;.*<%= l(:text_powered_by.*;;' \ + app/views/layouts/base.rhtml %build @@ -337,35 +341,51 @@ # install session echo 'Creating ChiliProject session key...' $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ - exec rake generate_session_store + exec rake -s generate_session_store # create initial database - echo 'Creating ChiliProject initial database...' - RAILS_ENV=production \ - $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ - exec rake db:migrate >/dev/null + echo 'Creating ChiliProject data schemas...' + $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ + exec rake db:migrate \ + RAILS_ENV=production VERBOSE=false + #echo 'Creating ChiliProject initial database...' + #$RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ + # exec rake db:setup >/dev/null 2>&1 \ + # exec rake -s db:create \ + # RAILS_ENV=production # insert default configuration into database echo 'Populating ChiliProject initial database...' echo 'en' | \ - RAILS_ENV=production \ - $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ - exec rake redmine:load_default_data >/dev/null + $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ + exec rake redmine:load_default_data >/dev/null \ + RAILS_ENV=production # correct permissions of generated files chown %{l_nusr}:%{l_mgrp} \ $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ + $RPM_INSTALL_PREFIX/lib/chiliproj/db \ $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* -chown opsw-n db db/* db/migrate/* chmod 0664 \ $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* + chmod 0775 \ + $RPM_INSTALL_PREFIX/lib/chiliproj/db \ + $RPM_INSTALL_PREFIX/lib/chiliproj/db/migrate ) || exit $? - echo 'ChiliProject installation done.' + echo 'ChiliProject postinstallation finished.' fi # after upgrade, restart service [ $1 -eq 2 ] || exit 0 + RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` + ( cd $RPM_INSTALL_PREFIX/lib/chiliproj + ## migrate existing database + #echo 'Migrating ChiliProject existing database...' + #VERBOSE=false RAILS_ENV=production \ + # $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ + # exec rake db:migrate + ) || exit $? eval `%{l_rc} chiliproj status 2>/dev/null` [ ".$chiliproj_active" = .yes ] && %{l_rc} chiliproj restart exit 0