Permalink
Browse files

v6.9.1. Improvement.

- v6.9.1 October 25, 2012
	- Added `reloadPaths` configuration option
		- When a change occurs in one of the reload paths then we will reload
docpad
	- Added `getBlocks` and `setBlocks`
	- Added `getCollections` and `setCollections`
	- Will now output how long the generation took
  • Loading branch information...
1 parent a78801d commit 3d19846ce535a363ec1fa859bdcc4598707f0627 @balupton balupton committed Oct 25, 2012
Showing with 123 additions and 96 deletions.
  1. +7 −0 History.md
  2. +2 −2 locale/en.cson
  3. +1 −1 package.json
  4. +113 −93 src/lib/docpad.coffee
View
@@ -1,5 +1,12 @@
## History
+- v6.9.1 October 25, 2012
+ - Added `reloadPaths` configuration option
+ - When a change occurs in one of the reload paths then we will reload docpad
+ - Added `getBlocks` and `setBlocks`
+ - Added `getCollections` and `setCollections`
+ - Will now output how long the generation took
+
- v6.9.0 October 25, 2012
- Updated dependencies
- [CoffeeScript](http://coffeescript.org/) 1.4.x from 1.3x
View
@@ -44,7 +44,7 @@
watchChange: "Change detected at %s"
watchIgnoredChange: "Ignored change at %s"
watchDirectoryChange: "Directory change at %s"
- watchConfigChange: "Configuration change detected at %s"
+ watchReloadChange: "Reload change detected at %s"
# Render
renderingFiles: "Rendering %s files"
@@ -53,7 +53,7 @@
renderProgress: "Currently on %s at %s"
renderGenerating: "Generating..."
renderGeneratingNotification: "Website generating..."
- renderGenerated: "Generated %s files"
+ renderGenerated: "Generated %s files in %s seconds"
renderGeneratedNotification: "Website generated"
renderParsing: 'Parsing everything'
renderParsed: 'Parsed everything'
View
@@ -1,6 +1,6 @@
{
"name": "docpad",
- "version": "6.9.0",
+ "version": "6.9.1",
"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",
"keywords": [
View
@@ -172,6 +172,17 @@ class DocPad extends EventEmitterEnhanced
@blocks[name] = value
@
+ # Get blocks
+ setBlocks: (blocks) ->
+ @blocks
+ @
+
+ # Set blocks
+ setBlocks: (blocks) ->
+ for own name,value of blocks
+ @setBlock(name,value)
+ @
+
# Collections
collections: null
### {
@@ -194,6 +205,16 @@ class DocPad extends EventEmitterEnhanced
@collections[name] = value
@
+ # Get collections
+ getCollections: ->
+ return @collections
+
+ # Set collections
+ setCollections: (collections) ->
+ for own name,value of collections
+ @setCollection(name,value)
+ @
+
# ---------------------------------
# Collection Helpers
@@ -501,6 +522,20 @@ class DocPad extends EventEmitterEnhanced
'docpad.cson'
]
+ # Plugin directories to load
+ pluginPaths: []
+
+ # The website's plugins directory
+ pluginsPaths: [
+ 'node_modules',
+ 'plugins'
+ ]
+
+ # Paths that we should watch for changes in
+ # and when a change occurs, reload our configuration and perform a complete regenerated
+ # Our configPaths are appended to this
+ reloadPaths: []
+
# The website's out directory
outPath: 'out'
@@ -526,15 +561,6 @@ class DocPad extends EventEmitterEnhanced
'layouts'
]
- # Plugin directories to load
- pluginPaths: []
-
- # The website's plugins directory
- pluginsPaths: [
- 'node_modules',
- 'plugins'
- ]
-
# Ignored files patterns during directory parsing
# Default to balUtil.commonIgnorePatterns
ignorePatterns: true
@@ -1170,93 +1196,86 @@ class DocPad extends EventEmitterEnhanced
config.collections or= {}
# Standard Collections
- documentsCollection = database.createLiveChildCollection()
- .setQuery('isDocument', {
- $or:
- isDocument: true
- fullPath: $startsWith: config.documentsPaths
- })
- .on('add', (model) ->
- docpad.log('debug', util.format(locale.addingDocument, model.attributes.fullPath))
- _.defaults(model.attributes,{
- isDocument: true
- render: true
- write: true
+ @setCollections(
+ # Standard Collections
+ documents: database.createLiveChildCollection()
+ .setQuery('isDocument', {
+ $or:
+ isDocument: true
+ fullPath: $startsWith: config.documentsPaths
})
- )
- filesCollection = database.createLiveChildCollection()
- .setQuery('isFile', {
- $or:
- isFile: true
- fullPath: $startsWith: config.filesPaths
- })
- .on('add', (model) ->
- docpad.log('debug', util.format(locale.addingFile, model.attributes.fullPath))
- _.defaults(model.attributes,{
- isFile: true
- render: false
- write: true
+ .on('add', (model) ->
+ docpad.log('debug', util.format(locale.addingDocument, model.attributes.fullPath))
+ _.defaults(model.attributes,{
+ isDocument: true
+ render: true
+ write: true
+ })
+ )
+ files: database.createLiveChildCollection()
+ .setQuery('isFile', {
+ $or:
+ isFile: true
+ fullPath: $startsWith: config.filesPaths
})
- )
- layoutsCollection = database.createLiveChildCollection()
- .setQuery('isLayout', {
- $or:
- isLayout: true
- fullPath: $startsWith: config.layoutsPaths
- })
- .on('add', (model) ->
- docpad.log('debug', util.format(locale.addingLayout, model.attributes.fullPath))
- _.defaults(model.attributes,{
- isLayout: true
- render: false
- write: false
+ .on('add', (model) ->
+ docpad.log('debug', util.format(locale.addingFile, model.attributes.fullPath))
+ _.defaults(model.attributes,{
+ isFile: true
+ render: false
+ write: true
+ })
+ )
+ layouts: database.createLiveChildCollection()
+ .setQuery('isLayout', {
+ $or:
+ isLayout: true
+ fullPath: $startsWith: config.layoutsPaths
})
- )
-
- # Special Collections
- htmlCollection = database.createLiveChildCollection()
- .setQuery('isHTML', {
- $or:
- isDocument: true
- isFile: true
- outExtension: 'html'
- })
- .on('add', (model) ->
- docpad.log('debug', util.format(locale.addingHtml, model.attributes.fullPath))
- )
- stylesheetCollection = database.createLiveChildCollection()
- .setQuery('isStylesheet', {
- $or:
- isDocument: true
- isFile: true
- outExtension: $in: [
- 'css',
- 'scss', 'sass',
- 'styl', 'stylus'
- 'less'
- ]
- })
- .on('add', (model) ->
- docpad.log('debug', util.format(locale.addingStylesheet, model.attributes.fullPath))
- model.attributes.referencesOthers = true
- )
+ .on('add', (model) ->
+ docpad.log('debug', util.format(locale.addingLayout, model.attributes.fullPath))
+ _.defaults(model.attributes,{
+ isLayout: true
+ render: false
+ write: false
+ })
+ )
- # Apply collections
- @setCollection('documents', documentsCollection)
- @setCollection('files', filesCollection)
- @setCollection('layouts', layoutsCollection)
- @setCollection('html', htmlCollection)
- @setCollection('stylesheets', stylesheetCollection)
+ # Special Collections
+ html: database.createLiveChildCollection()
+ .setQuery('isHTML', {
+ $or:
+ isDocument: true
+ isFile: true
+ outExtension: 'html'
+ })
+ .on('add', (model) ->
+ docpad.log('debug', util.format(locale.addingHtml, model.attributes.fullPath))
+ )
+ stylesheet: database.createLiveChildCollection()
+ .setQuery('isStylesheet', {
+ $or:
+ isDocument: true
+ isFile: true
+ outExtension: $in: [
+ 'css',
+ 'scss', 'sass',
+ 'styl', 'stylus'
+ 'less'
+ ]
+ })
+ .on('add', (model) ->
+ docpad.log('debug', util.format(locale.addingStylesheet, model.attributes.fullPath))
+ model.attributes.referencesOthers = true
+ )
+ )
# Blocks
- metaBlock = new MetaCollection()
- scriptsBlock = new ScriptsCollection()
- stylesBlock = new StylesCollection()
-
- # Apply Blocks
- @setBlock('meta', metaBlock)
- @setBlock('scripts', scriptsBlock)
- @setBlock('styles', stylesBlock)
+ @setBlocks(
+ meta: new MetaCollection()
+ scripts: new ScriptsCollection()
+ styles: new StylesCollection()
+ )
# Custom Collections Group
tasks = new balUtil.Group (err) ->
@@ -2314,7 +2333,8 @@ class DocPad extends EventEmitterEnhanced
return next(err) if err
# Log generated
- docpad.log 'info', util.format(locale.renderGenerated, (opts.count ? 'all'))
+ seconds = (new Date() - docpad.lastGenerate) / 1000
+ docpad.log 'info', util.format(locale.renderGenerated, (opts.count ? 'all'), seconds)
docpad.notify (new Date()).toLocaleTimeString(), title: locale.renderGeneratedNotification
# Completed
@@ -2540,9 +2560,9 @@ class DocPad extends EventEmitterEnhanced
# Watch the config
watchrs = watchr.watch(
- paths: docpad.config.configPaths
+ paths: _.union(docpad.config.reloadPaths, docpad.config.configPaths)
listener: ->
- docpad.log 'info', util.format(locale.watchConfigChange, new Date().toLocaleTimeString())
+ docpad.log 'info', util.format(locale.watchReloadChange, new Date().toLocaleTimeString())
docpad.action 'load', (err) ->
return docpad.fatal(err) if err
performGenerate(reset:true)

0 comments on commit 3d19846

Please sign in to comment.