diff --git a/package.json b/package.json index ee5ce9b881e..26f58794985 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,11 @@ "ember-cli": "0.1.15", "ember-cli-yuidoc": "^0.4.0", "ember-publisher": "0.0.7", - "emberjs-build": "0.0.30", + "emberjs-build": "0.0.31", "express": "^4.5.0", "github": "^0.2.3", "glob": "~4.3.2", - "htmlbars": "0.11.0", + "htmlbars": "0.11.1", "qunit-extras": "^1.3.0", "qunitjs": "^1.16.0", "route-recognizer": "0.1.5", diff --git a/packages/ember-htmlbars/lib/system/render-view.js b/packages/ember-htmlbars/lib/system/render-view.js index e03f64518d6..1c100bff8a5 100644 --- a/packages/ember-htmlbars/lib/system/render-view.js +++ b/packages/ember-htmlbars/lib/system/render-view.js @@ -23,6 +23,12 @@ export default function renderView(view, buffer, template) { } function renderHTMLBarsTemplate(view, buffer, template) { + Ember.assert( + 'The template being rendered by `' + view + '` was compiled with `' + template.revision + + '` which does not match `Ember@VERSION_STRING_PLACEHOLDER` (this revision).', + template.revision === 'Ember@VERSION_STRING_PLACEHOLDER' + ); + var contextualElement = buffer.innerContextualElement(); var args = view._blockArguments; var env = { diff --git a/packages/ember-htmlbars/tests/system/render_view_test.js b/packages/ember-htmlbars/tests/system/render_view_test.js index b6c9bdf9239..ac3aa88f831 100644 --- a/packages/ember-htmlbars/tests/system/render_view_test.js +++ b/packages/ember-htmlbars/tests/system/render_view_test.js @@ -17,6 +17,7 @@ QUnit.test('default environment values are passed through', function() { view = EmberView.create({ template: { isHTMLBars: true, + revision: 'Ember@VERSION_STRING_PLACEHOLDER', render: function(view, env, contextualElement, blockArguments) { for (var i = 0, l = keyNames.length; i < l; i++) { var keyName = keyNames[i]; @@ -29,3 +30,18 @@ QUnit.test('default environment values are passed through', function() { runAppend(view); }); + +QUnit.test('Provides a helpful assertion if revisions do not match.', function() { + view = EmberView.create({ + template: { + isHTMLBars: true, + revision: 'Foo-Bar-Baz', + render: function() { } + } + }); + + expectAssertion(function() { + runAppend(view); + }, + /was compiled with `Foo-Bar-Baz`/); +}); diff --git a/packages/ember-routing-htmlbars/lib/helpers/link-to.js b/packages/ember-routing-htmlbars/lib/helpers/link-to.js index 5d898bd7b6e..dbe1bff51bf 100644 --- a/packages/ember-routing-htmlbars/lib/helpers/link-to.js +++ b/packages/ember-routing-htmlbars/lib/helpers/link-to.js @@ -310,6 +310,7 @@ function linkToHelper(params, hash, options, env) { options.template = { isHTMLBars: true, + revision: 'Ember@VERSION_STRING_PLACEHOLDER', render: function(view, env) { var value = read(linkTitle) || ""; if (parseTextAsHTML) { diff --git a/packages/ember-template-compiler/lib/compat/precompile.js b/packages/ember-template-compiler/lib/compat/precompile.js index daf128a3259..715e5e16af0 100644 --- a/packages/ember-template-compiler/lib/compat/precompile.js +++ b/packages/ember-template-compiler/lib/compat/precompile.js @@ -2,6 +2,7 @@ @module ember @submodule ember-template-compiler */ +import compileOptions from "ember-template-compiler/system/compile_options"; var compile, compileSpec; @@ -20,5 +21,5 @@ export default function(string) { var asObject = arguments[1] === undefined ? true : arguments[1]; var compileFunc = asObject ? compile : compileSpec; - return compileFunc(string); + return compileFunc(string, compileOptions()); } diff --git a/packages/ember-template-compiler/lib/system/compile_options.js b/packages/ember-template-compiler/lib/system/compile_options.js index 00f9bace920..36ae9ac6f02 100644 --- a/packages/ember-template-compiler/lib/system/compile_options.js +++ b/packages/ember-template-compiler/lib/system/compile_options.js @@ -17,6 +17,8 @@ export default function() { } return { + revision: 'Ember@VERSION_STRING_PLACEHOLDER', + disableComponentGeneration: disableComponentGeneration, plugins: plugins diff --git a/packages/ember-template-compiler/tests/system/compile_test.js b/packages/ember-template-compiler/tests/system/compile_test.js index 053f22ce8e4..91a9f24bc31 100644 --- a/packages/ember-template-compiler/tests/system/compile_test.js +++ b/packages/ember-template-compiler/tests/system/compile_test.js @@ -26,5 +26,22 @@ QUnit.test('calls template on the compiled function', function() { ok(actual.isMethod === false, 'sets isMethod via template function'); }); +QUnit.test('includes the current revision in the compiled template', function() { + var templateString = "{{foo}} -- {{some-bar blah='foo'}}"; + + var actual = compile(templateString); + + equal(actual.revision, 'Ember@VERSION_STRING_PLACEHOLDER', 'revision is included in generated template'); +}); + +QUnit.test('the template revision is different than the HTMLBars default revision', function() { + var templateString = "{{foo}} -- {{some-bar blah='foo'}}"; + + var actual = compile(templateString); + var expected = htmlbarsCompile(templateString); + + ok(actual.revision !== expected.revision, 'revision differs from default'); +}); + // jscs:enable validateIndentation } diff --git a/packages/ember-views/lib/views/select.js b/packages/ember-views/lib/views/select.js index 5878628ce94..721da86c122 100644 --- a/packages/ember-views/lib/views/select.js +++ b/packages/ember-views/lib/views/select.js @@ -29,6 +29,7 @@ var defaultTemplate = htmlbarsTemplate; var selectOptionDefaultTemplate = { isHTMLBars: true, + revision: 'Ember@VERSION_STRING_PLACEHOLDER', render: function(context, env, contextualElement) { var lazyValue = context.getStream('view.label');