From 5ccf1cb77a6cf258d6093a8ee97132560834e5a5 Mon Sep 17 00:00:00 2001 From: mauricemach Date: Wed, 5 Jan 2011 03:38:13 -0200 Subject: [PATCH] v0.1.4. --- CHANGELOG.md | 10 ++++++++++ Cakefile | 2 +- README.md | 8 ++------ bin/zappa.coffee | 30 ++++++++++++++++++------------ lib/zappa.coffee | 7 +++---- package.json | 16 +++++++++------- 6 files changed, 43 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bdfa51..86771e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +**v0.1.4** (2010-01-05): + + - Updated to CoffeeScript 1.0.0 and node 0.2.6/0.3.3. + - Soda tests by Nicholas Kinsey. + - `broadcast` passing along optional `except` param to socket.io. + - Empty app files now start a default "blank" app, serving files at /public. + - `zappa -n/--hostname` to listen on a specific hostname or IP. + - Made defs available to postrenders' scope. + - Bug fixes. + **v0.1.3** (2010-11-13): - Updated to CoffeeScript 0.9.5 and node 0.2.5/0.3.1. diff --git a/Cakefile b/Cakefile index d679c8f..26f445b 100644 --- a/Cakefile +++ b/Cakefile @@ -16,4 +16,4 @@ task 'test', -> puts 'stderr: ' + data tests.on 'exit', (code) -> - puts 'tests exited with code ' + code \ No newline at end of file + puts 'tests exited with code ' + code diff --git a/README.md b/README.md index e2011c8..67736e3 100644 --- a/README.md +++ b/README.md @@ -298,7 +298,7 @@ If there's a `./public` dir on the same level as your app's main file, static fi ## Testing -At the moment there are no unit tests or specs. However the tests currently provided are "headed" tests which run in the browser via "remote control". Pretty radical. +At the moment there are no unit tests or specs. However the tests currently provided are "headed" tests which run in the browser via "remote control". To run the headed, awesome, remote-control, in-browser tests you need Firefox 3. @@ -312,13 +312,9 @@ Before the tests can be run, the [Selenium RC](http://seleniumhq.org/projects/re You can get the Selenium RC from http://selenium.googlecode.com/files/selenium-remote-control-1.0.3.zip. -Once it's running, simply launch the automated tests... +Once it's running, simply launch the automated tests: cake test - -What happens next is mind-blowingly amazing; but I'll leave that as a special surprise for the brave and fearless testers. - -P.S: The tests are asynchronous ... *drool* ## Whew! diff --git a/bin/zappa.coffee b/bin/zappa.coffee index eb15fd1..ae0834c 100755 --- a/bin/zappa.coffee +++ b/bin/zappa.coffee @@ -5,16 +5,16 @@ coffee = require 'coffee-script' fs = require 'fs' path = require 'path' puts = console.log -inspect = require('util').inspect -spawn = require('child_process').spawn -OptionParser = require('coffee-script/optparse').OptionParser +{inspect} = require 'util' +{spawn} = require 'child_process' +{OptionParser} = require 'coffee-script/optparse' child = null file = null watching = [] # On coffee-script@0.9.6, argv looks like [filename], # On coffee-script@1.0.0, argv looks like ["node", "path/to/coffee", filename] -if process.argv[0] is 'node' and process.argv.length >= 3 +if process.argv[0] is 'node' and process.argv.length >= 2 argv = process.argv[2..] else argv = process.argv[0..] @@ -33,14 +33,18 @@ switches = [ ['-w', '--watch', 'Keeps watching the file and restarts the app when it changes.'] ] -compile = (coffee_path) -> +compile = (coffee_path, callback) -> fs.readFile coffee_path, (err, data) -> - js = coffee.compile String(data), bare: yes - js = "require('zappa').run(function(){#{js}});" - js_path = path.basename(coffee_path, path.extname(coffee_path)) + '.js' - dir = path.dirname coffee_path - js_path = path.join dir, js_path - fs.writeFile js_path, js + if err then callback(err) + else + js = coffee.compile String(data), bare: yes + js = "require('zappa').run(function(){#{js}});" + js_path = path.basename(coffee_path, path.extname(coffee_path)) + '.js' + dir = path.dirname coffee_path + js_path = path.join dir, js_path + fs.writeFile js_path, js, (err) -> + if err then callback(err) + else callback() remove_watch_option = -> i = argv.indexOf('-w') @@ -89,7 +93,9 @@ else process.exit -1 if options.compile - compile file + compile file, (err) -> + if err then puts err; process.exit -1 + else process.exit() else if options.watch remove_watch_option() diff --git a/lib/zappa.coffee b/lib/zappa.coffee index 6e1bd16..6fc8ece 100644 --- a/lib/zappa.coffee +++ b/lib/zappa.coffee @@ -2,7 +2,7 @@ zappa = exports express = require 'express' fs = require 'fs' puts = console.log -inspect = require('sys').inspect +{inspect} = require 'sys' coffee = null jquery = null io = null @@ -22,11 +22,10 @@ class Zappa process: process module: module - @ensure_app 'default' unless @current_app? - for name in 'get|post|put|del|route|at|msg|client|using|def|helper|postrender|layout|view|style'.split '|' do (name) => @locals[name] = => + @ensure_app 'default' unless @current_app? @current_app[name].apply @current_app, arguments app: (name) -> @@ -431,6 +430,6 @@ publish_api = (from, to, methods) -> z = new Zappa() -zappa.version = '0.1.3' +zappa.version = '0.1.4' zappa.run = -> z.run.apply z, arguments zappa.run_file = -> z.run_file.apply z, arguments diff --git a/package.json b/package.json index 37b6f23..54d0e74 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,24 @@ { "name": "zappa", - "description": "Razor-sharp DSL for modern web apps.", - "version": "0.1.3", + "description": "Web development, cut-the-crap style.", + "version": "0.1.4", "author": "Maurice Machado ", "contributors": [ {"name": "Maurice Machado", "email": "maurice@bitbending.com"}, + {"name": "Nicholas Kinsey", "email": "nicholas.kinsey@feistystudios.com"}, + {"name": "Jae Kwon", "email": "jae@flywheelnetworks.com"}, {"name": "Vladimir Dronnikov", "email": "dronnikov@gmail.com"}, {"name": "Isaac Wolkerstorfer", "email": "agnoster@gmail.com"} ], "dependencies": { - "express": "1.0.0", - "coffeekup": ">= 0.2.1", - "coffee-script": ">= 0.9.5", - "socket.io": ">= 0.6.1", + "express": ">= 1.0.1", + "coffeekup": ">= 0.2.2", + "coffee-script": ">= 1.0.0", + "socket.io": ">= 0.6.3", "jquery": ">= 1.4.3" }, "keywords": ["framework", "websockets", "coffeescript"], "bin": { "zappa": "./bin/zappa.coffee" }, "directories": { "lib": "./lib" }, - "engines": { "node": ">= 0.2.5" } + "engines": { "node": ">= 0.2.6" } }