Thursday, July 10, 2008

Using SCP with Capistrano

It took me several hours to find out how to send a file to my remote computer via scp using Capistrano. It's actually quite easy. There is a method called upload which has a via option. Here is an example of its use:

upload("products.txt", "/home/medined", :via => :scp)

If you need to change the files name, you can also specify it in the second parameter. For example,

upload("products.txt", "/home/medined/products_new.txt", :via => :scp)
Zemanta Pixie

3 comments:

alvina said...

Hi,
I'm trying to figure out what i the above example I actually omit like the commas and parenthesis can you give an example on how it would look once we enter the info.
TIA,
Alvina

David Medinets said...

As far as I know you can omit nothing.

Micah said...

You can probably omit the parentheses. Standard ruby syntax does not require parentheses for method/function calls.