Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recipe: Compose tasks from the command line #410

Conversation

ngConsulti
Copy link

I came up with this recipe when I wanted to test out different stream topologies from the command line. Adding it as a recipe in case others find it useful...

Summary:

By exposing the functionality of run-sequence on the command line,
you can compose tasks into arbitrary flow on an ad hoc basis.
This enables testing alternate flows which can quickly be captured
in tasks if they prove useful.

By exposing the functionality of run-sequence on the command line,
you can compose tasks into arbitrary flow on an _ad hoc_ basis.
This enables testing alternate flows which can quickly be captured
in tasks if they prove useful.
@yocontra
Copy link
Member

Maybe you should split all of this logic out into a module that people can simply include vs. pasting all of this code into their gulpfile?

@ngConsulti
Copy link
Author

Like you said, run-sequence is a temporary solution until the new task system is in place...so it seems silly to create another throw-away module. What's the ETA on run-sequence being obsoleted?

@yocontra
Copy link
Member

@ngConsulti I think the module still has merit if you want to pass custom sequences in via the CLI

@ngConsulti
Copy link
Author

I'll give it some thought...

On Tuesday, April 15, 2014, Eric Schoffstall notifications@github.com
wrote:

@ngConsulti https://github.com/ngConsulti I think the module still has
merit if you want to pass custom sequences in via the CLI

Reply to this email directly or view it on GitHubhttps://github.com//pull/410#issuecomment-40561589
.

Nathan Probst
ngConsulti http://ngConsulti.com
970.402.7384

@ngConsulti
Copy link
Author

@contra, I took your advice. Here's the result: git-adhoc

gulp-adhoc

Information

gulp-adhoc is designed to allow easy composition of sequential and parallel tasks via the command line.

NOTE: This module depends on run-sequence, which is a temporary solution while the new task system is in development. gulp-adhoc will either adapt to the new order (if useful), or be retired.

Usage

Just require gulp-adhoc at the top of your gulpfile, passing it your gulp instance.

gulpfile.js

var gulp  = require('gulp');
var gutil = require('gulp-util');
var runs  = require('run-sequence');

require('gulp-adhoc')(gulp, gutil.env);

CLI

# Simple sequence
gulp clean,build,test,deploy

# Sequence with parallel sections
gulp clean,[coffee,less,jade],[min-css,min-js,min-img],inject

BONUS!

If you find yourself using the same ad hoc commands repeatedly, you can promote them to tasks like this...

gulpfile.js

var gulp  = require('gulp');
var gutil = require('gulp-util');
var runs  = require('run-sequence');

gulp.task('do-the-thing', function(done) {
  runs(
    'clean',
    ['coffee','less','jade'],
    ['min-css','min-js','min-img'],
    'inject',
    done);
});

@ngConsulti ngConsulti closed this Apr 16, 2014
@ngConsulti ngConsulti deleted the docs/add-cli-task-composition-recipe branch April 16, 2014 17:21
@yocontra
Copy link
Member

@ngConsulti Cool, you should add this to the docs now since this module will be useful even with the new task system for taking this format in the CLI

@ngConsulti
Copy link
Author

@contra, just to clarify... Would you like me to update this recipe document, or make a PR against something like CLI.md?

@yocontra
Copy link
Member

@ngConsulti Submit a new PR with a recipe for using this. Title the recipe something like "Complex Task Sequences" or something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants