From a601b24a7320d2348f6b34693c4918dc08875737 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Sat, 29 Mar 2014 13:27:12 -0500 Subject: [PATCH 1/7] Update travis exec for S3 push --- .travis.yml | 27 +++++++++++---------------- Gruntfile.js | 3 +-- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 902b7412c..5547d3e39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,30 +1,25 @@ language: node_js node_js: - - "0.8" - +- '0.8' before_install: - - npm install -g grunt-cli - +- npm install -g grunt-cli script: - - grunt --stack travis - +- grunt --stack travis email: on_failure: change on_success: never env: global: - S3_BUCKET_NAME=builds.handlebarsjs.com - - secure: PJaukuvkBBsSDOqbIcNSSMgb96VVEaIt/eq9GPjXPeFbSd3hXgwhwVE62LrqtJO8BaUfX+PzpiQjEl4D5/KBmvlFZ057Hqmy0zmPOT5mDZfJe8Ja5zyvTMb+KkCWN/tjAp8kawHojE04pn6jIpPdwXFnAYwPhaHbATFrmdt9fdg= - - secure: mBcGL2tnmiRujJdV/4fxrVd8E8wn6AW9IQKVcMv8tvOc7i5dOzZ39rpBKLuTMRXDtMV1LyLiuKYb1pHj1IyeadEahcLYFfGygF4LG7Yzp4NWHtRzQ7Q8LXaJV7dXDboYCFkn2a8/Rtx1YSVh/sCONf5UoRC+MUIqrj4UiHN9r3s= - + - secure: ckyEe5dzjdFDjmZ6wIrhGm0CFBEnKq8c1dYptfgVV/Q5/nJFGzu8T0yTjouS/ERxzdT2H327/63VCxhFnLCRHrsh4rlW/rCy4XI3O/0TeMLgFPa4TXkO8359qZ4CB44TBb3NsJyQXNMYdJpPLTCVTMpuiqqkFFOr+6OeggR7ufA= + - secure: Nm4AgSfsgNB21kgKrF9Tl7qVZU8YYREhouQunFracTcZZh2NZ2XH5aHuSiXCj88B13Cr/jGbJKsZ4T3QS3wWYtz6lkyVOx3H3iI+TMtqhD9RM3a7A4O+4vVN8IioB2YjhEu0OKjwgX5gp+0uF+pLEi7Hpj6fupD3AbbL5uYcKg8= matrix: include: - - node_js: "0.10" - env: - - PUBLISH=true - - secure: pLTzghtVll9yGKJI0AaB0uI8GypfWxLTaIB0ZL8//yN3nAEIKMhf/RRilYTsn/rKj2NUa7vt2edYILi3lttOUlCBOwTc9amiRms1W8Lwr/3IdWPeBLvLuH1zNJRm2lBAwU4LBSqaOwhGaxOQr6KHTnWudhNhgOucxpZfvfI/dFw= - - secure: yERYCf7AwL11D9uMtacly/THGV8BlzsMmrt+iQVvGA3GaY6QMmfYqf6P6cCH98sH5etd1Y+1e6YrPeMjqI6lyRllT7FptoyOdHulazQe86VQN4sc0EpqMlH088kB7gGjTut9Z+X9ViooT5XEh9WA5jXEI9pXhQJNoIHkWPuwGuY= - + - node_js: '0.10' + env: + - PUBLISH=true + - secure: pLTzghtVll9yGKJI0AaB0uI8GypfWxLTaIB0ZL8//yN3nAEIKMhf/RRilYTsn/rKj2NUa7vt2edYILi3lttOUlCBOwTc9amiRms1W8Lwr/3IdWPeBLvLuH1zNJRm2lBAwU4LBSqaOwhGaxOQr6KHTnWudhNhgOucxpZfvfI/dFw= + - secure: yERYCf7AwL11D9uMtacly/THGV8BlzsMmrt+iQVvGA3GaY6QMmfYqf6P6cCH98sH5etd1Y+1e6YrPeMjqI6lyRllT7FptoyOdHulazQe86VQN4sc0EpqMlH088kB7gGjTut9Z+X9ViooT5XEh9WA5jXEI9pXhQJNoIHkWPuwGuY= cache: directories: - - node_modules + - node_modules diff --git a/Gruntfile.js b/Gruntfile.js index 2f8816de3..4e12ef734 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -193,8 +193,7 @@ module.exports = function(grunt) { grunt.registerTask('bench', ['metrics']); grunt.registerTask('sauce', process.env.SAUCE_USERNAME ? ['tests', 'connect', 'saucelabs-mocha'] : []); - // Disbaled until AWS certs are fixed: 'publish:latest' - grunt.registerTask('travis', process.env.PUBLISH ? ['default', 'sauce', 'metrics'] : ['default']); + grunt.registerTask('travis', process.env.PUBLISH ? ['default', 'sauce', 'metrics', 'publish:latest'] : ['default']); grunt.registerTask('dev', ['clean', 'connect', 'watch']); grunt.registerTask('default', ['clean', 'build', 'test', 'release']); From 085e5e1937b442a4d4add5525db2627e825538aa Mon Sep 17 00:00:00 2001 From: kpdecker Date: Sun, 13 Apr 2014 07:21:08 -0500 Subject: [PATCH 2/7] Refactor template init logic --- lib/handlebars/runtime.js | 40 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index b179620c9..d43f465e3 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -70,13 +70,6 @@ export function template(templateSpec, env) { }, programWithDepth: env.VM.programWithDepth, - initData: function(context, data) { - if (!data || !('root' in data)) { - data = data ? createFrame(data) : {}; - data.root = context; - } - return data; - }, data: function(data, depth) { while (data && depth--) { data = data._parent; @@ -99,28 +92,31 @@ export function template(templateSpec, env) { var ret = function(context, options) { options = options || {}; - var namespace = options.partial ? options : env, - helpers, + var helpers, partials, data = options.data; + ret._setup(options); + if (!options.partial && templateSpec.useData) { + data = initData(context, data); + } + return templateSpec.main.call(container, context, container.helpers, container.partials, data); + }; + + ret._setup = function(options) { if (!options.partial) { - helpers = container.helpers = container.merge(options.helpers, namespace.helpers); + container.helpers = container.merge(options.helpers, env.helpers); if (templateSpec.usePartial) { - partials = container.partials = container.merge(options.partials, namespace.partials); - } - if (templateSpec.useData) { - data = container.initData(context, data); + container.partials = container.merge(options.partials, env.partials); } } else { - helpers = container.helpers = options.helpers; - partials = container.partials = options.partials; + container.helpers = options.helpers; + container.partials = options.partials; } - return templateSpec.main.call(container, context, helpers, partials, data); }; - ret.child = function(i) { + ret._child = function(i) { return container.programWithDepth(i); }; return ret; @@ -164,3 +160,11 @@ export function invokePartial(partial, name, context, helpers, partials, data) { } export function noop() { return ""; } + +function initData(context, data) { + if (!data || !('root' in data)) { + data = data ? createFrame(data) : {}; + data.root = context; + } + return data; +} From 356ea1a9093f0ab418a383f366e27bb0ad055db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mu=C3=B1oz?= Date: Mon, 5 May 2014 01:51:29 -0400 Subject: [PATCH 3/7] Ensure isHelper is coerced to a boolean --- lib/handlebars/compiler/ast.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index 286917dbe..e388e54e1 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -86,7 +86,7 @@ var AST = { // a mustache is definitely a helper if: // * it is an eligible helper, and // * it has at least one parameter or hash segment - this.isHelper = params.length || hash; + this.isHelper = !!(params.length || hash); // a mustache is an eligible helper if: // * its id is simple (a single part, not `this` or `..`) From 72c12623945aa85798a50375330b3ad8e851c600 Mon Sep 17 00:00:00 2001 From: Tom Dale Date: Tue, 13 May 2014 13:24:25 +0100 Subject: [PATCH 4/7] Pass full id to helperMissing --- lib/handlebars/compiler/compiler.js | 2 +- spec/helpers.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index c702d00bf..db0f39cd8 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -276,7 +276,7 @@ Compiler.prototype = { throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr); } else { this.ID(id); - this.opcode('invokeHelper', params.length, name, sexpr.isRoot); + this.opcode('invokeHelper', params.length, id.original, sexpr.isRoot); } }, diff --git a/spec/helpers.js b/spec/helpers.js index ccde982ba..6ba368e4d 100644 --- a/spec/helpers.js +++ b/spec/helpers.js @@ -291,6 +291,7 @@ describe('helpers', function() { shouldCompileTo(string, [hash, helpers], "Message: Goodbye cruel world", "block helpers with multiple params"); }); }); + describe('hash', function() { it("helpers can take an optional hash", function() { var template = CompilerContext.compile('{{goodbye cruel="CRUEL" world="WORLD" times=12}}'); @@ -473,6 +474,9 @@ describe('helpers', function() { blockHelperMissing: function() { return 'missing: ' + arguments[arguments.length-1].name; }, + helperMissing: function() { + return 'helper missing: ' + arguments[arguments.length-1].name; + }, helper: function() { return 'ran: ' + arguments[arguments.length-1].name; } @@ -502,6 +506,10 @@ describe('helpers', function() { it('should include full id', function() { shouldCompileTo('{{#foo.helper}}{{/foo.helper}}', [{foo: {}}, helpers], 'missing: foo.helper'); }); + + it('should include full id if a hash is passed', function() { + shouldCompileTo('{{#foo.helper bar=baz}}{{/foo.helper}}', [{foo: {}}, helpers], 'helper missing: foo.helper'); + }); }); describe('name conflicts', function() { From 3dcc49927b0fb72a7fe6811d753fe18cb14e1895 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Mon, 19 May 2014 22:02:27 -0500 Subject: [PATCH 5/7] Drop travis 0.8 build support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The date-now dependency has dropped support and that version is sufficiently old that we shouldn’t have any issues not testing against it anymore. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5547d3e39..ecbc1a435 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,4 @@ language: node_js -node_js: -- '0.8' before_install: - npm install -g grunt-cli script: From 8ee73b9d135175d445c93d9bef75c323666d15cf Mon Sep 17 00:00:00 2001 From: kpdecker Date: Mon, 19 May 2014 22:29:08 -0500 Subject: [PATCH 6/7] Update release notes --- release-notes.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index 407f7eb25..dc8da36f0 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,14 @@ ## Development -[Commits](https://github.com/wycats/handlebars.js/compare/v2.0.0-alpha.2...master) +[Commits](https://github.com/wycats/handlebars.js/compare/v2.0.0-alpha.3...master) + +## v2.0.0-alpha.3 - May 19th, 2014 +- [#797](https://github.com/wycats/handlebars.js/pull/797) - Pass full helper ID to helperMissing when options are provided ([@tomdale](https://api.github.com/users/tomdale)) +- [#793](https://github.com/wycats/handlebars.js/pull/793) - Ensure isHelper is coerced to a boolean ([@mmun](https://api.github.com/users/mmun)) +- Refactor template init logic - 085e5e1 + +[Commits](https://github.com/wycats/handlebars.js/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) ## v2.0.0-alpha.2 - March 6th, 2014 - [#756](https://github.com/wycats/handlebars.js/pull/756) - fix bug in IE<=8 (no Array::map), closes #751 ([@jenseng](https://api.github.com/users/jenseng)) From f419838362ad6f3a6f10179bcd7ca683d527e030 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Mon, 19 May 2014 22:29:25 -0500 Subject: [PATCH 7/7] v2.0.0-alpha.3 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/bower.json b/components/bower.json index 57840df59..176190e83 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.3", "main": "handlebars.js", "dependencies": {} } diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index f953cfb94..1c255e78a 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 2.0.0-alpha.2 + 2.0.0-alpha.3 handlebars.js Authors https://github.com/wycats/handlebars.js/blob/master/LICENSE https://github.com/wycats/handlebars.js/ diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 3665b5b83..f34ab3fd9 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -1,7 +1,7 @@ module Utils from "./utils"; import Exception from "./exception"; -export var VERSION = "2.0.0-alpha.2"; +export var VERSION = "2.0.0-alpha.3"; export var COMPILER_REVISION = 5; export var REVISION_CHANGES = { diff --git a/package.json b/package.json index 67c3bc826..c08f314f0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.3", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [