What is this?
unix conventions and is built on-top of PhantomJS.
BooJS was purpose built for our continuous integration infrastructure at Fittr®.
#Setup gem install boojs
boojs [-e statement] [-t timeout] [-v file] [file]
The following options are available:
-t- Close the program after N seconds have passed, if an exception is raised before this, terminate immediately
(sh)>boojs console.log("Hello world!"); //Output to $stdout console.error("Goodbye cruel world!"); //Output to $stderr
(sh)>boojs jquery.js $("body").html("<h1>Hello</h1>"); console.log($("body").html())
(sh)>boojs -e "console.log(document);"
(sh)>boojs -e "console.log(document);" -t 4
(sh)>boojs -v code.js (sh)>echo $? 0
booPing()will immediately return
stdout. You may use this to know when boo has started up fully.
console.error(msg)will output to
console.log(msg)will output to
Local Storage Persistance
Every restart of boojs will cause
localStorage to be reset. There is a bug where multiple instances of
boojs will all share the same
localStorage, so if you open multiple copies of boojs, you are guaranteed to delete
localStorage of all boojs instances.
You may restart the boojs intsance without deleting local storage via sending
$__RESTART__ directly to
stdin of the boojs instance as
it's own line. You may then wait for the reply
$__RESTART_OK__. At this point, boojs will have restarted with a fresh instance except
localStorage will still be intact.
**You must fully drain the
stdout pipe of boojs before attempting to
$__RESTART__. If you fail to do so, your commands may execute after
$__RESTART__ has executed because
$__RESTART__ is executed asynchronously. You should send
booPing(), wait for a reply of
pong, and then
- Ruby 2.1 or Higher
- If you found a bug, submit a pull request.
- If you have a feature request, submit a pull request.
- If you want to contribute, submit a pull request.
FAQ & Rants
Wait, isn't this just NodeJS?
No, they are for different things. BooJS gives you the full DOM, you can call
...But PhantomJS has a perfectly good REPL, kids these days...
There are a myriad issues with the PhantomJS repl; most notably, the PhantomJS repl:
- Outputs special format characters even when not attached to a
- Does not have well defined behavior which makes it a nightmare to integrate with
- Has no support for asynchronous stdin
- Does not output
- Changes what it considers a newline based on the attached terminal (A QT quirk)
- Is not a unix tool in any sense
- Has no support for resetting local storage
I don't think any of this is the
PhantomJS's team fault; it's just not their focus or target.
When should I use boojs?
Fittr is a SaaS company that focuses on providing personalized workouts and health information to individuals and corporations through phenomenal interfaces and algorithmic data-collection and processing.
boojs is released under the MIT license. See LICENSE for details.