Permalink
Browse files

Fixed relativeOutDirPath, updated tests

  • Loading branch information...
1 parent db588a5 commit fb9b88b373831e87965baf1e59900a6912d8a0c8 @balupton balupton committed Jul 19, 2012
View
@@ -452,28 +452,28 @@ class FileModel extends Model
# Fetch
{opts,next} = @getActionArgs(opts,next)
- relativePath = @get('relativePath') or null
- relativeDirPath = @get('relativeDirPath') or null
- relativeBase = @get('relativeBase') or null
- filename = @get('filename') or null
- outPath = @get('outPath') or null
- outDirPath = @get('outDirPath') or null
+ relativePath = @get('relativePath')
+ relativeDirPath = @get('relativeDirPath')
+ relativeBase = @get('relativeBase')
+ filename = @get('filename')
+ outPath = @get('outPath')
+ outDirPath = @get('outDirPath')
# Create the URL for the file
- if relativePath?
+ if relativePath
url = "/#{relativePath}"
@setUrl(url)
# Create a slug for the file
- if relativeBase?
+ if relativeBase
changes.slug = slug = balUtil.generateSlugSync(relativeBase)
# Set name if it doesn't exist already
- if filename?
+ if filename
changes.name = name = filename
# Create the outPath if we have a outpute directory
- if @outDirPath? and relativePath?
+ if @outDirPath and relativePath
changes.relativeOutDirPath = relativeOutDirPath = relativeDirPath if relativeDirPath?
changes.relativeOutPath = relativeOutPath = relativePath
changes.outPath = outPath = pathUtil.join(@outDirPath,relativePath)
@@ -1,8 +1,8 @@
{ basename: 'attributes-nolayout',
body: '# Fetch data\nattrs = @getDocument().getAttributes()\n\n# Delete environment specific variables\ndelete attrs.ctime\ndelete attrs.mtime\ndelete attrs.date\ndelete attrs.fullPath\ndelete attrs.fullDirPath\ndelete attrs.outPath\ndelete attrs.outDirPath\ndelete attrs.data\n\n# Sort the attributes\nkeys = []\nkeys.push(key) for own key,value of attrs\nkeys.sort()\nsortedAttrs = {}\nfor key in keys\n sortedAttrs[key] = attrs[key]\n\n# Output data\ntext @require(\'util\').inspect(sortedAttrs)',
content: '# Fetch data\nattrs = @getDocument().getAttributes()\n\n# Delete environment specific variables\ndelete attrs.ctime\ndelete attrs.mtime\ndelete attrs.date\ndelete attrs.fullPath\ndelete attrs.fullDirPath\ndelete attrs.outPath\ndelete attrs.outDirPath\ndelete attrs.data\n\n# Sort the attributes\nkeys = []\nkeys.push(key) for own key,value of attrs\nkeys.sort()\nsortedAttrs = {}\nfor key in keys\n sortedAttrs[key] = attrs[key]\n\n# Output data\ntext @require(\'util\').inspect(sortedAttrs)',
- contentRendered: '{ basename: \'attributes-nolayout\',\n body: \'# Fetch data\\nattrs = @getDocument().getAttributes()\\n\\n# Delete environment specific variables\\ndelete attrs.ctime\\ndelete attrs.mtime\\ndelete attrs.date\\ndelete attrs.fullPath\\ndelete attrs.fullDirPath\\ndelete attrs.outPath\\ndelete attrs.outDirPath\\ndelete attrs.data\\n\\n# Sort the attributes\\nkeys = []\\nkeys.push(key) for own key,value of attrs\\nkeys.sort()\\nsortedAttrs = {}\\nfor key in keys\\n sortedAttrs[key] = attrs[key]\\n\\n# Output data\\ntext @require(\\\'util\\\').inspect(sortedAttrs)\',\n content: \'# Fetch data\\nattrs = @getDocument().getAttributes()\\n\\n# Delete environment specific variables\\ndelete attrs.ctime\\ndelete attrs.mtime\\ndelete attrs.date\\ndelete attrs.fullPath\\ndelete attrs.fullDirPath\\ndelete attrs.outPath\\ndelete attrs.outDirPath\\ndelete attrs.data\\n\\n# Sort the attributes\\nkeys = []\\nkeys.push(key) for own key,value of attrs\\nkeys.sort()\\nsortedAttrs = {}\\nfor key in keys\\n sortedAttrs[key] = attrs[key]\\n\\n# Output data\\ntext @require(\\\'util\\\').inspect(sortedAttrs)\',\n contentRendered: false,\n contentRenderedWithoutLayouts: null,\n contentType: \'application/octet-stream\',\n contentTypeRendered: \'text/plain\',\n dynamic: false,\n encoding: \'utf8\',\n extension: \'coffee\',\n extensionRendered: \'txt\',\n extensions: [ \'txt\', \'coffee\' ],\n filename: \'attributes-nolayout.txt.coffee\',\n filenameRendered: \'attributes-nolayout.txt\',\n header: \'title: \\\'Attributes No Layout\\\'\\ntags: [\\\'attributes\\\',\\\'with-layout\\\']\\n\',\n id: \'attributes-nolayout.txt.coffee\',\n isDocument: true,\n meta: \n { title: \'Attributes No Layout\',\n tags: [ \'attributes\', \'with-layout\' ] },\n name: \'attributes-nolayout.txt\',\n parser: \'yaml\',\n referencesOthers: false,\n relativeBase: \'attributes-nolayout\',\n relativeDirPath: \'\',\n relativePath: \'attributes-nolayout.txt.coffee\',\n render: true,\n renderSingleExtensions: false,\n rendered: false,\n slug: \'attributes-nolayout\',\n tags: [ \'attributes\', \'with-layout\' ],\n title: \'Attributes No Layout\',\n url: \'/attributes-nolayout.txt\',\n urls: [ \'/attributes-nolayout.txt\' ],\n write: true }',
- contentRenderedWithoutLayouts: '{ basename: \'attributes-nolayout\',\n body: \'# Fetch data\\nattrs = @getDocument().getAttributes()\\n\\n# Delete environment specific variables\\ndelete attrs.ctime\\ndelete attrs.mtime\\ndelete attrs.date\\ndelete attrs.fullPath\\ndelete attrs.fullDirPath\\ndelete attrs.outPath\\ndelete attrs.outDirPath\\ndelete attrs.data\\n\\n# Sort the attributes\\nkeys = []\\nkeys.push(key) for own key,value of attrs\\nkeys.sort()\\nsortedAttrs = {}\\nfor key in keys\\n sortedAttrs[key] = attrs[key]\\n\\n# Output data\\ntext @require(\\\'util\\\').inspect(sortedAttrs)\',\n content: \'# Fetch data\\nattrs = @getDocument().getAttributes()\\n\\n# Delete environment specific variables\\ndelete attrs.ctime\\ndelete attrs.mtime\\ndelete attrs.date\\ndelete attrs.fullPath\\ndelete attrs.fullDirPath\\ndelete attrs.outPath\\ndelete attrs.outDirPath\\ndelete attrs.data\\n\\n# Sort the attributes\\nkeys = []\\nkeys.push(key) for own key,value of attrs\\nkeys.sort()\\nsortedAttrs = {}\\nfor key in keys\\n sortedAttrs[key] = attrs[key]\\n\\n# Output data\\ntext @require(\\\'util\\\').inspect(sortedAttrs)\',\n contentRendered: false,\n contentRenderedWithoutLayouts: null,\n contentType: \'application/octet-stream\',\n contentTypeRendered: \'text/plain\',\n dynamic: false,\n encoding: \'utf8\',\n extension: \'coffee\',\n extensionRendered: \'txt\',\n extensions: [ \'txt\', \'coffee\' ],\n filename: \'attributes-nolayout.txt.coffee\',\n filenameRendered: \'attributes-nolayout.txt\',\n header: \'title: \\\'Attributes No Layout\\\'\\ntags: [\\\'attributes\\\',\\\'with-layout\\\']\\n\',\n id: \'attributes-nolayout.txt.coffee\',\n isDocument: true,\n meta: \n { title: \'Attributes No Layout\',\n tags: [ \'attributes\', \'with-layout\' ] },\n name: \'attributes-nolayout.txt\',\n parser: \'yaml\',\n referencesOthers: false,\n relativeBase: \'attributes-nolayout\',\n relativeDirPath: \'\',\n relativePath: \'attributes-nolayout.txt.coffee\',\n render: true,\n renderSingleExtensions: false,\n rendered: false,\n slug: \'attributes-nolayout\',\n tags: [ \'attributes\', \'with-layout\' ],\n title: \'Attributes No Layout\',\n url: \'/attributes-nolayout.txt\',\n urls: [ \'/attributes-nolayout.txt\' ],\n write: true }',
+ contentRendered: '{ basename: \'attributes-nolayout\',\n body: \'# Fetch data\\nattrs = @getDocument().getAttributes()\\n\\n# Delete environment specific variables\\ndelete attrs.ctime\\ndelete attrs.mtime\\ndelete attrs.date\\ndelete attrs.fullPath\\ndelete attrs.fullDirPath\\ndelete attrs.outPath\\ndelete attrs.outDirPath\\ndelete attrs.data\\n\\n# Sort the attributes\\nkeys = []\\nkeys.push(key) for own key,value of attrs\\nkeys.sort()\\nsortedAttrs = {}\\nfor key in keys\\n sortedAttrs[key] = attrs[key]\\n\\n# Output data\\ntext @require(\\\'util\\\').inspect(sortedAttrs)\',\n content: \'# Fetch data\\nattrs = @getDocument().getAttributes()\\n\\n# Delete environment specific variables\\ndelete attrs.ctime\\ndelete attrs.mtime\\ndelete attrs.date\\ndelete attrs.fullPath\\ndelete attrs.fullDirPath\\ndelete attrs.outPath\\ndelete attrs.outDirPath\\ndelete attrs.data\\n\\n# Sort the attributes\\nkeys = []\\nkeys.push(key) for own key,value of attrs\\nkeys.sort()\\nsortedAttrs = {}\\nfor key in keys\\n sortedAttrs[key] = attrs[key]\\n\\n# Output data\\ntext @require(\\\'util\\\').inspect(sortedAttrs)\',\n contentRendered: false,\n contentRenderedWithoutLayouts: null,\n contentType: \'application/octet-stream\',\n contentTypeRendered: \'text/plain\',\n dynamic: false,\n encoding: \'utf8\',\n extension: \'coffee\',\n extensionRendered: \'txt\',\n extensions: [ \'txt\', \'coffee\' ],\n filename: \'attributes-nolayout.txt.coffee\',\n filenameRendered: \'attributes-nolayout.txt\',\n header: \'title: \\\'Attributes No Layout\\\'\\ntags: [\\\'attributes\\\',\\\'with-layout\\\']\\n\',\n id: \'attributes-nolayout.txt.coffee\',\n isDocument: true,\n meta: \n { title: \'Attributes No Layout\',\n tags: [ \'attributes\', \'with-layout\' ] },\n name: \'attributes-nolayout.txt\',\n parser: \'yaml\',\n referencesOthers: false,\n relativeBase: \'attributes-nolayout\',\n relativeDirPath: \'\',\n relativeOutDirPath: \'\',\n relativeOutPath: \'attributes-nolayout.txt\',\n relativePath: \'attributes-nolayout.txt.coffee\',\n render: true,\n renderSingleExtensions: false,\n rendered: false,\n slug: \'attributes-nolayout\',\n tags: [ \'attributes\', \'with-layout\' ],\n title: \'Attributes No Layout\',\n url: \'/attributes-nolayout.txt\',\n urls: [ \'/attributes-nolayout.txt\' ],\n write: true }',
+ contentRenderedWithoutLayouts: '{ basename: \'attributes-nolayout\',\n body: \'# Fetch data\\nattrs = @getDocument().getAttributes()\\n\\n# Delete environment specific variables\\ndelete attrs.ctime\\ndelete attrs.mtime\\ndelete attrs.date\\ndelete attrs.fullPath\\ndelete attrs.fullDirPath\\ndelete attrs.outPath\\ndelete attrs.outDirPath\\ndelete attrs.data\\n\\n# Sort the attributes\\nkeys = []\\nkeys.push(key) for own key,value of attrs\\nkeys.sort()\\nsortedAttrs = {}\\nfor key in keys\\n sortedAttrs[key] = attrs[key]\\n\\n# Output data\\ntext @require(\\\'util\\\').inspect(sortedAttrs)\',\n content: \'# Fetch data\\nattrs = @getDocument().getAttributes()\\n\\n# Delete environment specific variables\\ndelete attrs.ctime\\ndelete attrs.mtime\\ndelete attrs.date\\ndelete attrs.fullPath\\ndelete attrs.fullDirPath\\ndelete attrs.outPath\\ndelete attrs.outDirPath\\ndelete attrs.data\\n\\n# Sort the attributes\\nkeys = []\\nkeys.push(key) for own key,value of attrs\\nkeys.sort()\\nsortedAttrs = {}\\nfor key in keys\\n sortedAttrs[key] = attrs[key]\\n\\n# Output data\\ntext @require(\\\'util\\\').inspect(sortedAttrs)\',\n contentRendered: false,\n contentRenderedWithoutLayouts: null,\n contentType: \'application/octet-stream\',\n contentTypeRendered: \'text/plain\',\n dynamic: false,\n encoding: \'utf8\',\n extension: \'coffee\',\n extensionRendered: \'txt\',\n extensions: [ \'txt\', \'coffee\' ],\n filename: \'attributes-nolayout.txt.coffee\',\n filenameRendered: \'attributes-nolayout.txt\',\n header: \'title: \\\'Attributes No Layout\\\'\\ntags: [\\\'attributes\\\',\\\'with-layout\\\']\\n\',\n id: \'attributes-nolayout.txt.coffee\',\n isDocument: true,\n meta: \n { title: \'Attributes No Layout\',\n tags: [ \'attributes\', \'with-layout\' ] },\n name: \'attributes-nolayout.txt\',\n parser: \'yaml\',\n referencesOthers: false,\n relativeBase: \'attributes-nolayout\',\n relativeDirPath: \'\',\n relativeOutDirPath: \'\',\n relativeOutPath: \'attributes-nolayout.txt\',\n relativePath: \'attributes-nolayout.txt.coffee\',\n render: true,\n renderSingleExtensions: false,\n rendered: false,\n slug: \'attributes-nolayout\',\n tags: [ \'attributes\', \'with-layout\' ],\n title: \'Attributes No Layout\',\n url: \'/attributes-nolayout.txt\',\n urls: [ \'/attributes-nolayout.txt\' ],\n write: true }',
contentType: 'application/octet-stream',
contentTypeRendered: 'text/plain',
dynamic: false,
@@ -23,6 +23,8 @@
referencesOthers: false,
relativeBase: 'attributes-nolayout',
relativeDirPath: '',
+ relativeOutDirPath: '',
+ relativeOutPath: 'attributes-nolayout.txt',
relativePath: 'attributes-nolayout.txt.coffee',
render: true,
renderSingleExtensions: false,
Oops, something went wrong.

0 comments on commit fb9b88b

Please sign in to comment.