Permalink
Browse files

Swapped out Makefile for Cakefile. Updated dep versions

  • Loading branch information...
1 parent 51a6481 commit d46b96a2a71db47af36065f75289060c81f56f2f @balupton balupton committed Jan 25, 2013
Showing with 122 additions and 58 deletions.
  1. +114 −0 Cakefile
  2. +0 −50 Makefile
  3. +8 −8 package.json
View
114 Cakefile
@@ -0,0 +1,114 @@
+# This file was originally created by Benjamin Lupton <b@lupton.cc> (http://balupton.com)
+# and is currently licensed under the Creative Commons Zero (http://creativecommons.org/publicdomain/zero/1.0/)
+# making it public domain so you can do whatever you wish with it without worry (you can even remove this notice!)
+#
+# If you change something here, be sure to reflect the changes in:
+# - the scripts section of the package.json file
+# - the .travis.yml file
+
+
+# -----------------
+# Variables
+
+WINDOWS = process.platform.indexOf('win') is 0
+NODE = process.execPath
+NPM = if WINDOWS then process.execPath.replace('node.exe','npm.cmd') else 'npm'
+EXT = (if WINDOWS then '.cmd' else '')
+ROOT = process.cwd()
+APP = "#{ROOT}/app"
+SITE = "#{ROOT}/site"
+BIN = "#{ROOT}/node_modules/.bin"
+CAKE = "#{BIN}/cake#{EXT}"
+COFFEE = "#{BIN}/coffee#{EXT}"
+DOCPAD = "#{BIN}/docpad#{EXT}"
+APPOUT = "#{APP}/out"
+APPSRC = "#{APP}/src"
+SITEOUT = "#{SITE}/out"
+SITESRC = "#{SITE}/src"
+
+
+# -----------------
+# Requires
+
+pathUtil = require('path')
+{exec,spawn} = require('child_process')
+safe = (next,fn) ->
+ return (args...) ->
+ err = args[0]
+ return next(err) if err
+ return fn(args...)
+
+
+# -----------------
+# Actions
+
+clean = (opts,next) ->
+ (next = opts; opts = {}) unless next?
+ args = [
+ '-Rf'
+ APPOUT
+ SITEOUT
+ pathUtil.join(ROOT,'node_modules')
+ pathUtil.join(ROOT,'*out')
+ pathUtil.join(ROOT,'*log')
+ ]
+ spawn('rm', args, {stdio:'inherit',cwd:ROOT}).on('exit',next)
+
+compile = (opts,next) ->
+ (next = opts; opts = {}) unless next?
+ spawn(COFFEE, ['-bco', APPOUT, APPSRC], {stdio:'inherit',cwd:ROOT}).on 'exit', safe next, ->
+ spawn(DOCPAD, ['generate','--env','static'], {stdio:'inherit',cwd:ROOT}).on('exit',next)
+
+watch = (opts,next) ->
+ (next = opts; opts = {}) unless next?
+ spawn(COFFEE, ['-bwco', APPOUT, APPSRC], {stdio:'inherit',cwd:ROOT})
+ spawn(DOCPAD, ['run','--env','static'], {stdio:'inherit',cwd:ROOT})
+ next()
+
+install = (opts,next) ->
+ (next = opts; opts = {}) unless next?
+ spawn(NPM, ['install'], {stdio:'inherit',cwd:ROOT}).on('exit',next)
+
+reset = (opts,next) ->
+ (next = opts; opts = {}) unless next?
+ clean opts, safe next, ->
+ setup opts, next
+
+setup = (opts,next) ->
+ (next = opts; opts = {}) unless next?
+ install opts, safe next, ->
+ compile opts, next
+
+finish = (err) ->
+ throw err if err
+ console.log('OK')
+
+
+# -----------------
+# Commands
+
+# clean
+task 'clean', 'clean up instance', ->
+ clean finish
+
+# compile
+task 'compile', 'compile our files', ->
+ compile finish
+
+# dev/watch
+task 'dev', 'watch and recompile our files', ->
+ watch finish
+task 'watch', 'watch and recompile our files', ->
+ watch finish
+
+# install
+task 'install', 'install dependencies', ->
+ install finish
+
+# reset
+task 'reset', 'reset instance', ->
+ reset finish
+
+# setup
+task 'setup', 'setup for development', ->
+ setup finish
View
@@ -1,50 +0,0 @@
-# If you change something here, be sure to reflect the changes in:
-# - the scripts section of the package.json file
-# - the .travis.yml file
-
-# -----------------
-# Variables
-
-BIN=node_modules/.bin/
-COFFEE=$(BIN)coffee
-OUT=app/out
-SRC=app/src
-
-
-# -----------------
-# Documentation
-
-# Usage: coffee [options] path/to/script.coffee -- [args]
-# -b, --bare compile without a top-level function wrapper
-# -c, --compile compile to JavaScript and save as .js files
-# -o, --output set the output directory for compiled JavaScript
-# -w, --watch watch scripts for changes and rerun commands
-
-
-# -----------------
-# Commands
-
-# Watch and recompile our files
-dev:
- $(COFFEE) -cbwo $(OUT) $(SRC)
-
-# Compile our files
-compile:
- $(COFFEE) -cbo $(OUT) $(SRC)
-
-# Clean up
-clean:
- rm -Rf $(OUT) site/out node_modules *.log
-
-# Install dependencies
-install:
- npm install
-
-# Reset
-reset:
- make clean
- make install
- make compile
-
-# Ensure the listed commands always re-run and are never cached
-.PHONY: dev compile clean install reset
View
@@ -24,7 +24,7 @@
"npm": "1.1.x"
},
"dependencies": {
- "docpad": "6.21.x",
+ "docpad": "~6.21.7",
"docpad-plugin-coffeekup": "2.x",
"docpad-plugin-coffeescript": "2.x",
"docpad-plugin-eco": "2.x",
@@ -35,15 +35,15 @@
"docpad-plugin-services": "2.x",
"docpad-plugin-stylus": "2.1.x",
"docpad-plugin-text": "2.x",
- "feedr": "2.4.x",
- "bal-util": "~1.15.3",
- "moment": "1.7.x",
- "underscore": "1.4.x",
- "underscore.string": "2.3.x",
- "request": "2.11.x"
+ "feedr": "~2.4.0",
+ "bal-util": "~1.16.1",
+ "moment": "~1.7.2",
+ "underscore": "~1.4.3",
+ "underscore.string": "~2.3.1",
+ "request": "~2.12.0"
},
"devDependencies": {
- "coffee-script": "1.4.x",
+ "coffee-script": "~1.4.0",
"docpad-plugin-livereload": "2.x"
},
"subdomain": "docpad",

0 comments on commit d46b96a

Please sign in to comment.