rocketeers / docs

Rocketeer's documentation
7 stars 25 forks source link

Update Tasks.md #6

Closed marcovtwout closed 8 months ago

marcovtwout commented 10 years ago

The examples don't explain yet how to run tasks that you defined through a facade, although I found out it is possible. Could you add an example like this?

Anahkiasen commented 10 years ago

Tasks defined anywhere can be called anywhere, be it through the facade, or the custom array, and then called inside a task, in an event, etc. Everything is merged together.

marcovtwout commented 10 years ago

If I define a task like this:

Rocketeer::task('foo_bar', 'echo "foo"')

How can I call it in hooks?

image

Anahkiasen commented 10 years ago

Just "foo_bar" will work

marcovtwout commented 10 years ago

It seems for tasks with an underscore, Rocketeer tries to execute it as a bash command. Output from --pretend:

staging/0 |-- Closure (foo_bar) fired by deploy.after [~0.02s]
$ cd /data/www/test/releases/20141028160250
$ foo_bar
[user@host] (staging) bash: foo_bar: command not found
Anahkiasen commented 10 years ago

Hm, try foo-bar ?

marcovtwout commented 10 years ago

This works. Can you clear up this inconsistency? :)

Anahkiasen commented 10 years ago

Task names get sluggified, if you name your task "Foo Bar" internally it'll be referenced as "foo-bar". Just forgot that _ got replaced too. At least I think so. Need to add some tests for this to double check and edit the docs if that's indeed the case.