pstadler / flightplan

Run sequences of shell commands against local and remote hosts.
https://www.npmjs.com/package/flightplan
MIT License
1.82k stars 117 forks source link

support for transport.fly #66

Open basz opened 9 years ago

basz commented 9 years ago

Is there a -native- way to run sub-tasks, something similar of

transport.exec('fly build-phar:prod');

The above works, but ANSI colors are lost and we get nested output.

localhost ● ok
# transport.exec starts here
localhost $ fly build-phar:prod
localhost > ✈ Running build-phar:prod
localhost > ✈ Flight to localhost started
localhost > localhost $ echo Compiling Phar executable 
localhost > localhost > Compiling Phar executable
localhost > localhost ● ok
localhost > ✈ Flight to localhost finished after 18 ms
localhost > ✈ Flightplan finished after 19 ms
localhost ● ok

ps. Apologies if this is not the place for support. Where should I ask these questions?

pstadler commented 9 years ago

You could try to execute plan.run(task, target, options), fly does the same.

Please note that I never tried this, but I understand the use case, so please let me know if this works out for you.

pstadler commented 9 years ago

Another idea is to write your tasks like this:

plan.local(['build-phar', 'deploy'], ...);
plan.local(['deploy'], ...);

When you now run fly deploy, the build-phar task is executed as well.

ravi commented 9 years ago

Had a long chat with @pstadler many centuries ago on a similar issue but now I cannot find it. I wanted to be able to do two things: (1) compose tasks using other tasks, (2) be able to say: fly task1,task2,task3:destination .......

After various stops and starts, I have a framework built on top of Flightplan to obtain the above. Not entirely sure that this is the right way to go about it.

basz commented 9 years ago

plan.run(task, target, options) does work indeed. however the current task isn't halted. can't rely on its result therefore.

i'v opted for exec('fly ...'), for now. thx

pstadler commented 9 years ago

@basz thanks for reporting back. @ravi see #45. I wouldn't call this a discussion, as you didn't explain me that the current implementation is not enough for your needs.

So there are two use cases: 1) Running multiple tasks from command line (e.g. fly task1,task2:target) This could be done and makes sense somehow. Also the refactoring from 0.4.x to 0.5.x definitely makes this way easier to implement.

2) Running a task from a running task Not sure about this one.

ravi commented 9 years ago

@pstadler fair enough, I didn't want to get too deep into the matter on #45 (thanks for finding that) because I figured the need may be specific to me.

oliverzy commented 9 years ago

Let me add case 3: task1 has a dependency on task2, flightplan needs to provide a way to define this relationship.