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" <[email protected]> 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 <[email protected]> wrote:
>
>> Where do you see download! () documented?
>> On 6 May 2015 8:48 pm, "Joel Taylor" <[email protected]> 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 <[email protected]>
>>> 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 <[email protected]> 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" <[email protected]> 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 <[email protected]> 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 [email protected].
>>>>>>>>> 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 [email protected].
>>>>>>> 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 [email protected].
>>>>> 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
>>>> [email protected].
>>>> 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 [email protected].
>>> 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
>> [email protected].
>> 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 [email protected].
> 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 the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/capistrano/CAN_%2BVLUU92kJ%3DfTOBn8joqTxiEGRZnD5qEjwrWJ-v%2B1ykV2cuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to