Permalink
Browse files

v6.61.0. Bugfix.

- v6.61.0 January 27, 2014
	- Fixed regeneration always regenerating everything (regression since
v6.58.0)
  • Loading branch information...
1 parent f99f053 commit d1c24762a08a73eab90df22dddaf798bac6c5772 @balupton balupton committed Jan 27, 2014
Showing with 27 additions and 4 deletions.
  1. +3 −0 HISTORY.md
  2. +1 −1 package.json
  3. +23 −3 src/lib/docpad.coffee
View
@@ -1,5 +1,8 @@
# History
+- v6.61.0 January 27, 2014
+ - Fixed regeneration always regenerating everything (regression since v6.58.0)
+
- v6.60.4 January 27, 2014
- Implemented `304 Not Modified` header
- Fixed some `date` and `stat` errors (regression since v6.60.0)
View
@@ -1,7 +1,7 @@
{
"title": "DocPad. Streamlined web development.",
"name": "docpad",
- "version": "6.60.4",
+ "version": "6.61.0",
"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
@@ -1179,9 +1179,14 @@ class DocPad extends EventEmitterGrouped
# Ensure we regenerate anything (on the next regeneration) that was using the same outPath
outPath = model.get('outPath')
if outPath
- @database.findAll({outPath}).each (model) ->
+ updatedModels = @database.findAll({outPath})
+ updatedModels.remove(model)
+ updatedModels.each (model) ->
model.set('mtime': new Date())
+ # Log
+ docpad.log('debug', 'Updated mtime for these models due to remove of a similar one', updatedModels.pluck('relativePath'))
+
# Return safely
return true
)
@@ -1209,9 +1214,13 @@ class DocPad extends EventEmitterGrouped
if previousOutPath
# Ensure we regenerate anything (on the next regeneration) that was using the same outPath
previousModels = @database.findAll(outPath:previousOutPath)
+ previousModels.remove(model)
previousModels.each (model) ->
model.set('mtime': new Date())
+ # Log
+ docpad.log('debug', 'Updated mtime for these models due to addition of a similar one', previousModels.pluck('relativePath'))
+
# Update the cache entry with another file that has the same outPath or delete it if there aren't any others
previousModelId = @filesByOutPath[previousOutPath]
if previousModelId is model.id
@@ -1902,6 +1911,17 @@ class DocPad extends EventEmitterGrouped
referencesOthers: true
})
)
+ # @TODO
+ # We should not enable referencesOthers for stylesheets
+ # But instead check if there is a stylesheet that has been modified and is to be regenerated
+ # Then add the rest of the stylesheets to the regenerate list
+ # That way, when you modify a html file, it doesn't regenerate stylesheets, unless they are actually referencing others
+ # But it would still mean that if you modify a stylsheet, it does import the others correctly
+ # However, really, this only applies to stylsheets that concantate the contents of their @imports to other stylesheets
+ # So maybe, we could do something like
+ # $contains: '@import'
+ # but $contains doesn't exist yet
+ # though this still only applies to those that bundle other stylesheets inside themselves
)
# Blocks
@@ -3497,7 +3517,7 @@ class DocPad extends EventEmitterGrouped
else
# Use Partial Collection
addTask 'Add only changed models to render queue', ->
- opts.collection ?= new FilesCollection().add(docpad.getCollection('generate').findAll(
+ changedQuery =
$or:
# Get changed files
mtime: $gte: lastGenerateStarted
@@ -3506,7 +3526,7 @@ class DocPad extends EventEmitterGrouped
$and:
wtime: null
write: true
- ).models)
+ opts.collection ?= new FilesCollection().add(docpad.getCollection('generate').findAll(changedQuery).models)
addTask 'generateBefore', (complete) ->

0 comments on commit d1c2476

Please sign in to comment.