tugberkugurlu / gulp-dnx

Gulp plugin for ASP.NET 5
MIT License
38 stars 14 forks source link

Allow looping of all commands #1

Open ajryan opened 9 years ago

ajryan commented 9 years ago

This is useful in case project.json is modified - we can now kpm restore / k --watch all inside the loop. I also added a quiet option (on by default).

tugberkugurlu commented 9 years ago

awesome, thanks!

tugberkugurlu commented 9 years ago

@ajryan Can you also update the readme file for this new usages?

ajryan commented 9 years ago

Will do! Thanks for reviewing this so quickly.

ajryan commented 9 years ago

OK, index.js cleaned up and README.md updated. Thanks for this tool!

tugberkugurlu commented 9 years ago

@ajryan thanks again! I'm trying this out now but I'm seeing abnormal endless loop if you have a failing restore task:

image

We should terminate the loop and the process if we have any errors while running the commands. Not sure it is there now for the released version but it wasn't that annoying as there wasn't an endless loop :smile:

ajryan commented 9 years ago

I think it's actually k web that is failing in your example, although the same can happen for kpm restore. The released version will loop if you have an error in Startup.cs. When I first started using this task, I actually thought of it as kind of a feature - once I fixed the issue, the app was running again without any intervention.

I suppose it could be better to terminate the loop if any command ends in error, and only loop when k run terminates normally due to file change.

What do you think?

tugberkugurlu commented 9 years ago

I suppose it could be better to terminate the loop if any command ends in error, and only loop when k run terminates normally due to file change.

Yes + AFAIK, k run --watch still returns zero code when there are file changes. I could be mistaken, though. So, it will be easy to know when it fails and when the file is changing. Do you think that you can this implementation in here as well?

ajryan commented 9 years ago

I think so - will give it a shot.

ajryan commented 9 years ago

I have an implementation ready that will terminate the loop if any command exits with a non-zero error code.

I'm new to gulp, so I'm not sure if terminating on error is really the right thing in a "live reload" environment. According to this article (link), the build should keep running on error, but I don't know what the general consensus is. Part of me thinks an additional terminateOnError option should be added.

Of course it's up to you, I'm happy to push the commit that always terminates, or anything else you think is most appropriate.