Permalink
Browse files

Packaging reworked for npm 1.x.

  • Loading branch information...
1 parent 001eb2a commit fec0a69979a355bac4a50d70c34d847fba10ac96 @mauricemach committed May 6, 2011
View
@@ -1,3 +1,3 @@
.DS_Store
material/
-lib/coffeekup.js
+node_modules/
View
@@ -0,0 +1,2 @@
+.git*
+material/
View
@@ -1,8 +1,8 @@
exec = require('child_process').exec
task 'build', ->
- exec 'coffee -c lib/coffeekup.coffee', (err) ->
- puts err if err
+ exec 'coffee -o lib -c src/*.coffee', (err) ->
+ console.log err if err
task 'test', -> require('./test').run()
View
@@ -76,8 +76,8 @@ Just grab [node.js](http://nodejs.org/#download) and [npm](http://github.com/isa
coffeekup = require 'coffeekup'
- puts coffeekup.render -> h1 "You can feed me templates as functions."
- puts coffeekup.render "h1 'Or strings. I am not too picky.'"
+ console.log coffeekup.render -> h1 "You can feed me templates as functions."
+ console.log coffeekup.render "h1 'Or strings. I am not too picky.'"
Defining locals and context variables:
@@ -94,12 +94,12 @@ Defining locals and context variables:
attrs.name = attrs.id
@input attrs
- puts coffeekup.render template, context: {title: 'Log In'}, locals: helpers
+ console.log coffeekup.render template, context: {title: 'Log In'}, locals: helpers
Precompiling to functions:
standalone_template = coffeekup.compile template
- puts standalone_template(context: {foo: 'bar'}, locals: {ping: 'pong'})
+ console.log standalone_template(context: {foo: 'bar'}, locals: {ping: 'pong'})
With [zappa](http://github.com/mauricemach/zappa):
@@ -159,6 +159,10 @@ See [/examples](http://github.com/mauricemach/coffeekup/tree/master/examples) fo
## Change Log:
+**v0.2.3** (2011-05-06):
+
+ - Packaging reworked for npm 1.x.
+
**v0.2.2** (2011-01-05):
- Updated to CoffeeScript 1.0.0 and node 0.2.6/0.3.3.
@@ -179,4 +183,4 @@ See [/examples](http://github.com/mauricemach/coffeekup/tree/master/examples) fo
## Compatibility
-Latest version tested with node 0.2.6/0.3.3 and CoffeeScript 1.0.0.
+Latest version tested with node 0.4.7 and CoffeeScript 1.1.0.
View
@@ -1,4 +1,4 @@
-coffeekup = require 'coffeekup'
+coffeekup = require './lib/coffeekup'
jade = require 'jade'
ejs = require 'ejs'
eco = require 'eco'
@@ -183,7 +183,7 @@ benchmark = (title, code) ->
code()
puts "#{title}: #{new Date - start} ms"
-exports.run = ->
+@run = ->
benchmark 'CoffeeKup (precompiled)', -> coffeekup_compiled_template context: data
benchmark 'CoffeeKup (code)', -> coffeekup.render coffeekup_template, context: data
benchmark 'CoffeeKup (code, cache off)', -> coffeekup.render coffeekup_template, context: data, cache: off
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()
@@ -1,5 +1,4 @@
app = require('express').createServer()
-sys = require('sys')
app.register '.coffee', require('coffeekup')
app.set 'view engine', 'coffee'
@@ -16,4 +15,4 @@ app.get '/inline', (req, res) ->
app.listen 3000
-sys.puts "Listening on 3000..."
+console.log "Listening on 3000..."
@@ -10,4 +10,4 @@ meryl.run
templateExt: '.coffee'
templateFunc: coffeekup.adapters.meryl
-puts 'Listening on 3000...'
+console.log 'Listening on 3000...'
View
@@ -1 +0,0 @@
-module.exports = require('./coffeekup')
View
@@ -0,0 +1 @@
+*.js
View
@@ -1,18 +1,16 @@
{
"name": "coffeekup",
"description": "Markup as CoffeeScript.",
- "version": "0.2.2",
+ "version": "0.2.3",
"author": "Maurice Machado <maurice@bitbending.com>",
"contributors": [
{"name": "Maurice Machado", "email": "maurice@bitbending.com"},
{"name": "Vladimir Dronnikov", "email": "dronnikov@gmail.com"}
],
"repository": {"type": "git", "url": "http://github.com/mauricemach/coffeekup.git"},
- "dependencies": {"coffee-script": ">= 1.0.0"},
+ "dependencies": {"coffee-script": ">= 1.0.1"},
"keywords": ["template", "view", "coffeescript"],
- "bin": {"coffeekup": "./bin/coffeekup.coffee"},
- "main": "./index",
- "directories": {"lib": "./lib"},
- "main": "./lib/index",
- "engines": {"node": ">= 0.2.6"}
+ "bin": "./bin/coffeekup",
+ "main": "./lib/coffeekup",
+ "engines": {"node": ">= 0.4.1"}
}
View
@@ -1,17 +1,11 @@
-#!/usr/bin/env coffee
-
-coffeekup = require 'coffeekup'
+coffeekup = require './coffeekup'
fs = require 'fs'
path = require 'path'
puts = console.log
{OptionParser} = require 'coffee-script/lib/optparse'
-# 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
render = (input_path, output_directory) ->
fs.readFile input_path, (err, contents) ->
@@ -47,24 +41,25 @@ switches = [
['-h', '--help', 'display this help message']
]
-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
-puts parser.help() if options.help or argv.length is 0
-puts coffeekup.version if options.version
-if options.utils
- options.locals ?= {}
- options.locals.render = (file) ->
- contents = fs.readFileSync file
- coffeekup.render String(contents), options
+ puts parser.help() if options.help or argv.length is 0
+ puts coffeekup.version if options.version
+ if options.utils
+ options.locals ?= {}
+ options.locals.render = (file) ->
+ contents = fs.readFileSync file
+ coffeekup.render String(contents), options
-if args.length > 0
- file = args[0]
+ if args.length > 0
+ file = args[0]
- if options.watch
- fs.watchFile file, {persistent: true, interval: 500}, (curr, prev) ->
- return if curr.size is prev.size and curr.mtime.getTime() is prev.mtime.getTime()
- render file, options.output
- else render file, options.output
+ if options.watch
+ fs.watchFile file, {persistent: true, interval: 500}, (curr, prev) ->
+ return if curr.size is prev.size and curr.mtime.getTime() is prev.mtime.getTime()
+ render file, options.output
+ else render file, options.output
@@ -5,7 +5,7 @@ else
coffeekup = exports
coffee = require 'coffee-script'
-coffeekup.version = '0.2.2'
+coffeekup.version = '0.2.3'
skeleton = (ck_options = {}) ->
ck_options.context ?= {}
View
@@ -1,4 +1,4 @@
-exports.run = ->
+@run = ->
test 'Literal text', ->
'Just text' is render ->
text 'Just text'
@@ -101,7 +101,7 @@ exports.run = ->
puts = console.log
print = require('sys').print
-ck = require 'coffeekup'
+ck = require './lib/coffeekup'
render = ck.render
[tests, passed, failed, errors] = [[], [], [], []]

0 comments on commit fec0a69

Please sign in to comment.