Forum: Rails deployment Capistrano upload?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
44a43e7fef8e933e802a7802b4bd3525?d=identicon&s=25 John Small (johnsmall)
on 2009-01-01 17:32
How do I use the Capistrano upload function in a recipe? It seems simple
enough, but I can't get it to work.

Here's my recipe

<pre>
desc "Copy the development database to the staging database"
task :copy_db_to_staging, :hosts =>'my_staging_server' do
  system "mysqldump -u root -pmypassword my_development_db >
~/db_backups/tg-3-dev-backup.sql"
  system "gzip ~/db_backups/tg-3-dev-backup.sql  "
  upload "~/db_backups/tg-3-dev-backup.sql.gz", "/my_dir_for_db_backups"
end
</pre>

It all works until it gets to upload where it fails with

 `[]=': undefined method `[]=' for nil:NilClass (NoMethodError)

So what's the technique for uploading a file using Capistrano?

Ta

John Small
E091cc3f120540b30c27b5a33a713370?d=identicon&s=25 Anton Anykeyev (pushist1y)
on 2009-01-09 01:41
John Small wrote:
> How do I use the Capistrano upload function in a recipe? It seems simple
> enough, but I can't get it to work.
>
> Here's my recipe
>
> <pre>
> desc "Copy the development database to the staging database"
> task :copy_db_to_staging, :hosts =>'my_staging_server' do
>   system "mysqldump -u root -pmypassword my_development_db >
> ~/db_backups/tg-3-dev-backup.sql"
>   system "gzip ~/db_backups/tg-3-dev-backup.sql  "
>   upload "~/db_backups/tg-3-dev-backup.sql.gz", "/my_dir_for_db_backups"
> end
> </pre>
>
> It all works until it gets to upload where it fails with
>
>  `[]=': undefined method `[]=' for nil:NilClass (NoMethodError)
>
> So what's the technique for uploading a file using Capistrano?
>
> Ta
>
> John Small

try not to use "_" symbol in file names (and maybe paths)
also try to specify remote file name like this:

upload "~/db_backups/tg-3-dev-backup.sql.gz",
"/my_dir_for_db_backups/tg-3-dev-backup.sql.gz"

if it doesn't work, try to use :via => :scp
44a43e7fef8e933e802a7802b4bd3525?d=identicon&s=25 John Small (johnsmall)
on 2009-01-09 05:36
>
> try not to use "_" symbol in file names (and maybe paths)
> also try to specify remote file name like this:
>
> upload "~/db_backups/tg-3-dev-backup.sql.gz",
> "/my_dir_for_db_backups/tg-3-dev-backup.sql.gz"
>
> if it doesn't work, try to use :via => :scp

:via => :scp gets it to work.

Thanks

John Small
This topic is locked and can not be replied to.