From 37087d5f1f561d2bdcbdb90d78f5191901656228 Mon Sep 17 00:00:00 2001 From: Brandon Tilley Date: Fri, 1 Feb 2013 17:41:58 -0800 Subject: [PATCH] Simply compiling and running web server into devevelopment.sh --- README.md | 9 ++++----- scripts/{build.sh => compile.sh} | 0 scripts/development.sh | 11 +++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) rename scripts/{build.sh => compile.sh} (100%) create mode 100755 scripts/development.sh diff --git a/README.md b/README.md index 47b3c5b..9914a88 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,14 @@ Running 1. Ensure you have [Node.js](http://nodejs.org) installed 2. Install the package dependencies: `npm install` - 3. In a console window, start the CoffeeScript compilation: `./scripts/build.sh` - 4. In another console window, start the built-in HTTP server: `./scripts/web-server.js` - 5. Open `http://localhost:8000/index.html` in your browser + 3. Start development mode by running: `./scripts/development.sh` + 4. Open `http://localhost:8000/index.html` in your browser -`scripts/build.sh` watches the CoffeeScript files in `app/coffee` and compiles them to JavaScript in `app/js`; `app/index.html` includes these compiled JavaScript files to run the application. If you change a `.coffee` file in `app/coffee`, you must have `./scripts/build.sh` running so that the file gets recompiled. +`scripts/compile.sh` watches the CoffeeScript files in `app/coffee` and compiles them to JavaScript in `app/js`; `app/index.html` includes these compiled JavaScript files to run the application. If you change a `.coffee` file in `app/coffee`, be sure development mode is running so it will recompile the CoffeeScript. Editing ------- `app/coffee` contains all the CoffeeScript source for the application. The gem filter itself is defined in `services.coffee`. `app.coffee` defines the routes for the application, and `partials/main.htm` contains the view for the `IndexController` route (the main part of the app). -Don't forget to have `./scripts/build.sh` running to compile the CoffeeScript to JavaScript as you make changes. +Don't forget to have `./scripts/development.sh` running to compile the CoffeeScript to JavaScript as you make changes. diff --git a/scripts/build.sh b/scripts/compile.sh similarity index 100% rename from scripts/build.sh rename to scripts/compile.sh diff --git a/scripts/development.sh b/scripts/development.sh new file mode 100755 index 0000000..654f705 --- /dev/null +++ b/scripts/development.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Arbitrary shell commands, some run in background +./scripts/compile.sh & +node ./scripts/web-server.js + +# The magic line +# $$ holds the PID for this script +# Negation means kill by process group id instead of PID +trap "kill -TERM -$$" SIGINT +wait