Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: docpad/docpad
...
head fork: docpad/docpad
Checking mergeability… Don't worry, you can still create the pull request.
  • 1 commit
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 25, 2012
@balupton balupton v5.1.1. Bugfixes and binary files are now allowed in documents.
- v5.1.1 April 25, 2012
	- Fixed EventEmitter warning
	- Binary files can now be placed within the `src/documents` directory
	- Removed eyes devDependency
	- Models now use CoffeeScript's class extend, instead of Backbone's
extend
6cb26b9
Showing with 33 additions and 24 deletions.
  1. +10 −4 History.md
  2. +21 −18 lib/models/file.coffee
  3. +2 −2 package.json
View
14 History.md
@@ -1,5 +1,11 @@
## History
+- v5.1.1 April 25, 2012
+ - Fixed EventEmitter warning
+ - Binary files can now be placed within the `src/documents` directory
+ - Removed eyes devDependency
+ - Models now use CoffeeScript's class extend, instead of Backbone's extend
+
- v5.0.5 April 14, 2012
- Added `.npmignore` file
- Added `document.contentType` and `document.contentTypeRendered`
@@ -145,20 +151,20 @@
- #97 - Watching is unusable when combined with hidden files from IDEs and SVN
- #57 - Offline Setup: Skeletons needs to be cached for future offline installs
- #55 - As a User, I want support for Moustache, so that I can use my preferred markup
-
+
- v3.1 Unreleased
- Added an interactive cli
- Closes
- #125 - As a User, I want an Interactive CLI, so that I can do more with DocPad's CLI
-
+
- v3.0 Unreleased
- Added a new event system
- Closes
- #60 - DocPad needs a better event system
-
+
- v2.6 January 2, 2012
- Transferred DocPad's ownership from [Benjamin Lupton](http://balupton.com) to [Bevry](http://bevry.me) (Benjamin's company)
@@ -358,7 +364,7 @@
- v0.7 May 20, 2011
- Now supports multiple docpad instances
-
+
- v0.6 May 12, 2011
- Moved to CoffeeScript
- Removed highlight.js (should be a plugin or client-side feature)
View
39 lib/models/file.coffee
@@ -46,7 +46,7 @@ class FileModel extends Model
# The unique document identifier
id: null
-
+
# The file's name without the extension
basename: null
@@ -137,7 +137,7 @@ class FileModel extends Model
# Get Meta
getMeta: ->
return @meta
-
+
# Load
# If the fullPath exists, load the file
# If it doesn't, then parse and normalize the file
@@ -150,7 +150,7 @@ class FileModel extends Model
# Log
logger.log('debug', "Loading the file #{filePath}")
-
+
# Handler
complete = (err) ->
return next?(err) if err
@@ -168,7 +168,7 @@ class FileModel extends Model
@normalize (err) =>
return next?(err) if err
complete()
-
+
# Chain
@
@@ -211,10 +211,10 @@ class FileModel extends Model
balUtil.closeFile()
return next?(err) if err
file.parseData(data, tasks.completer())
-
+
# Chain
@
-
+
# Parse data
# Parses some data, and loads the meta data and content from it
# next(err)
@@ -242,9 +242,9 @@ class FileModel extends Model
# Extract content from data
if data instanceof Buffer
- contentStartBinary = data.toString('binary',0,8)
- contentStartUTF8 = data.toString('utf8',0,8)
- contentStartASCII = data.toString('ascii',0,8)
+ contentStartBinary = data.toString('binary',0,32)
+ contentStartUTF8 = data.toString('utf8',0,32)
+ contentStartASCII = data.toString('ascii',0,32)
if contentStartBinary isnt contentStartUTF8
encoding = 'binary'
content = ''
@@ -254,7 +254,7 @@ class FileModel extends Model
else
encoding = 'ascii'
content = data.toString('ascii')
-
+
else if typeof data is 'string'
content = data
else
@@ -269,7 +269,7 @@ class FileModel extends Model
# Next
next?()
@
-
+
# Add a url
# Allows our file to support multiple urls
addUrl: (url) ->
@@ -277,7 +277,7 @@ class FileModel extends Model
if url instanceof Array
for newUrl in url
@addUrl(newUrl)
-
+
# Single Url
else if url
found = false
@@ -287,11 +287,11 @@ class FileModel extends Model
found = true
break
urls.push(url) if not found
-
+
# Chain
@
-
+
# Normalize data
# Normalize any parsing we have done, as if a value has updates it may have consequences on another value. This will ensure everything is okay.
# next(err)
@@ -340,7 +340,7 @@ class FileModel extends Model
# Next
next?()
@
-
+
# Contextualize data
# Put our data into perspective of the bigger picture. For instance, generate the url for it's rendered equivalant.
# next(err)
@@ -370,6 +370,9 @@ class FileModel extends Model
# Write Data
writeFile: (fullPath,data,next) ->
+ # Prepare
+ file = @
+
# Write data
balUtil.openFile -> fs.writeFile fullPath, data, (err) ->
balUtil.closeFile()
@@ -385,7 +388,7 @@ class FileModel extends Model
logger = @logger
fileOutPath = @get('outPath')
content = @get('content') or @get('data')
-
+
# Log
logger.log 'debug', "Writing the file #{fileOutPath}"
@@ -393,13 +396,13 @@ class FileModel extends Model
@writeFile fileOutPath, content, (err) ->
# Check
return next?(err) if err
-
+
# Log
logger.log 'debug', "Wrote the file #{fileOutPath}"
# Next
next?()
-
+
# Chain
@
View
4 package.json
@@ -1,6 +1,6 @@
{
"name": "docpad",
- "version": "5.0.5",
+ "version": "5.1.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": [
@@ -69,4 +69,4 @@
"enableUnlistedPlugins": true,
"port": 9778
}
-}
+}

No commit comments for this range

Something went wrong with that request. Please try again.