Permalink
Browse files

Reworked packaging for npm 1.x.

  • Loading branch information...
1 parent 1449e9a commit 2d2b83c74dd68d809c6adad37f850e684be42068 @mauricemach mauricemach committed May 6, 2011
Showing with 62 additions and 53 deletions.
  1. +2 −1 .gitignore
  2. +2 −0 .npmignore
  3. +4 −0 CHANGELOG.md
  4. +2 −2 Cakefile
  5. +7 −0 bin/zappa
  6. +1 −0 examples/public/foo.txt
  7. +0 −2 index.js
  8. +1 −0 lib/.gitignore
  9. +9 −9 package.json
  10. +33 −38 bin/zappa.coffee → src/cli.coffee
  11. +1 −1 {lib → src}/zappa.coffee
View
@@ -1,2 +1,3 @@
+.DS_Store
material/
-lib/zappa.js
+node_modules/
View
@@ -0,0 +1,2 @@
+.git*
+material/
View
@@ -1,3 +1,7 @@
+**v0.1.5** (2010-05-06):
+
+ - Reworked packaging for npm 1.x.
+
**v0.1.4** (2010-01-05):
- Updated to CoffeeScript 1.0.0 and node 0.2.6/0.3.3.
View
@@ -1,9 +1,9 @@
{spawn, exec} = require 'child_process'
-{puts} = require 'sys'
+{puts} = console.log
task 'build', ->
- exec 'coffee -c lib/zappa.coffee', (err) ->
+ exec 'coffee -o lib -c src/*.coffee', (err) ->
puts err if err
task 'test', ->
View
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+
+var path = require('path')
+var fs = require('fs')
+var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib')
+
+require(lib + '/cli').run()
@@ -0,0 +1 @@
+bar
View
@@ -1,2 +0,0 @@
-require('coffee-script')
-module.exports = require('./lib/zappa')
View
@@ -0,0 +1 @@
+*.js
View
@@ -1,7 +1,7 @@
{
"name": "zappa",
"description": "Web development, cut-the-crap style.",
- "version": "0.1.4",
+ "version": "0.1.5",
"author": "Maurice Machado <maurice@bitbending.com>",
"contributors": [
{"name": "Maurice Machado", "email": "maurice@bitbending.com"},
@@ -10,16 +10,16 @@
{"name": "Vladimir Dronnikov", "email": "dronnikov@gmail.com"},
{"name": "Isaac Wolkerstorfer", "email": "agnoster@gmail.com"}
],
+ "repository": {"type": "git", "url": "http://github.com/mauricemach/zappa.git"},
"dependencies": {
- "express": ">= 1.0.1",
- "coffeekup": ">= 0.2.2",
- "coffee-script": ">= 1.0.0",
+ "express": ">= 2.3.0",
+ "coffeekup": ">= 0.2.3",
+ "coffee-script": ">= 1.0.1",
"socket.io": ">= 0.6.3",
- "jquery": ">= 1.4.3"
+ "jquery": ">= 1.5.1"
},
"keywords": ["framework", "websockets", "coffeescript"],
- "bin": { "zappa": "./bin/zappa.coffee" },
- "directories": { "lib": "./lib" },
- "main": "./lib/index",
- "engines": { "node": ">= 0.2.6" }
+ "bin": "./bin/zappa",
+ "main": "./lib/zappa",
+ "engines": { "node": ">= 0.4.1" }
}
View
@@ -1,6 +1,4 @@
-#!/usr/bin/env coffee
-
-zappa = require 'zappa'
+zappa = require './zappa'
coffee = require 'coffee-script'
fs = require 'fs'
path = require 'path'
@@ -12,12 +10,8 @@ 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 >= 2
- argv = process.argv[2..]
-else
- argv = process.argv[0..]
+argv = process.argv[2..]
+options = null
usage = '''
Usage:
@@ -70,36 +64,37 @@ watch = (file) ->
child.kill() # Infanticide!
spawn_child()
-parser = new OptionParser switches, usage
-options = parser.parse argv
-args = options.arguments
-delete options.arguments
+@run = ->
+ parser = new OptionParser switches, usage
+ options = parser.parse argv
+ args = options.arguments
+ delete options.arguments
-if options.port
- options.port = if options.port.match /,/ then options.port.split ',' else [options.port]
- for i, p of options.port
- options.port[i] = parseInt(p)
+ if options.port
+ options.port = if options.port.match /,/ then options.port.split ',' else [options.port]
+ for i, p of options.port
+ options.port[i] = parseInt(p)
-if args.length is 0
- puts parser.help() if options.help or argv.length is 0
- puts zappa.version if options.version
- process.exit()
-else
- file = args[0]
-
- path.exists file, (exists) ->
- if not exists
- puts "\"#{file}\" not found."
- process.exit -1
+ if args.length is 0
+ puts parser.help() if options.help or argv.length is 0
+ puts zappa.version if options.version
+ process.exit()
+ else
+ file = args[0]
- if options.compile
- compile file, (err) ->
- if err then puts err; process.exit -1
- else process.exit()
- else
- if options.watch
- remove_watch_option()
- spawn_child()
- watch file
+ path.exists file, (exists) ->
+ if not exists
+ puts "\"#{file}\" not found."
+ process.exit -1
+
+ if options.compile
+ compile file, (err) ->
+ if err then puts err; process.exit -1
+ else process.exit()
else
- zappa.run_file file, options
+ if options.watch
+ remove_watch_option()
+ spawn_child()
+ watch file
+ else
+ zappa.run_file file, options
@@ -431,6 +431,6 @@ publish_api = (from, to, methods) ->
z = new Zappa()
-zappa.version = '0.1.4'
+zappa.version = '0.1.5'
zappa.run = -> z.run.apply z, arguments
zappa.run_file = -> z.run_file.apply z, arguments

0 comments on commit 2d2b83c

Please sign in to comment.