Skip to content

Commit

Permalink
v6.21.5. Bugfix. Improvement.
Browse files Browse the repository at this point in the history
- v6.21.5 January 24, 2013
	- Supports Node v0.9
	- Added `renderSingleExtensions` option
		- Note: currently this will render `src/documents/script.coffee` from
CoffeeScript to JavaScript as intended, HOWEVER the outfile will be
`out/script.coffee` instead of the expected `out/script.js`. We will
likely have to do an extension mapping for single extensions.
	- Added expiremental `docpad-compile` executable
	- Updated dependencies
		- [bal-util](https://github.com/balupton/bal-util) from ~1.15.4 to
~1.16.0
  • Loading branch information
balupton committed Jan 24, 2013
1 parent d2ef381 commit 50d67b8
Show file tree
Hide file tree
Showing 12 changed files with 230 additions and 118 deletions.
2 changes: 2 additions & 0 deletions .npmignore
@@ -1,5 +1,7 @@
.travis*
Cakefile
Makefile
History.md

docs/
src/
Expand Down
5 changes: 4 additions & 1 deletion .travis.yml
@@ -1,8 +1,11 @@
language: node_js
before_script: "make test-prepare"
install: "npm install"
before_script: "./node_modules/.bin/cake test-prepare"
script: "./node_modules/.bin/cake test"
node_js:
- 0.6
- 0.8
- 0.9
notifications:
irc:
- "irc.freenode.org#bevry-dev"
Expand Down
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -19,9 +19,10 @@

1. Fork the DocPad Repository
1. Clone your fork and cd into it
1. Run `npm install` to install dependencies
1. Insure CoffeeScript is installed globally; `npm install -g coffee-script`
1. Run `cake setup` to setup project for development
1. Run `npm link` to link our local copy as the global instance (so it is available via `docpad`)
1. Run `make dev` to compile our coffeescript and recompile on changes
1. Run `cake watch` to compile our source files and recompile on changes


## Pull Requests
Expand All @@ -35,5 +36,5 @@

## Testing

1. Run `npm test` to run the tests
1. Run `cake test` to run the tests
1. There are several types of tests run, the most common is the rendering test, which compares files inside `test/out` to `test/out-expected`
129 changes: 129 additions & 0 deletions Cakefile
@@ -0,0 +1,129 @@
# 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 '')
APP = process.cwd()
BIN = "#{APP}/node_modules/.bin"
CAKE = "#{BIN}/cake#{EXT}"
COFFEE = "#{BIN}/coffee#{EXT}"
OUT = "#{APP}/out"
SRC = "#{APP}/src"
TEST = "#{APP}/test"


# -----------------
# Requires

pathUtil = require('path')
{exec,spawn} = require('child_process')
safe = (next,fn) ->
return (err) ->
return next(err) if err
return fn()


# -----------------
# Actions

clean = (opts,next) ->
(next = opts; opts = {}) unless next?
args = [
'-Rf'
OUT
pathUtil.join(APP,'node_modules')
pathUtil.join(APP,'*out')
pathUtil.join(APP,'*log')
pathUtil.join(TEST,'node_modules')
pathUtil.join(TEST,'*out')
pathUtil.join(TEST,'*log')
]
spawn('rm', args, {stdio:'inherit',cwd:APP}).on('exit',next)

compile = (opts,next) ->
(next = opts; opts = {}) unless next?
spawn(COFFEE, ['-bco', OUT, SRC], {stdio:'inherit',cwd:APP}).on('exit',next)

watch = (opts,next) ->
(next = opts; opts = {}) unless next?
spawn(COFFEE, ['-bwco', OUT, SRC], {stdio:'inherit',cwd:APP}).on('exit',next)

install = (opts,next) ->
(next = opts; opts = {}) unless next?
spawn(NPM, ['install'], {stdio:'inherit',cwd:APP}).on 'exit', safe next, ->
spawn(NPM, ['install'], {stdio:'inherit',cwd:TEST}).on('exit',next)

reset = (opts,next) ->
(next = opts; opts = {}) unless next?
clean opts, safe next, -> install opts, safe next, -> compile opts, next

setup = (opts,next) ->
(next = opts; opts = {}) unless next?
install opts, safe next, ->
compile opts, next

test = (opts,next) ->
(next = opts; opts = {}) unless next?
args = []
args.push("--debug-brk") if opts.debug
args.push("#{OUT}/test/everything.test.js")
args.push("--joe-reporter=list")
spawn(NODE, args, {stdio:'inherit',cwd:APP}, 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

# test
task 'test', 'run our tests', ->
test finish

# test-debug
task 'test-debug', 'run our tests in debug mode', ->
test {debug:true}, finish

# test-prepare
task 'test-prepare', 'prepare out tests', ->
setup finish

8 changes: 8 additions & 0 deletions History.md
@@ -1,5 +1,13 @@
## History

- v6.21.5 January 24, 2013
- Supports Node v0.9
- Added `renderSingleExtensions` option
- Note: currently this will render `src/documents/script.coffee` from CoffeeScript to JavaScript as intended, HOWEVER the outfile will be `out/script.coffee` instead of the expected `out/script.js`. We will likely have to do an extension mapping for single extensions.
- Added expiremental `docpad-compile` executable
- Updated dependencies
- [bal-util](https://github.com/balupton/bal-util) from ~1.15.4 to ~1.16.0

- v6.21.4 January 16, 2013
- Fixed incorrect meta data parsing for certain files
- Closes [issue #394](https://github.com/bevry/docpad/issues/394) thanks to [Jose Quesada](https://github.com/quesada) and [Stefan](https://github.com/stegrams)
Expand Down
File renamed without changes.
61 changes: 0 additions & 61 deletions Makefile

This file was deleted.

2 changes: 2 additions & 0 deletions bin/docpad-compile
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require(__dirname+'/../out/bin/docpad-compile');
7 changes: 4 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "docpad",
"version": "6.21.4",
"version": "6.21.5",
"description": "DocPad is a language agnostic document management system. This means you write your website as documents, in whatever language you wish, and DocPad will handle the compiling, templates and layouts for you. For static documents it will generate static files, for dynamic documents it'll re-render them on each request. You can utilise DocPad by itself, or use it as a module your own custom system. It's pretty cool, and well worth checking out. We love it.",
"homepage": "https://github.com/bevry/docpad",
"installUrl": "http://docpad.org/install",
Expand Down Expand Up @@ -61,7 +61,7 @@
"npm": ">=1.1"
},
"dependencies": {
"bal-util": "~1.15.4",
"bal-util": "~1.16.0",
"caterpillar": "~1.1.3",
"commander": "~1.1.1",
"cson": "~1.4.0",
Expand Down Expand Up @@ -90,11 +90,12 @@
},
"bin": {
"docpad": "./bin/docpad",
"docpad-compile": "./bin/docpad-compile",
"docpad-debug": "./bin/docpad-debug",
"docpad-server": "./bin/docpad-server"
},
"scripts": {
"test": "node ./out/test/everything.test.js"
"test": "./node_modules/.bin/cake test"
},
"main": "./out/main.js"
}
53 changes: 53 additions & 0 deletions src/bin/docpad-compile.coffee
@@ -0,0 +1,53 @@
# Require
DocPad = require(__dirname+'/../lib/docpad')

# Prepare
getArgument = (name,value=null,defaultValue=null) ->
result = defaultValue
argumentIndex = process.argv.indexOf("--#{name}")
if argumentIndex isnt -1
result = value ? process.argv[argumentIndex+1]
return result

# DocPad Action
action = (getArgument('action',null,'generate')+' '+getArgument('watch','watch','')).trim()

# DocPad Configuration
docpadConfig = {}
docpadConfig.rootPath = getArgument('rootPath',null,process.cwd())
docpadConfig.outPath = getArgument('outPath',null,docpadConfig.rootPath+'/out')
docpadConfig.srcPath = getArgument('srcPath',null,docpadConfig.rootPath+'/src')
docpadConfig.documentsPaths = (->
documentsPath = getArgument('documentsPath')
if documentsPath?
documentsPath = docpadConfig.srcPath if documentsPath is 'auto'
else
documentsPath = docpadConfig.srcPath+'/documents'
return [documentsPath]
)()
docpadConfig.port = (->
port = getArgument('port')
port = parseInt(port,10) if port and isNaN(port) is false
return port
)()
docpadConfig.renderSingleExtensions = (->
renderSingleExtensions = getArgument('renderSingleExtensions',null,'auto')
if renderSingleExtensions in ['true','yes']
renderSingleExtensions = true
else if renderSingleExtensions in ['false','no']
renderSingleExtensions = false
return renderSingleExtensions
)()

# Create DocPad Instance
DocPad.createInstance docpadConfig, (err,docpad) ->
# Check
return console.log(err.stack) if err

# Generate and Serve
docpad.action action, (err) ->
# Check
return console.log(err.stack) if err

# Done
console.log('OK')
38 changes: 16 additions & 22 deletions src/bin/docpad-server.coffee
@@ -1,29 +1,23 @@
# Require
DocPad = require(__dirname+'/../lib/docpad')

# DocPad Configuration
docpadConfig = {}
serverAction = process.env.DOCPAD_SERVER_ACTION or 'server generate'
# Prepare
getArgument = (name,value=null,defaultValue=null) ->
result = defaultValue
argumentIndex = process.argv.indexOf("--#{name}")
if argumentIndex isnt -1
result = value ? process.argv[argumentIndex+1]
return result

# --action <value>
(->
actionArgumentIndex = process.argv.indexOf('--action')
if actionArgumentIndex isnt -1
serverAction = process.argv[actionArgumentIndex+1]
)()
# DocPad Action
action = getArgument('action',null,'server generate')

# --port <value>
(->
portArgument = null
portArgumentIndex = process.argv.indexOf('--port')
if portArgumentIndex isnt -1
portArgument = process.argv[portArgumentIndex+1]
if isNaN(portArgument)
portArgument = null
else
portArgument = parseInt(portArgument,10)
if portArgument
docpadConfig.port = portArgument
# DocPad Configuration
docpadConfig = {}
docpadConfig.port = (->
port = getArgument('port')
port = parseInt(port,10) if port and isNaN(port) is false
return port
)()

# Create DocPad Instance
Expand All @@ -32,7 +26,7 @@ DocPad.createInstance docpadConfig, (err,docpad) ->
return console.log(err.stack) if err

# Generate and Serve
docpad.action serverAction, (err) ->
docpad.action action, (err) ->
# Check
return console.log(err.stack) if err

Expand Down

0 comments on commit 50d67b8

Please sign in to comment.