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

Livedoc open #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Livedoc open #22

wants to merge 4 commits into from

Conversation

wiseman17
Copy link
Contributor

Added Grunt command to open livedoc instantly (both win and linux versions).
Linux version should be tested, though.

@dpobel
Copy link
Contributor

dpobel commented Nov 4, 2013

that's a good idea but I'm not a fan of having two tasks for different platforms (and by the way, Linux task calls shell:openlivedocwin).
Maybe grunt-open can help here. In addition, running the livedoc task should open directly the browser without the need to run another task.

@wiseman17
Copy link
Contributor Author

Maybe grunt-open can help here. In addition, running the livedoc task should open directly the browser without the need to run another task.

Both good points. The only problem with the second one - we can't run anything AFTER launching the server, since the server task remains active until shut down. I'm launching the browser before the server now, so you have to reload the page once, but other then that, everything works fine on my system.

@dpobel
Copy link
Contributor

dpobel commented Nov 5, 2013

Again, there's a grunt contrib plugin to handle this. You can check grunt-shell-spawn or grunt-external-daemon or probably plenty of others. The current shape (opening the browser on an error page) is the worst situation.

So the livedoc task should run the yuidoc server in the background (ideally check if it's already running before but I guess this will be hard so it's okish to always try to run the yuidoc server and to ignore the address already in use error) and then open (always) the browser to the address.

@wiseman17
Copy link
Contributor Author

@dpobel, how do you like this setup? I suppose, manual delay is inevitable, if we don't want to dive into output parsing...

@dpobel
Copy link
Contributor

dpobel commented Nov 7, 2013

I suppose, manual delay is inevitable, if we don't want to dive into output parsing...

no, you are kind of force to wait because you set the async option to true (btw 7 seconds ?!?).

In addition, this does not work because even if you set the detach option to true, the yuidoc server dies when the grunt task ends so depending on your machine and different parameters, the browser may have time to display the first page of doc but you can not browse it since the server died in between.

This is explained in the documentation of child_process.spawn (which is used under the hood):

When using the detached option to start a long-running process, the process will not stay running in the background unless it is provided with a stdio configuration that is not connected to the parent. If the parent's stdio is inherited, the child will remain attached to the controlling terminal.

@wiseman17
Copy link
Contributor Author

the browser may have time to display the first page of doc but you can not browse it since the server died in between.

That's strange - this setup works perfectly fine on my system (W7). Additional window for the server is created and as long as it remains opened everything works fine.

btw 7 seconds ?!?

How long does full server start takes on your system? 5 seconds is not enough on mine.

@dpobel
Copy link
Contributor

dpobel commented Nov 8, 2013

That's not really strange, Windows and the rest of the world handles the processes in a quite different way and in addition grunt-shell-spawn uses cmd.exe to run the command (this is the window you can see and probably the reason why yuidoc remains alive after grunt).

the server starts in less than a second and even the doc generation takes less than 2 seconds (that was also the case on my previous poor laptop)...

Anyway, let me take over this task so it works on most systems

@wiseman17
Copy link
Contributor Author

Doc generation takes the same on my system: YUIDoc compile completed in 1.789 seconds

But for the server it's not the case. After showing this line

info: (yuidoc): Starting [email protected] using [email protected] with [email protected]

it takes 4~5 seconds to continue to

info: (yuidoc): Starting YUIDoc with the following options:

and this without any other tasks in background...

Anyway, let me take over this task so it works on most systems

Fair enough. You are welcome :)

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

Successfully merging this pull request may close these issues.

2 participants