Permalink
Browse files

v6.59.2. Bugfix.

- v6.59.2 December 19, 2013
	- More reliable delay of requests while the initial generation is
still performing
	- Removed the deprecated `writeSource` meta data header, `writeSource`
is now only available via the API usage
	- Added new `generated` event that will fire once the initial
generation has completed
  • Loading branch information...
balupton committed Dec 19, 2013
1 parent 896d0b5 commit b9754fd81850827e809210099d35974b91361a65
Showing with 29 additions and 13 deletions.
  1. +6 −1 HISTORY.md
  2. +1 −1 package.json
  3. +15 −6 src/lib/docpad.coffee
  4. +1 −2 src/lib/models/document.coffee
  5. +5 −1 src/test/actions-test.coffee
  6. +1 −2 test/src/documents/writesource.txt.eco
View
@@ -1,10 +1,15 @@
# History
+- v6.59.2 December 19, 2013
+ - More reliable delay of requests while the initial generation is still performing
+ - Removed the deprecated `writeSource` meta data header, `writeSource` is now only available via the API usage
+ - Added new `generated` event that will fire once the initial generation has completed
+
- v6.59.1 December 19, 2013
- Fixed listening on heroku (regression since v6.58.2)
- v6.59.0 December 19, 2013
- - Removed the previously deprecated `ensureFile`, `ensureDocument`, `ensureModel`/`ensureFileOrDocument` methods, use `addFile`, `addDocument`, and `addModel` instead
+ - Removed the deprecated `ensureFile`, `ensureDocument`, `ensureModel`/`ensureFileOrDocument` methods, use `addFile`, `addDocument`, and `addModel` instead
- Improved watching, should hopefully fix [#738](https://github.com/bevry/docpad/issues/738), [#742](https://github.com/bevry/docpad/issues/742), [#739](https://github.com/bevry/docpad/issues/739)
- Updated dependencies
View
@@ -1,7 +1,7 @@
{
"title": "DocPad. Streamlined web development.",
"name": "docpad",
- "version": "6.59.1",
+ "version": "6.59.2",
"description": "DocPad is a next generation web architecture that lets you create fast static websites with dynamic abilities and powerful abstractions. Write your website as files on your computer, entries in a database, or even RSS feeds and DocPad will import it, generate & render it, then output a static website for deployment anywhere or a dynamic node website for advanced server-side functionality. Use it as a module or standalone. It's purely awesome. Check it out.",
"homepage": "http://docpad.org",
"installUrl": "http://docpad.org/install",
View
@@ -203,7 +203,6 @@ class DocPad extends EventEmitterGrouped
'generateBefore'
'populateCollectionsBefore'
'populateCollections'
- 'generateAfter'
'contextualizeBefore'
'contextualizeAfter'
'renderBefore'
@@ -214,6 +213,8 @@ class DocPad extends EventEmitterGrouped
'renderAfter'
'writeBefore'
'writeAfter'
+ 'generateAfter'
+ 'generated'
'serverBefore'
'serverExtend'
'serverAfter'
@@ -453,9 +454,9 @@ class DocPad extends EventEmitterGrouped
docpad = @
# If we have not performed a generation yet then wait until the initial generation has completed
- if docpad.generateEnded is null # or docpad.generating is true
+ if docpad.generated is false
# Wait until generation has completed and recall ourselves
- docpad.once 'generateAfter', ->
+ docpad.once 'generated', ->
return docpad.getFileByRoute(url, next)
# hain
@@ -1952,6 +1953,9 @@ class DocPad extends EventEmitterGrouped
docpad = @
database = docpad.getDatabase()
+ # Make it as if we have never generated before
+ docpad.generated = false
+
# Perform a complete clean of our collections
database.reset([])
meta = @getBlock('meta').reset([])
@@ -3180,6 +3184,7 @@ class DocPad extends EventEmitterGrouped
generateStarted: null
generateEnded: null
generating: false
+ generated: false # true once the first generation has occured
# Create Progress Bar
createProgress: ->
@@ -3282,7 +3287,7 @@ class DocPad extends EventEmitterGrouped
# Mode: Initial
# Shall we do some basic initial checks
# Set to the opts.reset value if specified, or whether are the initial generation
- opts.initial ?= lastGenerateStarted? is false
+ opts.initial ?= !(opts.generated)
# Mode: Reset
# Shall we reset the database
@@ -3355,8 +3360,12 @@ class DocPad extends EventEmitterGrouped
docpad.log 'info', util.format(locale.renderGenerated, howMany, seconds)
docpad.notify (new Date()).toLocaleTimeString(), {title: locale.renderGeneratedNotification}
- # Forward
- return next(err)
+ # Generated
+ if opts.initial is true
+ docpad.generated = true
+ return docpad.emitSerial('generated', opts, next)
+ else
+ return next(err)
# Extract functions from tasks for simplicity
# when dealing with nested tasks/groups
@@ -606,12 +606,11 @@ class DocumentModel extends FileModel
# Fetch
opts.content ?= (@getContent() or '').toString('')
- opts.cleanAttributes ?= false
# Adjust
CSON = require('cson') unless CSON
metaData = @getMeta().toJSON(true)
- delete metaData.writeSource if opts.cleanAttributes is true or metaData.writeSource is 'once'
+ delete metaData.writeSource
content = body = opts.content.replace(/^\s+/,'')
header = CSON.stringifySync(metaData)
if !header or header is '{}'
@@ -20,7 +20,7 @@ expectPath = pathUtil.join(rootPath, 'out-expected')
cliPath = pathUtil.join(docpadPath, 'bin', 'docpad')
# Params
-port = 9779
+port = 9770
hostname = "0.0.0.0"
baseUrl = "http://#{hostname}:#{port}"
testWait = 1000*60*5 # five minutes
@@ -92,6 +92,10 @@ joe.suite 'docpad-actions', (suite,test) ->
docpad.action 'generate', (err) ->
done(err)
+ test 'writeSource', (done) ->
+ file = docpad.getFileAtPath('writesource.txt.eco')
+ file.writeSource(done)
+
suite 'results', (suite,test) ->
testMarkup = (key,actual,expected) ->
test key, ->
@@ -1,7 +1,6 @@
### cson
{
- title: "Write source test"
- writeSource: true
+title: "Write source test"
}
###

0 comments on commit b9754fd

Please sign in to comment.