James,

I suggest you try something like the following.  It generates the  
database.yml into the shared config directory and ensures that no  
passwords are stored in the repository.

require 'erb'

before "deploy:setup", :db
after "deploy:update_code", "db:symlink"

namespace :db do
   desc "Create database yaml in shared path"
     task :default do
       db_config = ERB.new <<-EOF
production:
   adapter: mysql
   encoding: utf8
   username: #{user}
   password: #{password}
   database: #{application}_production
EOF
                
      run "mkdir -p #{shared_path}/config"
      put db_config.result, "#{shared_path}/config/database.yml"
   end
        
   desc "Make symlink for database yaml"
     task :symlink do
       run "ln -nfs #{shared_path}/config/database.yml #{release_path}/ 
config/database.yml"
   end
end

Keith

On 07/04/2008, at 4:37 AM, james wrote:

>
> I tried to dig through the standard.rb, deploy.rb, and other standard
> rails recipies to figure out what variable i should use to correctly
> extend the default update procedure (using before or after filter) so
> that before migrations or even updating symlink, assure that
> mysql.database.yml gets moved to database.yml
>
>
>
> i came up with this:
>
>
> namespace :deploy do
>  task :before_finalize_update do
>    run "cp #{latest_release}/config/mysql.database.yml
> #{latest_releast}/config/database.yml"
>    run "cd #{latest_release} && rake db:create:all"
>  end
> end
>
> it worked like a charm on the deploy:cold.  but after that, obviously
> the db:create:all wasnt needed.
>
> also after that sometime when running other tasks the
> "#{latest_release}"  didn't exist and everything failed....
>
> maybe someone could help me out with a suggestion.  havent found much
> in the way of extending with before, after filters on google
> >


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to