Permalink
Browse files

Merge branch 'master' into dev-render

  • Loading branch information...
balupton committed Dec 3, 2012
2 parents 7b6bca7 + 173f70d commit 2ed366427f97e78e4568ce850cda4260a94d6623
Showing with 96 additions and 25 deletions.
  1. +39 −0 CONTRIBUTING.md
  2. +3 −0 History.md
  3. +7 −2 README.md
  4. +1 −1 package.json
  5. +46 −22 src/lib/docpad.coffee
View
@@ -0,0 +1,39 @@
# Contributing
## Support
1. Use the GitHub Issues only for development tasks and bug reports
1. For anything else (questions, support, etc) use our [Official Support Channels](http://bevry.me/support)
1. With bug reports, be sure to specify:
1. Your docpad version `docpad --version`
1. Your node version `node --version`
1. Your npm version `npm --version`
1. Your operating system's name, architecture, and version
1. What you did
1. What happened
1. What you expected
## Development
1. Fork the DocPad Repository
1. Clone your fork and cd into it
1. Run `npm install` to install dependencies
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
## Pull Requests
1. Each pull request should be made on its own branch. Branches should be stemmed from master. E.g. `git checout master; git checkout -b your-new-branch`
1. Test your changes before you submit the pull request (see testing section), if possible, add tests for your change - if you don't know how to fix the tests, submit your pull request and say so, happy to help (but it will slow down integration)
1. When submitting the pull request, specify the `dev` branch as the integration branch (the integration branch is which branch your pull request will be merged into on the official repo)
1. If you'd like, feel free to add yourself to the contributors section of the `package.json` file if it exists
1. By submitting a pull request, you agree that your submission can be used freely and without restraint by those whom your submitting the pull request to
## Testing
1. Run `npm 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`
View
@@ -1,5 +1,8 @@
## History
- v6.15.0 December 3, 2012
- [Nodejitsu](http://nodejitsu.com/) Support
- v6.14.0 November 29, 2012
- Added `DocPad::getFileByUrl(url)` and updated the middleware router to use it
- Big performance gain on request response time
View
@@ -1,9 +1,14 @@
[![DocPad Logo](http://d.pr/i/cfmt+)](http://bevry.me/docpad/intro "Get started with DocPad today via the Bevry Learning Centre")
# DocPad. Streamlined web development. [![Build Status](https://secure.travis-ci.org/bevry/docpad.png?branch=master)](http://travis-ci.org/bevry/docpad)
Hi! I'm DocPad, I streamline the web development process and help close the gap between experts and beginners. I've been used in production by big and small companies for over a year and a half now to create [plenty of amazing and powerful web sites and applications](http://bevry.me/docpad/showcase) quicker than ever before. What makes me different is instead of being a box to cram yourself into and hold you back, I'm a freeway to what you want to accomplish, just getting out of your way and allowing you to create stuff quicker than ever before without limits. Leave the redudant stuff up to me, so you can focus on the awesome stuff.
Discover my features below, or skip ahead to the installation instructions to get started with a [fully functional pre-made website](http://bevry.me/docpad/skeletons) in a few minutes from reading this.
**[Watch the Screencast!](https://vimeo.com/53755097)**
## Features
### Out of the box
@@ -55,14 +60,14 @@ All sorts of people love DocPad, from first time web developers to even industry
## [Quick Start](http://bevry.me/docpad/start)
[Click here for our latest Quick Start Guide](http://bevry.me/docpad/start)
[Click here to skip ahead to our latest Quick Start Guide](http://bevry.me/docpad/start)
## What next?
Here are some quick links to help you get started:
- [Getting Started](http://bevry.me/docpad/overview)
- [Getting Started](http://bevry.me/docpad/intro)
- [Frequently Asked Questions](http://bevry.me/docpad/faq)
- [Showcase and Examples](http://bevry.me/docpad/showcase)
- [Guides and Tutorials](http://bevry.me/learn)
View
@@ -1,6 +1,6 @@
{
"name": "docpad",
"version": "6.14.0",
"version": "6.15.0",
"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",
View
@@ -549,11 +549,14 @@ class DocPad extends EventEmitterEnhanced
# Get Environment
getEnvironment: ->
return @getConfig().env
env = @getConfig().env or 'development'
return env
# Get Environments
getEnvironments: ->
return @getEnvironment().split(/[, ]+/)
env = @getEnvironment()
envs = env.split(/[, ]+/)
return envs
# -----------------------------
@@ -835,6 +838,10 @@ class DocPad extends EventEmitterEnhanced
getConfig: ->
return @config or {}
# Get the Port
getPort: ->
return @getConfig().port or 9778
# =================================
# Initialization Functions
@@ -1015,9 +1022,15 @@ class DocPad extends EventEmitterEnhanced
return next(err) if err
# Get environments
@initialConfig.port ?= process.env.PORT ? process.env.VCAP_APP_PORT ? process.env.VMC_APP_PORT ? 9778
@initialConfig.env or= process.env.NODE_ENV or 'development'
@config.env = @instanceConfig.env or @websiteConfig.env or @websitePackageConfig.env or @initialConfig.env
# Here as by now we would have loaded our .env file, whereas earlier we may not have
@initialConfig.port ?= process.env.PORT ? process.env.VCAP_APP_PORT ? process.env.VMC_APP_PORT
@initialConfig.env ?= process.env.NODE_ENV
# Apply the environment
# websitePackageConfig.env is left out of the detection here as it is usually an object
# that is already merged with our process.env by the environment runner
# rather than a string which is the docpad convention
@config.env = @instanceConfig.env or @websiteConfig.env or @initialConfig.env
envs = @getEnvironments()
# Merge configurations
@@ -3149,6 +3162,7 @@ class DocPad extends EventEmitterEnhanced
docpad = @
config = @config
locale = @getLocale()
port = @getPort()
serverExpress = null
serverHttp = null
@@ -3159,35 +3173,45 @@ class DocPad extends EventEmitterEnhanced
opts.middleware404 ?= config.middleware404
opts.middleware500 ?= config.middleware500
# Handlers
complete = (err) ->
# Finish
finish = (err) ->
return next(err) if err
# Plugins
docpad.emitSync 'serverAfter', {server:serverExpress,serverExpress,serverHttp,express}, (err) ->
return next(err) if err
# Complete
# Done
docpad.log 'debug', 'Server setup'
return next()
startServer = ->
# Start the server
try
serverHttp.listen(config.port)
# Start Server
startServer = (next) ->
# Catch
serverHttp.once 'error', (err) ->
# Friendlify the error message if it is what we suspect it is
if err.message.indexOf('EADDRINUSE') isnt -1
err = new Error(util.format(locale.serverInUse, port))
# Done
return next(err)
# Listen
serverHttp.listen port, ->
# Log
address = serverHttp.address()
unless address?
throw new Error(util.format(locale.serverInUse, config.port))
serverHostname = if address.address is '0.0.0.0' then 'localhost' else address.address
serverPort = address.port
serverLocation = "http://#{serverHostname}:#{serverPort}/"
serverDir = config.outPath
docpad.log 'info', util.format(locale.serverStarted, serverLocation, serverDir)
catch err
return complete(err)
finally
return complete()
# Plugins
# Done
return next()
# Start
docpad.emitSync 'serverBefore', {}, (err) ->
return complete(err) if err
return finish(err) if err
# Server
{serverExpress,serverHttp} = docpad.getServer(true)
@@ -3204,7 +3228,7 @@ class DocPad extends EventEmitterEnhanced
# Extend the server
unless config.extendServer
# Start the Server
startServer()
startServer(finish)
else
# Require
express ?= require('express')
@@ -3246,7 +3270,7 @@ class DocPad extends EventEmitterEnhanced
serverExpress.error(docpad.serverMiddleware500) if opts.middleware500 isnt false
# Start the Server
startServer()
startServer(finish)
# Chain

0 comments on commit 2ed3664

Please sign in to comment.