You missed a comma, Ruby will implicitly join two strings:

$ irb
irb(main):001:0> puts "i forgot" "how to write docs"
i forgothow to write docs
=> nil

Easy enough mistake to make, if you have the time a download!() example
would be very welcome in the SSHKit EXAMPLES.md file. (We covered "upload!"
and friends there)

Lee Hambley
http://lee.hambley.name/
+49 (0) 170 298 5667

On 6 May 2015 at 21:59, Joel Taylor <joelatay...@gmail.com> wrote:

> Ok, so I tried that as well - see the commented out 3rd line. But this
> doesn't work either, it runs the command on the remote server right? And
> that's not how SCP works.
>
> On Wed, May 6, 2015 at 3:44 PM, Lee Hambley <lee.hamb...@gmail.com> wrote:
>
>> Right, so it should run in an on('someserver') block. Its confusing
>> because run_locally is a legacy API you can also do on(:local) but that's
>> not what you want either.
>> On 6 May 2015 9:41 pm, "Joel Taylor" <joelatay...@gmail.com> wrote:
>>
>>> Ha! It's not, but I found this:
>>> http://stackoverflow.com/questions/19478733/capistrano-3-0-file-transfers
>>> which lead to:
>>> https://github.com/capistrano/sshkit/blob/v1.7.1/lib/sshkit/backends/netssh.rb#L87
>>>
>>> On Wed, May 6, 2015 at 3:40 PM, Lee Hambley <lee.hamb...@gmail.com>
>>> wrote:
>>>
>>>> Where do you see download! () documented?
>>>> On 6 May 2015 8:48 pm, "Joel Taylor" <joelatay...@gmail.com> wrote:
>>>>
>>>>> I get it - docs are hard and time consuming.
>>>>>
>>>>> Answer me this, how would you download a file from a remote (staging)
>>>>> server to your local machine? There's a "download!" method - but I can't
>>>>> seem to figure it out.
>>>>>
>>>>> Should it live inside of a "on roles(:all) do" or "run_locally do".
>>>>>
>>>>> desc "Export Stage DB to Local DB"
>>>>> task :to_local do
>>>>>   #on roles(:all) do
>>>>>   run_locally do
>>>>>     puts 'Downloading Staging DB'
>>>>>     execute 'pwd'
>>>>>     date_path = Date.today.strftime("%Y/%m/%d")
>>>>>     download! "/var/mysql-backup/#{date_path}/oamm-wp-db_stage-00.sql.gz" 
>>>>> "oamm-wp-db_stage-00.sql.gz"
>>>>>   end
>>>>> end
>>>>>
>>>>> ➜ cap staging sync_db:to_local
>>>>>
>>>>> Downloading Staging DB
>>>>>
>>>>> INFO [4c3b8d6b] Running /usr/bin/env pwd as myuser@localhost
>>>>>
>>>>> DEBUG [4c3b8d6b] Command: /usr/bin/env pwd
>>>>>
>>>>> DEBUG [4c3b8d6b]  /Users/myuser/Sites/mysite.dev
>>>>>
>>>>> INFO [4c3b8d6b] Finished in 0.015 seconds with exit status 0 (successful).
>>>>>
>>>>> (Backtrace restricted to imported tasks)
>>>>>
>>>>> cap aborted!
>>>>>
>>>>> Errno::ENOENT: No such file or directory - 
>>>>> /var/mysql-backup/2015/05/06/oamm-wp-db_stage-00.sql.gzoamm-wp-db_stage-00.sql.gz
>>>>>
>>>>> /Users/myuser/Sites/mysite.dev/lib/capistrano/tasks/sync_db.rb:14:in 
>>>>> `block (3 levels) in <top (required)>'
>>>>>
>>>>> /Users/myuser/Sites/mysite.dev/lib/capistrano/tasks/sync_db.rb:10:in 
>>>>> `block (2 levels) in <top (required)>'
>>>>>
>>>>> Tasks: TOP => sync_db:to_local
>>>>>
>>>>> (See full trace by running task with --trace)
>>>>>
>>>>>
>>>>> On Wed, May 6, 2015 at 11:14 AM, Lee Hambley <lee.hamb...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Sorry. Docs are the best we can do. The `on()` block is where
>>>>>> Capistrano starts, and Rake ends, outside of `on()`… what server should
>>>>>> things be run on?
>>>>>>
>>>>>> Lee Hambley
>>>>>> http://lee.hambley.name/
>>>>>> +49 (0) 170 298 5667
>>>>>>
>>>>>> On 6 May 2015 at 16:55, Joel Taylor <joelatay...@gmail.com> wrote:
>>>>>>
>>>>>>> Yeh, but that doesn't really tell me why the "on" block is needed.
>>>>>>> Or what it really does. Is that Rake DSL?
>>>>>>>
>>>>>>> Docs are def. not for newbies.
>>>>>>>
>>>>>>> On Wednesday, May 6, 2015 at 1:05:59 AM UTC-4, Lee Hambley wrote:
>>>>>>>>
>>>>>>>> Capistranorb.com ?
>>>>>>>> On 6 May 2015 12:53 am, "Joel Taylor" <joela...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Thanks Lee,
>>>>>>>>> I guess that makes sense - but is there documentation about this?
>>>>>>>>> Or do you just "know" it? :)
>>>>>>>>>
>>>>>>>>> Thx!!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tuesday, May 5, 2015 at 4:13:29 PM UTC-4, Lee Hambley wrote:
>>>>>>>>>>
>>>>>>>>>> You're missing the "on()" block, you need to wrap the task inside
>>>>>>>>>> something like:
>>>>>>>>>>
>>>>>>>>>> task :downloaddb do
>>>>>>>>>>   on roles(:db) do                           # <<<----------- you
>>>>>>>>>> missed this bit!
>>>>>>>>>>     # everything from your task here
>>>>>>>>>>   end
>>>>>>>>>> end
>>>>>>>>>>
>>>>>>>>>> Lee Hambley
>>>>>>>>>> http://lee.hambley.name/
>>>>>>>>>> +49 (0) 170 298 5667
>>>>>>>>>>
>>>>>>>>>> On 5 May 2015 at 21:26, Joel Taylor <joela...@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Versions:
>>>>>>>>>>>
>>>>>>>>>>>    - Ruby 2.0.0p576
>>>>>>>>>>>    - Capistrano 3.4.0
>>>>>>>>>>>
>>>>>>>>>>> I'm learning Ruby + Capistrano. I'm trying to write a task that
>>>>>>>>>>> will pull down a file of a remote server. A simple start so I 
>>>>>>>>>>> thought. :)
>>>>>>>>>>>
>>>>>>>>>>> Here's the task: http://pastie.org/10160640
>>>>>>>>>>> I have it under: /lib/capistrano/tasks/sync_db.rb
>>>>>>>>>>>
>>>>>>>>>>> I can see the task available when I run: cap -T
>>>>>>>>>>>
>>>>>>>>>>> cap sync_db:to_local             # Download and import DB to
>>>>>>>>>>> local
>>>>>>>>>>>
>>>>>>>>>>> However, I'm getting this output/error:
>>>>>>>>>>>
>>>>>>>>>>> Downloading Staging DB
>>>>>>>>>>>
>>>>>>>>>>> (Backtrace restricted to imported tasks)
>>>>>>>>>>>
>>>>>>>>>>> cap aborted!
>>>>>>>>>>>
>>>>>>>>>>> NoMethodError: undefined method `execute' for main:Object
>>>>>>>>>>>
>>>>>>>>>>> /.../lib/capistrano/tasks/sync_db.rb:10:in `block (2 levels) in
>>>>>>>>>>> <top (required)>'
>>>>>>>>>>>
>>>>>>>>>>> Tasks: TOP => sync_db:to_local
>>>>>>>>>>>
>>>>>>>>>>> (See full trace by running task with --trace)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> the 'download!' command isn't working either ... what am I
>>>>>>>>>>> missing???
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>> Google Groups "Capistrano" group.
>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from
>>>>>>>>>>> it, send an email to capistrano+...@googlegroups.com.
>>>>>>>>>>> To view this discussion on the web, visit
>>>>>>>>>>> https://groups.google.com/d/msgid/capistrano/e4d093c2-4160-4b16-ab5d-89bc0b0b9de1%40googlegroups.com
>>>>>>>>>>> <https://groups.google.com/d/msgid/capistrano/e4d093c2-4160-4b16-ab5d-89bc0b0b9de1%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>>> .
>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  --
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "Capistrano" group.
>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>> send an email to capistrano+...@googlegroups.com.
>>>>>>>>> To view this discussion on the web, visit
>>>>>>>>> https://groups.google.com/d/msgid/capistrano/fc782b4b-6c45-4a3b-ad7e-82599b6eb886%40googlegroups.com
>>>>>>>>> <https://groups.google.com/d/msgid/capistrano/fc782b4b-6c45-4a3b-ad7e-82599b6eb886%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>> .
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>
>>>>>>>>  --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Capistrano" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to capistrano+unsubscr...@googlegroups.com.
>>>>>>> To view this discussion on the web, visit
>>>>>>> https://groups.google.com/d/msgid/capistrano/bd1c1b05-e0c0-43ff-8272-621ddfead4ec%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/capistrano/bd1c1b05-e0c0-43ff-8272-621ddfead4ec%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>  --
>>>>>> You received this message because you are subscribed to a topic in
>>>>>> the Google Groups "Capistrano" group.
>>>>>> To unsubscribe from this topic, visit
>>>>>> https://groups.google.com/d/topic/capistrano/RMmt-ZHWwfc/unsubscribe.
>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>> capistrano+unsubscr...@googlegroups.com.
>>>>>> To view this discussion on the web, visit
>>>>>> https://groups.google.com/d/msgid/capistrano/CAN_%2BVLW%2B__NokKz%3Dctg5vT_yDz8RYh-4ZH5bDdbkQqHK97Hncw%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/capistrano/CAN_%2BVLW%2B__NokKz%3Dctg5vT_yDz8RYh-4ZH5bDdbkQqHK97Hncw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> -------------------------------------------------------------
>>>>> Joel A. Taylor
>>>>> (615) 480-2010
>>>>> http://joelataylor.com
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Capistrano" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to capistrano+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web, visit
>>>>> https://groups.google.com/d/msgid/capistrano/CAHZp0Su%2BR%3DLG3Px2RSpXGxBXExo4R0X-FcSV2KMpctM3Tguguw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/capistrano/CAHZp0Su%2BR%3DLG3Px2RSpXGxBXExo4R0X-FcSV2KMpctM3Tguguw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>  --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "Capistrano" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/capistrano/RMmt-ZHWwfc/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> capistrano+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web, visit
>>>> https://groups.google.com/d/msgid/capistrano/CAN_%2BVLWz0jPb-jk50khw-oy7H6VA3HMiBUuDk1GGTN8JFy3guQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/capistrano/CAN_%2BVLWz0jPb-jk50khw-oy7H6VA3HMiBUuDk1GGTN8JFy3guQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> -------------------------------------------------------------
>>> Joel A. Taylor
>>> (615) 480-2010
>>> http://joelataylor.com
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Capistrano" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to capistrano+unsubscr...@googlegroups.com.
>>> To view this discussion on the web, visit
>>> https://groups.google.com/d/msgid/capistrano/CAHZp0StwczQinNjQ-LQPW8H1L-B4dY349OasYRPm7wysRsaLAA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/capistrano/CAHZp0StwczQinNjQ-LQPW8H1L-B4dY349OasYRPm7wysRsaLAA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Capistrano" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/capistrano/RMmt-ZHWwfc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> capistrano+unsubscr...@googlegroups.com.
>> To view this discussion on the web, visit
>> https://groups.google.com/d/msgid/capistrano/CAN_%2BVLUU92kJ%3DfTOBn8joqTxiEGRZnD5qEjwrWJ-v%2B1ykV2cuA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/capistrano/CAN_%2BVLUU92kJ%3DfTOBn8joqTxiEGRZnD5qEjwrWJ-v%2B1ykV2cuA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> -------------------------------------------------------------
> Joel A. Taylor
> (615) 480-2010
> http://joelataylor.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to capistrano+unsubscr...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/capistrano/CAHZp0Sviw2T%3DT2BZ5ZJpnb-gjYtSENacO0R-80-E06TSJAb6Cg%40mail.gmail.com
> <https://groups.google.com/d/msgid/capistrano/CAHZp0Sviw2T%3DT2BZ5ZJpnb-gjYtSENacO0R-80-E06TSJAb6Cg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capistrano+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/capistrano/CAN_%2BVLW1ysvjoGyLABrhhP%3De4LQAT%3DEHGYXk0n3_U20RqXWADA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to