Permalink
Browse files

v6.21.3. Bugfix. Improvement.

- v6.21.3 January 9, 2013
	- Fixed ignored files sometimes triggering reloads
	- Added `ignorePaths`, `ignoreHiddenFiles` options
	- Added `DocPad::isIgnoredPath`, `DocPad::scandir`, `DocPad::watchdir`
helpers
  • Loading branch information...
balupton committed Jan 8, 2013
1 parent f72dec2 commit a86883d2a75eb9911f1bf9e22e1406f32f3f8d40
Showing with 71 additions and 48 deletions.
  1. +5 −0 History.md
  2. +20 −20 package.json
  3. +46 −28 src/lib/docpad.coffee
View
@@ -1,5 +1,10 @@
## History
- v6.21.3 January 9, 2013
- Fixed ignored files sometimes triggering reloads
- Added `ignorePaths`, `ignoreHiddenFiles` options
- Added `DocPad::isIgnoredPath`, `DocPad::scandir`, `DocPad::watchdir` helpers
- v6.21.2 January 8, 2013
- Fixed `Base::setDefaults` and `File::setMetaDefaults` always forcing defaults
- Thanks to [Stefan](https://github.com/stegrams) for [pull request #396](https://github.com/bevry/docpad/pull/396)
View
@@ -1,6 +1,6 @@
{
"name": "docpad",
"version": "6.21.2",
"version": "6.21.3",
"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",
@@ -56,33 +56,33 @@
"url": "http://github.com/bevry/docpad.git"
},
"engines" : {
"node": ">=0.6.0",
"npm": ">=1.1.0"
"node": ">=0.6",
"npm": ">=1.1"
},
"dependencies": {
"bal-util": "~1.15.2",
"caterpillar": "1.1.x",
"commander": "1.1.x",
"cson": "1.4.x",
"express": "3.0.x",
"mime": "1.2.x",
"query-engine": "1.5.x",
"semver": "1.1.x",
"underscore": "1.4.x",
"bal-util": "~1.15.4",
"caterpillar": "~1.1.3",
"commander": "~1.1.1",
"cson": "~1.4.0",
"express": "~3.0.6",
"mime": "~1.2.7",
"query-engine": "~1.5.0",
"semver": "~1.1.2",
"underscore": "~1.4.3",
"backbone": "0.9.9",
"watchr": "2.3.x",
"yamljs": "0.1.x"
"watchr": "~2.3.3",
"yamljs": "~0.1.4"
},
"optionalDependencies": {
"airbrake": "0.2.x",
"growl": "1.6.x",
"airbrake": "~0.2.9",
"growl": "~1.6.1",
"mixpanel": "0.0.10"
},
"devDependencies": {
"coffee-script": "1.4.x",
"chai": "1.4.x",
"joe": "1.1.x",
"request": "2.12.x"
"coffee-script": "~1.4.0",
"chai": "~1.4.2",
"joe": "~1.1.1",
"request": "~2.12.0"
},
"directories": {
"lib": "./out/lib"
View
@@ -691,8 +691,10 @@ class DocPad extends EventEmitterEnhanced
]
# Ignored file patterns during directory parsing
ignorePaths: false
ignoreHiddenFiles: false
ignoreCommonPatterns: true
ignoreCustomPatterns: null
ignoreCustomPatterns: false
# -----------------------------
@@ -933,7 +935,41 @@ class DocPad extends EventEmitterEnhanced
@
# ---------------------------------
# =================================
# Helpers
# Is Ignored Path
isIgnoredPath: (path,opts={}) ->
opts = balUtil.extend({
ignorePaths: @config.ignorePaths
ignoreHiddenFiles: @config.ignoreHiddenFiles
ignoreCommonPatterns: @config.ignoreCommonPatterns
ignoreCustomPatterns: @config.ignoreCustomPatterns
},opts)
return balUtil.isIgnoredPath(path,opts)
# Scan Directory
scandir: (opts={}) ->
opts = balUtil.extend({
ignorePaths: @config.ignorePaths
ignoreHiddenFiles: @config.ignoreHiddenFiles
ignoreCommonPatterns: @config.ignoreCommonPatterns
ignoreCustomPatterns: @config.ignoreCustomPatterns
},opts)
return balUtil.scandir(opts)
# Watch Directory
watchdir: (opts={}) ->
opts = balUtil.extend({
ignorePaths: @config.ignorePaths
ignoreHiddenFiles: @config.ignoreHiddenFiles
ignoreCommonPatterns: @config.ignoreCommonPatterns
ignoreCustomPatterns: @config.ignoreCustomPatterns
},opts)
return require('watchr').watch(opts)
# =================================
# Setup and Loading
# Ready
@@ -1797,14 +1833,10 @@ class DocPad extends EventEmitterEnhanced
docpad.log 'debug', util.format(locale.renderDirectoryParsing, path)
# Files
balUtil.scandir(
@scandir(
# Path
path: path
# Ignore patterns
ignoreCommonPatterns: docpad.config.ignoreCommonPatterns
ignoreCustomPatterns: docpad.config.ignoreCustomPatterns
# File Action
fileAction: (fileFullPath,fileRelativePath,nextFile,fileStat) ->
# Prepare
@@ -1995,14 +2027,10 @@ class DocPad extends EventEmitterEnhanced
# Load Plugins
docpad.log 'debug', util.format(locale.pluginsLoadingFor, pluginsPath)
balUtil.scandir(
@scandir(
# Path
path: pluginsPath
# Ignore patterns
ignoreCommonPatterns: docpad.config.ignoreCommonPatterns
ignoreCustomPatterns: docpad.config.ignoreCustomPatterns
# Skip files
fileAction: false
@@ -2856,9 +2884,6 @@ class DocPad extends EventEmitterEnhanced
# Watch
watch: (opts,next) =>
# Require
watchr = require('watchr')
# Prepare
[opts,next] = balUtil.extractOptsAndCallback(opts,next)
docpad = @
@@ -2883,10 +2908,8 @@ class DocPad extends EventEmitterEnhanced
tasks.total = 3
# Watch reload paths
watchr.watch(
docpad.watchdir(
paths: _.union(docpad.config.reloadPaths, docpad.config.configPaths)
ignoreCommonPatterns: docpad.config.ignoreCommonPatterns
ignoreCustomPatterns: docpad.config.ignoreCustomPatterns
listeners:
'log': docpad.log
'error': docpad.error
@@ -2902,10 +2925,8 @@ class DocPad extends EventEmitterEnhanced
)
# Watch regenerate paths
watchr.watch(
docpad.watchdir(
paths: docpad.config.regeneratePaths
ignoreCommonPatterns: docpad.config.ignoreCommonPatterns
ignoreCustomPatterns: docpad.config.ignoreCustomPatterns
listeners:
'log': docpad.log
'error': docpad.error
@@ -2917,10 +2938,8 @@ class DocPad extends EventEmitterEnhanced
)
# Watch the source
watchr.watch(
docpad.watchdir(
path: docpad.config.srcPath
ignoreCommonPatterns: docpad.config.ignoreCommonPatterns
ignoreCustomPatterns: docpad.config.ignoreCustomPatterns
listeners:
'log': docpad.log
'error': docpad.error
@@ -2958,10 +2977,9 @@ class DocPad extends EventEmitterEnhanced
docpad.log 'debug', util.format(locale.watchChange, new Date().toLocaleTimeString()), changeType, filePath
# Check if we are a file we don't care about
isIgnored = balUtil.testIgnorePatterns(filePath, {
ignoreCommonPatterns: docpad.config.ignoreCommonPatterns
ignoreCustomPatterns: docpad.config.ignoreCustomPatterns
})
# This check should not be needed with v2.3.3 of watchr
# however we've still got it here as it may still be an issue
isIgnored = docpad.isIgnoredPath(filePath)
if isIgnored
docpad.log 'debug', util.format(locale.watchIgnoredChange, new Date().toLocaleTimeString()), filePath
return

0 comments on commit a86883d

Please sign in to comment.