Comparing version 0.3.78 to 0.3.79
{ | ||
"name": "assemble", | ||
"description": "Get the rocks out of your socks. Assemble helps you quickly launch static web projects by emphasizing a strong separation of concerns between structure, style, content and configuration.", | ||
"version": "0.3.78", | ||
"version": "0.3.79", | ||
"repo": "assemble/assemble", | ||
@@ -6,0 +6,0 @@ "main": [ |
@@ -48,3 +48,2 @@ /* | ||
options: { | ||
flatten: true, | ||
@@ -80,3 +79,37 @@ assets: 'test/actual/assets' | ||
} | ||
}, | ||
markdown: { | ||
options: { | ||
layout: 'test/layouts/default.md.hbs', | ||
ext: '.md' | ||
}, | ||
files: {'test/actual/multi/dest1/': ['test/files/**/*.hbs', '!test/files/layout*.*']} | ||
}, | ||
assets_one: { | ||
options: { | ||
assets: 'test/actual/public', | ||
assets_one: true | ||
}, | ||
files: {'test/actual/assets-public-folder.html': ['test/files/assets.hbs']} | ||
}, | ||
assets_two: { | ||
options: { | ||
assets: 'test/actual', | ||
assets_two: true | ||
}, | ||
files: {'test/actual/assets-same-folder.html': ['test/files/assets.hbs']} | ||
}, | ||
assets_three: { | ||
options: { | ||
assets: '.', | ||
assets_three: true | ||
}, | ||
files: {'test/actual/assets-root.html': ['test/files/assets.hbs']} | ||
} | ||
}, | ||
// Before assembling new files, removed previously | ||
// created files. | ||
clean: { | ||
tests: ['test/actual/**/*.{html,md}'] | ||
} | ||
@@ -86,2 +119,3 @@ }); | ||
// Load npm plugins to provide necessary tasks. | ||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
@@ -94,6 +128,6 @@ grunt.loadNpmTasks('grunt-mocha-test'); | ||
// Default task. | ||
grunt.registerTask('default', ['jshint', 'assemble']); | ||
grunt.registerTask('default', ['jshint', 'clean', 'assemble:compact']); | ||
// Tests to be run. | ||
grunt.registerTask('test', ['jshint', 'mochaTest']); | ||
grunt.registerTask('test', ['default', 'mochaTest']); | ||
}; |
@@ -27,3 +27,3 @@ /* | ||
data: [], | ||
assets: 'dist/assets', | ||
assets: '', | ||
ext: '.html' | ||
@@ -30,0 +30,0 @@ }); |
{ | ||
"name": "assemble", | ||
"description": "Assemble makes it dead simple to build modular sites and components from reusable templates and data.", | ||
"version": "0.3.78", | ||
"version": "0.3.79", | ||
"homepage": "https://github.com/assemble/assemble", | ||
@@ -52,3 +52,4 @@ "author": { | ||
"grunt-contrib-jshint": "~0.1.0", | ||
"grunt-mocha-test": "~0.2.0" | ||
"grunt-mocha-test": "~0.2.0", | ||
"grunt-contrib-clean": "~0.4.1" | ||
}, | ||
@@ -55,0 +56,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
# [Assemble v0.3.78](http://github.com/assemble/assemble) [![Build Status](https://travis-ci.org/assemble/assemble.png)](https://travis-ci.org/assemble/assemble) | ||
# [Assemble v0.3.79](http://github.com/assemble/assemble) [![Build Status](https://travis-ci.org/assemble/assemble.png)](https://travis-ci.org/assemble/assemble) | ||
@@ -552,3 +552,3 @@ > Assemble makes it dead simple to build modular sites and components from reusable templates and data. | ||
_This file was generated using Grunt and [assemble](http://github.com/assemble/assemble) on Wed May 22 2013 16:44:26._ | ||
_This file was generated using Grunt and [assemble](http://github.com/assemble/assemble) on Sun May 26 2013 12:20:23._ | ||
@@ -555,0 +555,0 @@ |
@@ -89,3 +89,3 @@ /* | ||
var assembleDefaultLayout = function(assemble, next) { | ||
grunt.verbose.writeln('assembleing default layout'); | ||
grunt.verbose.writeln('assembling default layout'); | ||
grunt.log.writeln('assembling' + ' default layout'.cyan); | ||
@@ -134,3 +134,3 @@ | ||
var partial = fs.readFileSync(filepath, 'utf8'); | ||
var partial = grunt.file.read(filepath); | ||
@@ -237,12 +237,9 @@ // If options.removeHbsWhitespace is true | ||
srcFile = path.normalize(srcFile); | ||
srcFile = urlNormalize(path.normalize(srcFile)); | ||
filename = path.basename(srcFile, path.extname(srcFile)); | ||
if(detectDestType(filePair.dest) === 'directory') { | ||
destFile = (isExpandedPair) ? | ||
filePair.dest : | ||
path.join(filePair.dest, | ||
(assemble.options.flatten ? | ||
path.basename(srcFile) : | ||
srcFile)); | ||
destFile = (isExpandedPair) ? filePair.dest : path.join( | ||
filePair.dest, (assemble.options.flatten ? path.basename(srcFile) : srcFile) | ||
); | ||
} else { | ||
@@ -252,5 +249,3 @@ destFile = filePair.dest; | ||
destFile = path.join(path.dirname(destFile), | ||
path.basename(destFile, path.extname(destFile)) | ||
) + assemble.options.ext; | ||
destFile = urlNormalize(path.join(path.dirname(destFile), path.basename(destFile, path.extname(destFile)))) + assemble.options.ext; | ||
@@ -266,7 +261,11 @@ grunt.verbose.writeln('Reading ' + filename.magenta); | ||
assemble.options.assets = urlNormalize( | ||
path.relative( | ||
path.resolve(path.dirname(destFile)), | ||
path.resolve(assetsPath) | ||
)); | ||
path.relative(path.resolve(path.dirname(destFile)), path.resolve(assetsPath)) | ||
); | ||
// if the assets relative path is blank, then it's the same folder | ||
// so update to be '' | ||
if(!assemble.options.assets || assemble.options.assets.length === 0) { | ||
assemble.options.assets = ''; | ||
} | ||
grunt.verbose.writeln(('\t' + 'Src: ' + srcFile)); | ||
@@ -276,3 +275,3 @@ grunt.verbose.writeln(('\t' + 'Dest: ' + destFile)); | ||
var page = fs.readFileSync(srcFile, 'utf8'); | ||
var page = grunt.file.read(srcFile); | ||
try { | ||
@@ -298,4 +297,7 @@ grunt.verbose.writeln('compiling page ' + filename.magenta); | ||
var pageObj = { | ||
filename: filename, | ||
basename: filename, | ||
dirname : path.dirname(destFile), | ||
filename: path.basename(destFile), | ||
pageName: path.basename(destFile), | ||
pagename: path.basename(destFile), | ||
basename: path.basename(filename), | ||
src: srcFile, | ||
@@ -305,2 +307,3 @@ dest: destFile, | ||
ext: assemble.options.ext, | ||
extname: assemble.options.ext, | ||
page: page, | ||
@@ -370,2 +373,4 @@ data: pageContext | ||
grunt.verbose.writeflags(assemble.options, 'Assemble options'); | ||
// assemble everything | ||
@@ -387,2 +392,3 @@ var assembler = assemble.init(this) | ||
}); | ||
@@ -515,7 +521,10 @@ | ||
// add other page variables to the main context | ||
context.extname = currentPage.ext; | ||
context.basename = currentPage.basename; | ||
context.absolute = currentPage.dest; | ||
context.dirname = path.dirname(currentPage.dest); | ||
context.pagename = currentPage.filename; | ||
context.filename = currentPage.filename; | ||
// "pageName" is deprecated, use "pagename" or "filename" | ||
context.pageName = currentPage.filename; | ||
context.filename = currentPage.dest; | ||
context.extname = currentPage.ext; | ||
context.basename = currentPage.basename; | ||
context.dirname = path.dirname(currentPage.dest); | ||
@@ -576,3 +585,3 @@ assemble.options.registerPartial(assemble.engine, 'body', page); | ||
layoutName = _.first(layout.match(assemble.filenameRegex)).replace(assemble.fileExtRegex,''); | ||
layout = fs.readFileSync(layout, 'utf8'); | ||
layout = grunt.file.read(layout); | ||
} | ||
@@ -635,4 +644,10 @@ | ||
// Windows? (from grunt.file) | ||
var win32 = process.platform === 'win32'; | ||
var urlNormalize = function(urlString) { | ||
if (win32) { | ||
return urlString.replace(/\\/g, '/'); | ||
} else { | ||
return urlString; | ||
} | ||
}; | ||
@@ -639,0 +654,0 @@ |
@@ -1,11 +0,59 @@ | ||
/*global require:true */ | ||
var assemble = require('../lib/assemble.js'), | ||
expect = require('chai').expect; | ||
describe("awesome", function() { | ||
var grunt = require('grunt'); | ||
it('should run an awesome test', function() { | ||
expect(1).to.equal(1); | ||
}); | ||
exports['config'] = { | ||
setUp: function(done) { | ||
this.origData = grunt.config.data; | ||
grunt.config.init({ | ||
meta: grunt.file.readJSON('test/fixtures/test.json'), | ||
foo: '<%= meta.foo %>', | ||
foo2: '<%= foo %>', | ||
obj: { | ||
foo: '<%= meta.foo %>', | ||
foo2: '<%= obj.foo %>', | ||
Arr: ['foo', '<%= obj.foo2 %>'], | ||
arr2: ['<%= arr %>', '<%= obj.Arr %>'] | ||
}, | ||
bar: 'bar', | ||
arr: ['foo', '<%= obj.foo2 %>'], | ||
arr2: ['<%= arr %>', '<%= obj.Arr %>'], | ||
}); | ||
assemble: { | ||
options: { | ||
assets: '<%= foo %>' | ||
}, | ||
one: { | ||
options: { | ||
partials: 'test/files/partials/*.hbs', | ||
layout: 'test/files/layout.hbs' | ||
}, | ||
src: ['test/files/dates.hbs', 'test/files/page.hbs'], | ||
dest: 'test/actual/' | ||
} | ||
} | ||
}); | ||
done(); | ||
}, | ||
tearDown: function(done) { | ||
grunt.config.data = this.origData; | ||
done(); | ||
}, | ||
'config.set': function(test) { | ||
test.expect(9); | ||
test.equal(grunt.config.set('foo3', '<%= foo2 %>'), '<%= foo2 %>', 'Should set values.'); | ||
test.equal(grunt.config.getRaw('foo3'), '<%= foo2 %>', 'Should have set the value.'); | ||
test.equal(grunt.config.data.foo3, '<%= foo2 %>', 'Should have set the value.'); | ||
test.equal(grunt.config.set('a.b.c', '<%= foo2 %>'), '<%= foo2 %>', 'Should create interim objects.'); | ||
test.equal(grunt.config.getRaw('a.b.c'), '<%= foo2 %>', 'Should have set the value.'); | ||
test.equal(grunt.config.data.a.b.c, '<%= foo2 %>', 'Should have set the value.'); | ||
test.equal(grunt.config.set('x.y.z', '<%= assemble.options.assets %>'), '<%= assemble.options.assets %>', 'Should set values.'); | ||
test.equal(grunt.config.getRaw('x.y.z'), '<%= assemble.options.assets %>', 'Should have set the value.'); | ||
test.equal(grunt.config.data.x.y.z, '<%= assemble.options.assets %>', 'Should have set the value.'); | ||
test.done(); | ||
} | ||
}; | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1215386
134
1271
5