Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed issue with node 0.4.11 and released 0.1.0 that compiles coffee …

…to javascript so you can just deploy your compiled code to production.
  • Loading branch information...
commit 227cd292ce20f50b16acd9d03bb2290c01c8001a 1 parent 7c483f1
@twilson63 twilson63 authored
View
1  AUTHORS
@@ -0,0 +1 @@
+Tom Wilson tom@jackhq.com http://www.jackhq.com
View
40 Cakefile
@@ -0,0 +1,40 @@
+fs = require 'fs'
+{print} = require 'sys'
+{spawn, exec} = require 'child_process'
+
+build = (watch, callback) ->
+ if typeof watch is 'function'
+ callback = watch
+ watch = false
+ options = ['-c', '-o', 'lib', 'src']
+ options.unshift '-w' if watch
+
+ coffee = spawn 'coffee', options
+ coffee.stdout.on 'data', (data) -> print data.toString()
+ coffee.stderr.on 'data', (data) -> print data.toString()
+ coffee.on 'exit', (status) -> callback?() if status is 0
+
+spec = (callback) ->
+ options = ['spec', '--coffee']
+ spec = spawn 'jasmine-node', options
+ spec.stdout.on 'data', (data) -> print data.toString()
+ spec.stderr.on 'data', (data) -> print data.toString()
+ spec.on 'exit', (status) -> callback?() if status is 0
+
+
+task 'docs', 'Generate annotated source code with Docco', ->
+ fs.readdir 'src', (err, contents) ->
+ files = ("src/#{file}" for file in contents when /\.coffee$/.test file)
+ docco = spawn 'docco', files
+ docco.stdout.on 'data', (data) -> print data.toString()
+ docco.stderr.on 'data', (data) -> print data.toString()
+ docco.on 'exit', (status) -> callback?() if status is 0
+
+task 'build', 'Compile CoffeeScript source files', ->
+ build()
+
+task 'watch', 'Recompile CoffeeScript source files when modified', ->
+ build true
+
+task 'spec', 'Run Jasmine-Node', ->
+ build -> spec -> console.log ":)"
View
1  Procfile
@@ -0,0 +1 @@
+web: node server.js
View
12 lib/app.js
@@ -0,0 +1,12 @@
+(function() {
+ var app, express;
+ express = require('express');
+ app = express.createServer();
+ app.register('.coffee', require('coffeekup'));
+ app.set('view engine', 'coffee');
+ app.use(express.static(__dirname + '/public'));
+ app.get('/', function(request, response) {
+ return response.render('index');
+ });
+ app.listen(process.env.PORT || 8000);
+}).call(this);
View
17 package.json
@@ -1,10 +1,19 @@
{
"name": "express-coffee"
- , "version": "0.0.1"
+ , "version": "v0.1.0"
, "private": true
+ ,"directories" : {
+ "lib" : "./lib",
+ "spec": "./spec"
+ }
, "dependencies": {
- "express": ">= 2.4.6"
- , "coffee-script": ">= 1.1.2"
- , "coffeekup": ">= 0.0.3"
+ "express": "2.4.x"
+ , "coffeekup": "0.3.x"
}
+ , "devDependencies": {
+ "coffee-script": "1.1.x"
+ ,"jasmine-node": "1.x.x"
+ ,"request": "1.x.x"
+ }
+ , "engine": "node >= 0.4.11"
}
View
50 readme.md
@@ -1,36 +1,46 @@
# Express Coffee
-This is a template nodejs web app
+This is a template node web app
## Technologies
This is a template that can be used to create nodejs applications using
-* Express
-* CoffeeScript!
-* Coffeekup
+* Node v0.4.11
+* Express v2.4.6
+* CoffeeScript! v1.1.2
+* Coffeekup v0.3.0
## Requirements
[NodeJs](http://nodejs.org)
[Express](http://expressjs.com)
[Coffeekup](http://coffeekup.org/)
+[Jasmine-Node](https://github.com/mhevery/jasmine-node/)
-
-## Install
+## Install, Build, Run, Test, and Watch
```
# Install nodejs and npm
-npm install express
-npm install coffeekup
git clone http://github.com/twilson63/express-coffee.git [project-name]
cd [project-name]
+npm install
+
+# Build
+
+cake build
+
+# Run
-coffee app.coffee
+node server.js
-or
+# Test
-node app.js
+cake spec
+
+# Watch - Compile when files change.
+
+cake watch
```
@@ -39,17 +49,31 @@ node app.js
* [Jeremy Ashkenas](https://github.com/jashkenas) for creating coffee-script
* [TJ Holowaychuk](https://github.com/visionmedia) for creating express
* [Maurice Machado](https://github.com/mauricemach) for creating coffeekup
+* [Miško Hevery](https://github.com/mhevery) for creating Jasmine-Node
+* [Pivotal Labs](http://github.com/pivotal/jasmine) for creating Jasmine
## About
+express-coffee is a template or boilier plate to get started writting
+express web applications in CoffeeScript. It comes ready to go with base
+setup for an Express Web App. It includes a Cakefile that lets you build,
+spec, and watch your coffeescript as you develop. You hack in the src folder
+and run cake build to build you server files, write your jasmine tests in
+your spec folder and run cake spec to run your test suite. Create your
+coffeekup views in the views folder and put your public assets in the public
+folder. Enjoy your express-coffee
+
+ ~
+c[_] 0.1.0
+
Coffeekup Layout View borrowed from CoffeeKup Examples
## License
See LICENSE
-## Also Check Out
+## Ready to Deploy on Heroku
-[meryl-coffee](http://github.com/twilson63/meryl-coffee)
+[heroku](http://devcenter.heroku.com/articles/node-js)
View
5 server.js
@@ -1,4 +1 @@
-require("coffee-script")
-require('./app.coffee')
-
-
+require('./lib/app')
View
11 spec/app_spec.coffee
@@ -0,0 +1,11 @@
+require '../lib/app'
+request = require('request')
+
+root_uri = 'http://localhost:8000'
+
+describe 'APP Routes', ->
+ it 'GET /', ->
+ request uri: "#{root_uri}/", (req, resp) ->
+ expect(resp.statusCode).toEqual(200)
+ asyncSpecDone()
+ asyncSpecWait()
View
2  app.coffee → src/app.coffee
@@ -13,4 +13,4 @@ app.get '/', (request, response) ->
response.render 'index'
# Listen
-app.listen process.env.C9_PORT
+app.listen process.env.PORT || 8000
Please sign in to comment.
Something went wrong with that request. Please try again.