Erwin,
YAML reads from local files, so you don't want to use
"#{release_path}/config/database.yml.template". Try just
"database.yml.template" (since your deployment script is probably in
config/deploy.rb) or "#{File.dirname(__FILE__)}/database.yml.template".
Cheers,
Sean
Erwin wrote:
> after a first successful deployment of a standard Rails app with
> mongrel_clusters (yes.. I am happu) I am working on the second phase
> of my training journey : databases & migration
>
> I am trying to run a recipe generating the production database.yml
> file :
>
> but I am in trouble ! I wrote in my deploy.rb
> ...
> after "deploy:update", :production_database_yml
> ...
> task :production_database_yml, :roles => :app do
> require "yaml"
> set :production_database_password, proc
> { Capistrano::CLI.password_prompt("Production database remote
> Password : ") }
>
> buffer = YAML::load_file("#{release_path}/config/
> database.yml.template")
> # get ride of uneeded configurations
> buffer.delete('test')
> buffer.delete('development')
>
> # Populate production element
> buffer['production']['adapter'] = "mysql"
> buffer['production']['database'] = "myapp_production"
> buffer['production']['username'] = "myself"
> buffer['production']['password'] = production_database_password
>
> put YAML::dump(buffer), "#{release_path}/config/database.yml", :mode
> => 0664
> end
> _____
>
> but when I run the cap deploy:update, I get an error on my server
>
> * executing `production_database_yml'
> /usr/local/lib/ruby/1.8/yaml.rb:143:in `initialize': No such file or
> directory - /var/rails/aelmat.net/myapp/releases/20071204215012/config/
> database.yml.template (Errno::ENOENT)
>
> the file exists on the server ( I double-checked it..), is the
> YAML::load_file reading from the local server ? or anything else get
> wrong ?
>
> thanks for your help !!
>
> kad
>
>
>
>
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---