Code Monkey home page Code Monkey logo

boojs's Introduction

boojs: A unix tool to execute headless browser javascript

Gem Version Build Status Bitdeli Badge License

What is this?

A simple tool that allows you to execute javascript in the command line as if you were in a browser. Built on-top of PhantomJS and acts as a well-behaved unix tool.

Wait, isn't this just NodeJS? No, they are for different things. BooJS gives you the full DOM, you can call document in BooJS and import arbitrary browser javascript libraries.

Setup

#Setup
gem install boojs

Usage

SYNOPSIS

boojs [-e statement] [-t timeout] [-v file] [file]

DESCRIPTION

The following options are available:

  • -e - Pass a javascript statement to execute after the file (if a file is provided) and then immediately terminate unless -t is set.
  • -t - Close the program after N seconds have passed, if an exception is raised before this, terminate immediately
  • -v - Verify that a file contains no javascript syntax errors. Returns 0 if there are no errors.

EXAMPLES

Open a javascript pipe that reads from stdin, writes via console.log to stdout, prints exceptions via stderr, and exits with a return code of 1 if there are errors.

(sh)>boojs

Same as boojs but read the javascript file before reading from stdin. (i.e. preload a javascript file into your environment)

(sh)>boojs code.js

Execute a javascript statement, and then immediately exit. Exceptions will return 1.

(sh)>boojs -e "console.log(document);"

Execute a javascript statement, and then wait 4 seconds before exiting. Exceptions will return 1 and end execution early.

(sh)>boojs -e "console.log(document);" -t 4

Verify that a file contains no javascript runtime initialization errors

(sh)>boojs -v code.js
(sh)>echo $?
0

Requirements

  • Ruby 2.1 or Higher

Communication

  • 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

When should I use boojs?

When you need to test javascript code that needs to run in a browser but don't necessarily need to test the UI components.

What's Fittr?

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.


Creator

License

boojs is released under the MIT license. See LICENSE for details.

boojs's People

Contributors

creedflan738 avatar dmgawel avatar

Watchers

Zvi avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.