From 36608a4f0aeb6e2ed2602cbb87e6385026db7711 Mon Sep 17 00:00:00 2001 From: Karl Varga Date: Fri, 6 Nov 2009 22:11:02 +0800 Subject: [PATCH] Link the database config file into the app after deploying. --- config/deploy.rb | 14 ++++++++------ lib/tasks/tz.rake | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index e3b6d4c..a3039c8 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -83,9 +83,7 @@ task :after_update_code do run "chmod 755 #{release_path}/public" run "chmod 755 #{release_path}/public/dispatch.*" - run "if [ -e #{previous_release}/public/sitemap_index.xml.gz ]; then cp #{previous_release}/public/sitemap* #{current_release}/public/; fi" - run "cd #{current_path} && rake app:update_sass RAILS_ENV=production" - + # Switch to production environment. # This uncomments all lines in environment.rb that start with '#prod' environment_file = "#{release_path}/config/environment.rb" @@ -94,6 +92,10 @@ # Delete unpacked native gems. Because we don't have access to the C compiler # on HostGator, we cannot build the unpacked gems. So we must use the system gem. delete_local_copy_of_system_gems + + run "ln -nfs #{shared_path}/db/database.yml #{current_release}/config/database.yml" + run "if [ -e #{previous_release}/public/sitemap_index.xml.gz ]; then cp #{previous_release}/public/sitemap* #{current_release}/public/; fi" + run "cd #{current_path} && rake app:update_sass RAILS_ENV=#{rails_env}" end desc "After setup ensure the shared/db and shared/backups folders exist." @@ -107,12 +109,12 @@ task :rotate, :roles => [:app] do logfiles = capture( "ls -x #{shared_path}/log" ).split - if logfiles.index( 'production.log' ).nil? + if logfiles.index( "#{rails_env}.log" ).nil? logger.info "production.log was not found, no rotation performed" else - filename = "production.log.#{timestamp_string}.log.bz2" - logfile = "#{shared_path}/log/production.log" + filename = "#{rails_env}.log.#{timestamp_string}.log.bz2" + logfile = "#{shared_path}/log/#{rails_env}.log" deploy.restart # stop the server run "bzip2 #{logfile}" # bzips the production.log and removes it diff --git a/lib/tasks/tz.rake b/lib/tasks/tz.rake index 77775e3..7cb6a17 100644 --- a/lib/tasks/tz.rake +++ b/lib/tasks/tz.rake @@ -12,7 +12,7 @@ namespace :tz do tzpage.save # Expire the fragment cache for this URL - ActionController::Base.new.expire_fragment( :url => tzpage.url ) + ActionController::Base.new.expire_fragment( :url => tzpage.url ) rescue nil # process the movies extractAndLoadMovies(tzpage)