1.1 --- a/chiliproj/chiliproj.spec Mon Apr 01 20:12:48 2013 +0200 1.2 +++ b/chiliproj/chiliproj.spec Tue Apr 02 20:44:50 2013 +0200 1.3 @@ -22,6 +22,7 @@ 1.4 ## 1.5 1.6 # 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 1.7 +# FIXME: %{l_prefix}/lib/ruby/gems/1.9.1/bin/rake -T (or -D) 1.8 # FIXME: Reduce %post by removing RAILS_ENV=production 1.9 # FIXME: Consider using imagemagick for Gantt? 1.10 # FIXME: bundle exec rails s 1.11 @@ -248,6 +249,9 @@ 1.12 %{l_shtool} subst \ 1.13 -e 's;# \(ENV\[.RAILS_ENV.\] ||= .production.\);\1;' \ 1.14 config/environment.rb 1.15 + %{l_shtool} subst \ 1.16 + -e 's;.*<%= l(:text_powered_by.*;;' \ 1.17 + app/views/layouts/base.rhtml 1.18 1.19 %build 1.20 1.21 @@ -337,35 +341,51 @@ 1.22 # install session 1.23 echo 'Creating ChiliProject session key...' 1.24 $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 1.25 - exec rake generate_session_store 1.26 + exec rake -s generate_session_store 1.27 # create initial database 1.28 - echo 'Creating ChiliProject initial database...' 1.29 - RAILS_ENV=production \ 1.30 - $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 1.31 - exec rake db:migrate >/dev/null 1.32 + echo 'Creating ChiliProject data schemas...' 1.33 + $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 1.34 + exec rake db:migrate \ 1.35 + RAILS_ENV=production VERBOSE=false 1.36 + #echo 'Creating ChiliProject initial database...' 1.37 + #$RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 1.38 + # exec rake db:setup >/dev/null 2>&1 \ 1.39 + # exec rake -s db:create \ 1.40 + # RAILS_ENV=production 1.41 # insert default configuration into database 1.42 echo 'Populating ChiliProject initial database...' 1.43 echo 'en' | \ 1.44 - RAILS_ENV=production \ 1.45 - $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 1.46 - exec rake redmine:load_default_data >/dev/null 1.47 + $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 1.48 + exec rake redmine:load_default_data >/dev/null \ 1.49 + RAILS_ENV=production 1.50 # correct permissions of generated files 1.51 chown %{l_nusr}:%{l_mgrp} \ 1.52 $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ 1.53 $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ 1.54 + $RPM_INSTALL_PREFIX/lib/chiliproj/db \ 1.55 $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ 1.56 $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* 1.57 -chown opsw-n db db/* db/migrate/* 1.58 chmod 0664 \ 1.59 $RPM_INSTALL_PREFIX/lib/chiliproj/log/production.log \ 1.60 $RPM_INSTALL_PREFIX/lib/chiliproj/config/initializers/session_store.rb \ 1.61 $RPM_INSTALL_PREFIX/lib/chiliproj/db/* \ 1.62 $RPM_INSTALL_PREFIX/lib/chiliproj/db/*/* 1.63 + chmod 0775 \ 1.64 + $RPM_INSTALL_PREFIX/lib/chiliproj/db \ 1.65 + $RPM_INSTALL_PREFIX/lib/chiliproj/db/migrate 1.66 ) || exit $? 1.67 - echo 'ChiliProject installation done.' 1.68 + echo 'ChiliProject postinstallation finished.' 1.69 fi 1.70 # after upgrade, restart service 1.71 [ $1 -eq 2 ] || exit 0 1.72 + RUBY_VERSION=`%{l_prefix}/bin/gem which rubygems | sed -e 's;.*/\([^/]*\)/rubygems\.rb$;\1;'` 1.73 + ( cd $RPM_INSTALL_PREFIX/lib/chiliproj 1.74 + ## migrate existing database 1.75 + #echo 'Migrating ChiliProject existing database...' 1.76 + #VERBOSE=false RAILS_ENV=production \ 1.77 + # $RPM_INSTALL_PREFIX/lib/ruby/gems/$RUBY_VERSION/bin/bundle \ 1.78 + # exec rake db:migrate 1.79 + ) || exit $? 1.80 eval `%{l_rc} chiliproj status 2>/dev/null` 1.81 [ ".$chiliproj_active" = .yes ] && %{l_rc} chiliproj restart 1.82 exit 0