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

simpler than gulp-runtime #1

Closed
stringparser opened this issue May 22, 2015 · 35 comments
Closed

simpler than gulp-runtime #1

stringparser opened this issue May 22, 2015 · 35 comments

Comments

@stringparser
Copy link
Owner

This is maybe what I should have done from the beginning with gulp-runtime just a simple module.

I think you'll be interested in this one @DarkPark

@DarkPark
Copy link
Collaborator

thanks
will sure take a look
I also have an alternative point of view on the matter
after I think it over I'm going to discuss it with you - you may like it as well :)

@stringparser
Copy link
Owner Author

Great 👍

@stringparser
Copy link
Owner Author

Know what I just made you collaborator, so do as you see fit ;)

@DarkPark
Copy link
Collaborator

thanks :)

@DarkPark
Copy link
Collaborator

it works :)

only one minor thing I've noticed - need to press Ctrl+C twice to exit
the package node-static is seems the cause (without this task works fine)
but I remember you've already fixed the similar issue
maybe you can advise something?

@DarkPark
Copy link
Collaborator

found it:

var repl = require('gulp-repl');

repl.on('SIGINT', function () {
    process.exit();
});

@stringparser
Copy link
Owner Author

Yep, that's it :). If you want to PR and merge it go ahead. Add an exit code though (process.exit(0)).

I've thought to add the ability to run in a task in series/parallel directly from the repl. But not much more aside of whats here. Any ideas?

@DarkPark
Copy link
Collaborator

but it's possible to run tasks in parallel
in console I can type:

> img jade less

and I see in logs that they run in parallel

sadly it's impossible to run a task with options

@stringparser
Copy link
Owner Author

Yes, gulp runs them in parallel by default. I was talking about this

> series img jade less

Being series a special word for the repl.

With gulp-runtime you can pass options :).

var gulp = require('gulp-runtime').create({repl: true});

gulp.task('jade :glob', function(){
  // do stuff
});

gulp.stack('jade app/**/*.jade')();

Same using the repl

> jade app/**/*.jade

But to do that you have to monkeypatch gulp.task so you can modify how tasks are defined. I would like to keep things simple for this one.

That said, if you find some simple way I'm up to it.

EDIT: that's one of the reasons I had to do all using vinyl-fs directly

@DarkPark
Copy link
Collaborator

I see
One more idea - persistent history
using console a log I get used to have a full history of your commands
and in the repl you have it as well but only for the current session
would be cool to save it in a configured file on exit and restore it on start

@stringparser
Copy link
Owner Author

Yeah, that would be great. They did this on nodejs/node#1513, I'll take a look on how they did it. In any case it should be behind an option like repl({historyFile: 'some/path/here'}) so it does not surprise anyone when it writes to disk.

@DarkPark
Copy link
Collaborator

agree
seems promising

@DarkPark
Copy link
Collaborator

one more idea
in case you mistype a task name you get:

[16:53:23] Task 'll' is not in your gulpfile
[16:53:23] Please check the documentation for proper gulpfile formatting

and process exits
would be nice to not halt the programm

@stringparser
Copy link
Owner Author

Yep, that's doable. It would be just to check each of the given arguments before running them and see if there is any that is not defined as a task.

@stringparser
Copy link
Owner Author

What about not exiting the process at all? I mean, just to mistype a name is not a big deal

@DarkPark
Copy link
Collaborator

I agree
exit should be only explicitly by Ctrl+C

@stringparser
Copy link
Owner Author

Exit on first SIGINTand warning when tasks is not found done in #2 and #3. History thing pending.

@DarkPark
Copy link
Collaborator

DarkPark commented Jun 8, 2015

works fine 👍

@DarkPark
Copy link
Collaborator

DarkPark commented Jun 8, 2015

I've mentioned an interesting idea earlier
it's moderately connected with repl
would do you like to discuss it?

@stringparser
Copy link
Owner Author

Do a PR, I wouldn't mind at all :)

@DarkPark
Copy link
Collaborator

DarkPark commented Jun 8, 2015

it would be a new separated project as the work process will differ

@DarkPark
Copy link
Collaborator

DarkPark commented Jun 8, 2015

you can say it's an alternative approach
I'm talking about web interface to gulp tasks - to see the list of all tasks, run them, see logs, filter each task log or all tasks at once and so on ...

@stringparser
Copy link
Owner Author

That would be really cool!

We could do a native app using electron for example.

@stringparser
Copy link
Owner Author

There is one https://github.com/sindresorhus/gulp-app already :)

@stringparser
Copy link
Owner Author

But you are talking more like a dashboard and the latter is more like a notifier app, which is also good. I like the idea of a simple app for this.

@DarkPark
Copy link
Collaborator

DarkPark commented Jun 8, 2015

will check your links now
but anyway it would be good probably to discuss it somewhere else

@stringparser
Copy link
Owner Author

ok, other repo right?

@DarkPark
Copy link
Collaborator

DarkPark commented Jun 8, 2015

I think maybe skype or email

@stringparser
Copy link
Owner Author

ok, whatever you like

@DarkPark
Copy link
Collaborator

hello
what do you think about ability to set process environment via repl?
e.g.

> DEBUG_LEVEL=2 mytask

with or without a task

@stringparser
Copy link
Owner Author

You could do that with gulp-runtime like this

var gulp = require('gulp-runtime').create({repl: true});
gulp.task(':envFlag([A-Z_]+=?\\S*)', function(next){
   console.log(this.params);
   var flag = this.params.envFlag.split('=');
   process.env[flag[0]] = flag[1] || true;
   next();
});

// will run the handle above
gulp.stack('DEBUG_LEVEL=2')();

EDIT: I edited so the example is more complete

@stringparser
Copy link
Owner Author

But maybe is a good idea to put it here anyway it would not take much.

@DarkPark
Copy link
Collaborator

ok, I'll check it

@simonfan
Copy link

Thank you so much for the module, haha it's great

@stringparser
Copy link
Owner Author

😄 welcome man thanks for the kind words

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

No branches or pull requests

3 participants