From 4214f364f4fc10a794a5ed00b11e7f142430824c Mon Sep 17 00:00:00 2001 From: dodo Date: Thu, 5 Jan 2012 16:34:50 +0100 Subject: [PATCH] new build system compile at pre-publish --- .gitignore | 2 +- .npmignore | 2 ++ Cakefile | 13 +++++++++++++ package.json | 8 ++++---- slug.js | 2 +- wscript | 28 ---------------------------- 6 files changed, 21 insertions(+), 34 deletions(-) create mode 100644 .npmignore create mode 100644 Cakefile delete mode 100644 wscript diff --git a/.gitignore b/.gitignore index 9152933..545b6bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ *~ *.swp -build/* +lib/* .lock-wscript node_modules/ diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..b2784f0 --- /dev/null +++ b/.npmignore @@ -0,0 +1,2 @@ +Cakefile +src/ diff --git a/Cakefile b/Cakefile new file mode 100644 index 0000000..d2178c5 --- /dev/null +++ b/Cakefile @@ -0,0 +1,13 @@ +path = require 'path' +{ run, compileScript } = require 'muffin' + + +task 'build', 'compile coffeescript → javascript', (options) -> + run + options:options + files:[ + "./src/**/*.coffee" + ] + map: + 'src/(.+).coffee': (m) -> + compileScript m[0], path.join("lib" ,"#{m[1]}.js"), options diff --git a/package.json b/package.json index 60c14aa..d6e7e23 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,10 @@ , "engines": {"node": ">= 0.4.x"} , "keywords": ["slugify", "slug", "string", "utf8", "utf-8", "unicode", "url"] , "scripts": { - "preinstall": "#preinstall DO NOTHING", - "install": "node-waf configure build", - "update": "node-waf build"} + "pre-publish": "cake build"} , "dependencies": { - "unicode": ">= 0.2.1", + "unicode": ">= 0.2.1"} +, "devDependencies": { + "muffin": ">= 0.2.6", "coffee-script": ">= 1.1.2"} } diff --git a/slug.js b/slug.js index 319c4a6..1c7f3a9 100644 --- a/slug.js +++ b/slug.js @@ -1,2 +1,2 @@ -module.exports = require('./build/default/slug') +module.exports = require('./lib/slug') diff --git a/wscript b/wscript deleted file mode 100644 index 7194d3c..0000000 --- a/wscript +++ /dev/null @@ -1,28 +0,0 @@ -from os.path import dirname, join -import os - -topdir = "." -outdir = "build" - -class Dummy: pass - - -def configure(ctx): - ctx.env.PATH = os.environ['PATH'].split(os.pathsep) - ctx.env.PATH.append(join(ctx.cwd, "node_modules", "coffee-script", "bin")) - ctx.find_program("coffee", var="COFFEE", path_list=ctx.env.PATH) - ctx.env.COFFEE_ARGS = "-co" - ctx.env.set_variant("default") - - -def build(ctx): - env = Dummy() - env.variant = lambda: "" - for file in ctx.path.find_dir("src").ant_glob("**/*.coffee", flat=False): - tgtpath = file.change_ext(".js").bldpath(env)[5:] - ctx.path.exclusive_build_node(tgtpath) - ctx(name = "coffee", - rule = "${COFFEE} ${COFFEE_ARGS} %s/%s ${SRC}" % ( - ctx.env.variant(),dirname(tgtpath)), - source = file.srcpath()[3:], - target = tgtpath)