forked from mauricemach/zappa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec990ae
commit 5ccf1cb
Showing
6 changed files
with
43 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected], argv looks like [filename], | ||
# On [email protected], 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() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>", | ||
"contributors": [ | ||
{"name": "Maurice Machado", "email": "[email protected]"}, | ||
{"name": "Nicholas Kinsey", "email": "[email protected]"}, | ||
{"name": "Jae Kwon", "email": "[email protected]"}, | ||
{"name": "Vladimir Dronnikov", "email": "[email protected]"}, | ||
{"name": "Isaac Wolkerstorfer", "email": "[email protected]"} | ||
], | ||
"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" } | ||
} |