Object Playground
Object Playground is a tool for visualizing and experimenting with JavaScript object relationships. It's online at objectplayground.com. Object Playground is a project from Let's Code: Test-Driven JavaScript, a screencast series focused on professional, rigorous JavaScript development. Created by James Shore.
This repository contains the source code for Object Playground.
Browser Support
Object Playground has been tested against the browsers listed at the top of Jakefile.js
. At the time of this writing, the following browsers are known to work. Other modern browsers are likely to work as well.
- Chrome 40
- Firefox 36
- IE 10
- IE 11
- Safari 8.0 (Mac)
- Safari 7.0 (iOS)
The following browsers are known to not work:
- IE 9: Lacks the Int32Array type used by Viz.js. A polyfill was attempted, but resulted in an "out of memory" error.
- IE 8: Does not support SVG, lacks Int32Array type.
Building and Testing
Before building for the first time:
- Install Node.js. Use the version described in Jakefile.js NODE_VERSION variable. (The npm
n
package can help with changing Node versions.) - Download the source code by cloning the git repository:
git clone https://github.com/jamesshore/object_playground
. - All commands must run from the root of the source tree:
cd <directory>
. - To cause the build to fail unless certain browsers are tested, edit
TESTED_BROWSERS
at the top ofJakefile.js
.
To build (and test):
- Run
./jake.sh karma
(Unix/Mac) orjake karma
(Windows) to start the Karma server. - Point the browsers you want to test against at the URL
http://localhost:8080
. - Run
./jake.sh
(Unix/Mac) orjake
(Windows) every time you want to build and test. Use theloose=true
option to relax the Node.js and browser version requirements.
Note: At the time of this writing, the source code has not been confirmed to build on Windows.
To test manually:
- Run
./jake.sh run
. - Open
http://localhost:8080
in a browser.
(Or just open src/index.html
in a browser.)
Development and Integration
This repository contains two branches:
master
is for development.integration
is guaranteed to build and pass all tests.
To integrate:
- Get to a clean build and commit your code to the master branch.
- Run
./integrate.sh
(Unix/Mac) orintegrate
(Windows) to test the master branch and merge it into the integration branch.
To change code samples:
- Use
convert_sample.pl
to convert code to JavaScript string. - Modify
src/user_code.js
with new sample.
Deploying
Before deploying for the first time:
- Install rsync or make sure it's available on the path
- Modify
PRODUCTION_HOST
at top ofdeploy.jakefile
to match production host (usingusername@host
format) - Modify
PRODUCTION_DIR
at top ofdeploy.jakefile
to be the directory on the host where your public web content goes
To deploy:
- Run
./deploy.sh latest
(Unix/Mac) ordeploy latest
(Windows) to integrate the master branch and deploy it. The script will tag your git repository withdeploy-<date>-<timestamp>
if the deploy succeeds.
In case of a bad deployment:
- Choose a previous, good commit to deploy.
gitk --all
and thedeploy
tags may be helpful here. - Check out the commit:
git checkout <commit_id>
- Run
./deploy.sh head
(Unix/Mac) ordeploy head
(Windows) to deploy the commit. As above, the script will tag the git repository if the deploy succeeds.