Thanks Brian and Jamis. I followed Brian's lead and it worked a
charm.
On Jul 21, 3:54 pm, "Jamis Buck" <[EMAIL PROTECTED]> wrote:
> In general, I'd recommend doing what Brian demonstrates with variable
> interpolation. However, there are times when an ERB template is
> preferable, and it looks like you're doing that just fine. The upload
> error you're seeing is unrelated to the template; it looks like you
> might be trying to store the file to a directory that doesn't
> exist...?
>
> - Jamis
>
> On 7/20/07, Brian Smith <[EMAIL PROTECTED]> wrote:
>
>
>
> > Do you really need to do a 'render :template' anyway? Why not just
> > use a string and interpolate the vars? For example, I do the
> > following:
>
> > desc <<-DESC
> > Setup the database.yml file in shared/config
> > DESC
> > task :setup_config, :roles => [:app] do
> > database_configuration = <<-EOF
> > #{rails_env}:
> > adapter: mysql
> > host: #{db_host}
> > username: #{db_user}
> > password: #{db_pass}
> > database: #{db_name}
> > EOF
>
> > run "mkdir -p #{shared_path}/config"
> > put database_configuration, "#{shared_path}/config/
> > database.yml"
> > end
>
> > On Jul 20, 2:35 pm, djsodom <[EMAIL PROTECTED]> wrote:
> > > Hi I'm updating my capistrano recipes to work with 2.0. (By the way,
> > > I'm really liking the Capfile configuration technique.)
>
> > > One place I'm stuck is where I write my database.yml file:
>
> > > Previously, I had something like:
>
> > > def write_database_yaml #, :roles => :app do
> > > # generate database configuration
> > > database_configuration = render :template => <<-EOF
> > > <..snip..>
> > > EOF
> > > put database_configuration, "#{aws('current_release')}/config/
> > > database.yml", :mode => 0664
> > > sudo "chown -R #{aws('user')}:#{aws('group')}
> > > #{aws('current_release')}/config/database.yml"
> > > end
>
> > > that worked fine.
>
> > > With "render" no longer working, I'm trying ERB things like:
>
> > > def write_database_yaml #, :roles => :app do
> > > # generate database configuration
> > > template = %q{
> > > defaults: &defaults
> > > <..snip ..>
> > > }
> > > database_configuration = ERB.new(template).result(binding)
> > > put database_configuration, "#{aws('current_release')}/config/
> > > database.yml", :mode => 0664
> > > sudo "chown -R #{aws('user')}:#{aws('group')}
> > > #{aws('current_release')}/config/database.yml"
> > > end
>
> > > Any suggestions on how to make this work? The above gives me a: "
> > > uploading failed: No such file"
>
> > > thanks,
>
> > > Steve Odom
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---