From 75a1fce5483dfab12fccc61f64ea786f2d868bd0 Mon Sep 17 00:00:00 2001 From: Emily Stark Date: Wed, 17 Sep 2014 23:48:39 -0400 Subject: [PATCH 01/82] Add forgotten history entry for 0.9.2.2 --- History.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/History.md b/History.md index aa6e7da957..99ea17ad3f 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,14 @@ ## v.NEXT +## v0.9.2.2 + +* Fix regression in 0.9.2 that prevented some users from accessing the + Meteor development server in their browser. Specifically, 0.9.2 + unintentionally changed the development mode server's default bind + host to localhost instead of 0.0.0.0. #2596 + + ## v0.9.2.1 * Fix versions of packages that were published with `-cordova` versions From 220cc69e316da39f3693ad7dbca44a5ad2651e86 Mon Sep 17 00:00:00 2001 From: ekatek Date: Fri, 19 Sep 2014 21:16:14 -0700 Subject: [PATCH 02/82] package versions incremented --- packages/accounts-base/package.js | 2 +- packages/accounts-facebook/package.js | 2 +- packages/accounts-github/package.js | 2 +- packages/accounts-google/package.js | 2 +- packages/accounts-meetup/package.js | 2 +- packages/accounts-meteor-developer/package.js | 2 +- packages/accounts-oauth/package.js | 2 +- packages/accounts-password/package.js | 2 +- packages/accounts-twitter/package.js | 2 +- packages/accounts-ui-unstyled/package.js | 2 +- packages/accounts-ui/package.js | 2 +- packages/accounts-weibo/package.js | 2 +- packages/autoupdate/package.js | 2 +- packages/blaze/package.js | 2 +- packages/browser-policy-content/package.js | 2 +- packages/browser-policy-framing/package.js | 2 +- packages/browser-policy/package.js | 2 +- packages/check/package.js | 2 +- packages/constraint-solver/package.js | 2 +- packages/ddp/package.js | 2 +- packages/deps/package.js | 2 +- packages/ejson/package.js | 2 +- packages/email/package.js | 2 +- packages/html-tools/package.js | 2 +- packages/http/package.js | 2 +- packages/less/package.js | 2 +- packages/livedata/package.js | 2 +- packages/meteor-platform/package.js | 2 +- packages/meteor-tool/package.js | 2 +- packages/meteor/package.js | 2 +- packages/mongo-livedata/package.js | 2 +- packages/mongo/package.js | 2 +- packages/package-version-parser/package.js | 2 +- packages/reactive-dict/package.js | 2 +- packages/reactive-var/package.js | 2 +- packages/session/package.js | 2 +- packages/spacebars/package.js | 2 +- packages/standard-app-packages/package.js | 2 +- packages/star-translate/package.js | 2 +- packages/templating/package.js | 2 +- packages/test-in-console/package.js | 2 +- packages/tinytest/package.js | 2 +- packages/ui/package.js | 2 +- packages/webapp/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 4 ++-- 45 files changed, 46 insertions(+), 46 deletions(-) diff --git a/packages/accounts-base/package.js b/packages/accounts-base/package.js index 2602a28200..03dd4d612e 100644 --- a/packages/accounts-base/package.js +++ b/packages/accounts-base/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "A user account system", - version: "1.1.0" + version: "1.1.1-rc0" }); Package.on_use(function (api) { diff --git a/packages/accounts-facebook/package.js b/packages/accounts-facebook/package.js index 13c3b87023..7b8b87b0ea 100644 --- a/packages/accounts-facebook/package.js +++ b/packages/accounts-facebook/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Facebook accounts", - version: "1.0.0" + version: "1.0.1-rc0" }); Package.on_use(function(api) { diff --git a/packages/accounts-github/package.js b/packages/accounts-github/package.js index 175e254abe..4a793baae4 100644 --- a/packages/accounts-github/package.js +++ b/packages/accounts-github/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Github accounts", - version: "1.0.0" + version: "1.0.1-rc0" }); Package.on_use(function(api) { diff --git a/packages/accounts-google/package.js b/packages/accounts-google/package.js index 7da709aaa8..c5c7b09bd8 100644 --- a/packages/accounts-google/package.js +++ b/packages/accounts-google/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Google accounts", - version: "1.0.0" + version: "1.0.1-rc0" }); Package.on_use(function(api) { diff --git a/packages/accounts-meetup/package.js b/packages/accounts-meetup/package.js index 989d8ac2f4..260c4e9610 100644 --- a/packages/accounts-meetup/package.js +++ b/packages/accounts-meetup/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Meetup accounts", - version: "1.0.0" + version: "1.0.1--rc0" }); Package.on_use(function(api) { diff --git a/packages/accounts-meteor-developer/package.js b/packages/accounts-meteor-developer/package.js index a07cb87fa7..79a8a173ab 100644 --- a/packages/accounts-meteor-developer/package.js +++ b/packages/accounts-meteor-developer/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Meteor developer accounts", - version: "1.0.0" + version: "1.0.1-rc0" }); Package.on_use(function (api) { diff --git a/packages/accounts-oauth/package.js b/packages/accounts-oauth/package.js index a25debaa33..fb8530d20e 100644 --- a/packages/accounts-oauth/package.js +++ b/packages/accounts-oauth/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Common code for OAuth-based login services", - version: "1.1.0" + version: "1.1.1-rc0" }); Package.on_use(function (api) { diff --git a/packages/accounts-password/package.js b/packages/accounts-password/package.js index e9932fadf6..847e8d7f31 100644 --- a/packages/accounts-password/package.js +++ b/packages/accounts-password/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Password support for accounts", - version: "1.0.1" + version: "1.0.2-rc0" }); Package.on_use(function(api) { diff --git a/packages/accounts-twitter/package.js b/packages/accounts-twitter/package.js index 3c4e9c2e67..514c87405f 100644 --- a/packages/accounts-twitter/package.js +++ b/packages/accounts-twitter/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Twitter accounts", - version: "1.0.0" + version: "1.0.0-rc0" }); Package.on_use(function(api) { diff --git a/packages/accounts-ui-unstyled/package.js b/packages/accounts-ui-unstyled/package.js index 7056431293..7cf0c08675 100644 --- a/packages/accounts-ui-unstyled/package.js +++ b/packages/accounts-ui-unstyled/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Unstyled version of login widgets", - version: "1.1.1" + version: "1.1.2-rc0" }); Package.on_use(function (api) { diff --git a/packages/accounts-ui/package.js b/packages/accounts-ui/package.js index 8282d3c546..93b36c9a66 100644 --- a/packages/accounts-ui/package.js +++ b/packages/accounts-ui/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Simple templates to add login widgets to an app", - version: "1.1.0" + version: "1.1.1-rc0" }); Package.on_use(function (api) { diff --git a/packages/accounts-weibo/package.js b/packages/accounts-weibo/package.js index cf15bb5ea1..72332311bc 100644 --- a/packages/accounts-weibo/package.js +++ b/packages/accounts-weibo/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Sina Weibo accounts", - version: "1.0.0" + version: "1.0.1-rc0" }); Package.on_use(function(api) { diff --git a/packages/autoupdate/package.js b/packages/autoupdate/package.js index f4018e40c4..4a1ff03643 100644 --- a/packages/autoupdate/package.js +++ b/packages/autoupdate/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Update the client when new client code is available", - version: '1.1.0' + version: '1.1.1-rc0' }); Cordova.depends({ diff --git a/packages/blaze/package.js b/packages/blaze/package.js index 8616206463..a83d0b0022 100644 --- a/packages/blaze/package.js +++ b/packages/blaze/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Meteor Reactive Templating library", - version: '2.0.0' + version: '2.0.1-rc0' }); Package.on_use(function (api) { diff --git a/packages/browser-policy-content/package.js b/packages/browser-policy-content/package.js index be114f74c8..cd5aaad430 100644 --- a/packages/browser-policy-content/package.js +++ b/packages/browser-policy-content/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Configure content security policies", - version: "1.0.0" + version: "1.0.1-rc0" }); Package.on_use(function (api) { diff --git a/packages/browser-policy-framing/package.js b/packages/browser-policy-framing/package.js index f8e9845653..abd2ffcd9c 100644 --- a/packages/browser-policy-framing/package.js +++ b/packages/browser-policy-framing/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Restrict which websites can frame your app", - version: "1.0.0" + version: "1.0.1-rc0" }); Package.on_use(function (api) { diff --git a/packages/browser-policy/package.js b/packages/browser-policy/package.js index 12a0159f80..039f2cc7e5 100644 --- a/packages/browser-policy/package.js +++ b/packages/browser-policy/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Configure security policies enforced by the browser", - version: "1.0.0" + version: "1.0.1-rc0" }); Package.on_use(function (api) { diff --git a/packages/check/package.js b/packages/check/package.js index 8757efad45..7361eedefd 100644 --- a/packages/check/package.js +++ b/packages/check/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Check whether a value matches a pattern", - version: '1.0.0' + version: '1.0.1-rc0' }); Package.on_use(function (api) { diff --git a/packages/constraint-solver/package.js b/packages/constraint-solver/package.js index 7d4e9784a1..253deae5a5 100644 --- a/packages/constraint-solver/package.js +++ b/packages/constraint-solver/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Given the set of the constraints, picks a satisfying configuration", - version: "1.0.13" + version: "1.0.14-rc0" }); Npm.depends({ diff --git a/packages/ddp/package.js b/packages/ddp/package.js index 9654cd10df..15836810b9 100644 --- a/packages/ddp/package.js +++ b/packages/ddp/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Meteor's latency-compensated distributed data framework", - version: '1.0.8' + version: '1.0.9-rc0' }); // We use 'faye-websocket' for connections in server-to-server DDP, mostly diff --git a/packages/deps/package.js b/packages/deps/package.js index 123a0668bf..ce7ad143ce 100644 --- a/packages/deps/package.js +++ b/packages/deps/package.js @@ -2,7 +2,7 @@ Package.describe({ summary: "Deprecated: Use the 'tracker' package instead.", - version: '1.0.3' + version: '1.0.4-rc0' }); Package.on_use(function (api) { diff --git a/packages/ejson/package.js b/packages/ejson/package.js index 3237ffc4d0..cd9575613c 100644 --- a/packages/ejson/package.js +++ b/packages/ejson/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Extended and Extensible JSON library", - version: '1.0.2' + version: '1.0.3-rc0' }); Package.on_use(function (api) { diff --git a/packages/email/package.js b/packages/email/package.js index aa90a5b4d4..d0dacd683f 100644 --- a/packages/email/package.js +++ b/packages/email/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Send email messages", - version: "1.0.2" + version: "1.0.3-rc0" }); Npm.depends({ diff --git a/packages/html-tools/package.js b/packages/html-tools/package.js index 8b916e4e1d..0e521b0976 100644 --- a/packages/html-tools/package.js +++ b/packages/html-tools/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Standards-compliant HTML tools", - version: '1.0.0' + version: '1.0.1-rc0' }); Package.on_use(function (api) { diff --git a/packages/http/package.js b/packages/http/package.js index 141846e7a7..0a45ef09af 100644 --- a/packages/http/package.js +++ b/packages/http/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Make HTTP calls to remote servers", - version: '1.0.5' + version: '1.0.6-rc0' }); Npm.depends({request: "2.33.0"}); diff --git a/packages/less/package.js b/packages/less/package.js index 3d37bf5bf0..8e07e8caab 100644 --- a/packages/less/package.js +++ b/packages/less/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The dynamic stylesheet language", - version: "1.0.8" + version: "1.0.9-rc0" }); Package._transitional_registerBuildPlugin({ diff --git a/packages/livedata/package.js b/packages/livedata/package.js index 7372fda6d6..dc98d3e935 100644 --- a/packages/livedata/package.js +++ b/packages/livedata/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Moved to the 'ddp' package", - version: '1.0.9' + version: '1.0.10-rc0' }); Package.on_use(function (api) { diff --git a/packages/meteor-platform/package.js b/packages/meteor-platform/package.js index d1594b6d9c..a75d4124b5 100644 --- a/packages/meteor-platform/package.js +++ b/packages/meteor-platform/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Include a standard set of Meteor packages in your app", - version: '1.1.0' + version: '1.1.1-rc0' }); Package.on_use(function(api) { diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index 26f4e46de8..322a56dc62 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.0.31' + version: '1.0.31-rc0' }); Package.includeTool(); diff --git a/packages/meteor/package.js b/packages/meteor/package.js index da3339be2f..685d9b5f85 100644 --- a/packages/meteor/package.js +++ b/packages/meteor/package.js @@ -2,7 +2,7 @@ Package.describe({ summary: "Core Meteor environment", - version: '1.1.0' + version: '1.1.1-rc0' }); Package._transitional_registerBuildPlugin({ diff --git a/packages/mongo-livedata/package.js b/packages/mongo-livedata/package.js index c252a62f38..2e42aa2379 100644 --- a/packages/mongo-livedata/package.js +++ b/packages/mongo-livedata/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Moved to the 'mongo' package", - version: '1.0.4' + version: '1.0.5-rc0' }); Package.on_use(function (api) { diff --git a/packages/mongo/package.js b/packages/mongo/package.js index bc27b1fd4c..18ee0f9c98 100644 --- a/packages/mongo/package.js +++ b/packages/mongo/package.js @@ -9,7 +9,7 @@ Package.describe({ summary: "Adaptor for using MongoDB and Minimongo over DDP", - version: '1.0.5' + version: '1.0.6-rc0' }); Npm.depends({ diff --git a/packages/package-version-parser/package.js b/packages/package-version-parser/package.js index bcceef05a4..3d1a9607f9 100644 --- a/packages/package-version-parser/package.js +++ b/packages/package-version-parser/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Parses Meteor Smart Package version string", - version: "2.0.0" + version: "2.0.0-rc0" }); Npm.depends({ diff --git a/packages/reactive-dict/package.js b/packages/reactive-dict/package.js index 79fbf39310..524960c8f4 100644 --- a/packages/reactive-dict/package.js +++ b/packages/reactive-dict/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Reactive dictionary", - version: '1.0.2' + version: '1.0.3-rc0' }); Package.on_use(function (api) { diff --git a/packages/reactive-var/package.js b/packages/reactive-var/package.js index 56ffd2b7b7..2635768623 100644 --- a/packages/reactive-var/package.js +++ b/packages/reactive-var/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Reactive variable", - version: '1.0.1' + version: '1.0.2-rc0' }); Package.on_use(function (api) { diff --git a/packages/session/package.js b/packages/session/package.js index 87c4687bce..e8fd2b1dd4 100644 --- a/packages/session/package.js +++ b/packages/session/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Session variable", - version: '1.0.1' + version: '1.0.2-rc0' }); Package.on_use(function (api) { diff --git a/packages/spacebars/package.js b/packages/spacebars/package.js index f60e899c77..98b88c33f2 100644 --- a/packages/spacebars/package.js +++ b/packages/spacebars/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Handlebars-like template language for Meteor", - version: '1.0.1' + version: '1.0.2-rc0' }); // For more, see package `spacebars-compiler`, which is used by diff --git a/packages/standard-app-packages/package.js b/packages/standard-app-packages/package.js index 248fd35b13..31d973bc4f 100644 --- a/packages/standard-app-packages/package.js +++ b/packages/standard-app-packages/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Moved to meteor-platform", - version: '1.0.1' + version: '1.0.2-rc0' }); Package.on_use(function (api) { diff --git a/packages/star-translate/package.js b/packages/star-translate/package.js index 4cc0f1fcfb..78fffc5b2f 100644 --- a/packages/star-translate/package.js +++ b/packages/star-translate/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "A package for translating old bundles into stars", - version: "1.0.2" + version: "1.0.3-rc0" }); Package.on_use(function (api) { diff --git a/packages/templating/package.js b/packages/templating/package.js index 6b62acab2d..4c07dead4b 100644 --- a/packages/templating/package.js +++ b/packages/templating/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Allows templates to be defined in .html files", - version: '1.0.6' + version: '1.0.7-rc0' }); // Today, this package is closely intertwined with Handlebars, meaning diff --git a/packages/test-in-console/package.js b/packages/test-in-console/package.js index 3dc96446a2..3b0d410ae8 100644 --- a/packages/test-in-console/package.js +++ b/packages/test-in-console/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Run tests noninteractively, with results going to the console.", - version: '1.0.1' + version: '1.0.2-rc0' }); Package.on_use(function (api) { diff --git a/packages/tinytest/package.js b/packages/tinytest/package.js index 39fae35164..9b6b3fbc0e 100644 --- a/packages/tinytest/package.js +++ b/packages/tinytest/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Tiny testing framework", - version: '1.0.1' + version: '1.0.2-rc0' }); Package.on_use(function (api) { diff --git a/packages/ui/package.js b/packages/ui/package.js index 8258f64075..70f486d29d 100644 --- a/packages/ui/package.js +++ b/packages/ui/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Deprecated: Use the 'blaze' package", - version: '1.0.2' + version: '1.0.3-rc0' }); Package.on_use(function (api) { diff --git a/packages/webapp/package.js b/packages/webapp/package.js index 7fc44cdbf3..be131f2653 100644 --- a/packages/webapp/package.js +++ b/packages/webapp/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Serves a Meteor app over HTTP", - version: '1.1.1' + version: '1.1.2-rc0' }); Npm.depends({connect: "2.9.0", diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index e18d92cf22..9281b69e28 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,7 +1,7 @@ { "track": "METEOR", - "version": "0.9.2-rc8", + "version": "0.9.3-rc0", "recommended": false, "official": false, - "description": "A release candidate of Meteor 0.9.2." + "description": "A release candidate of Meteor 0.9.3." } From c8f4152f040aa35e42aef7ced6afdeef40cd1c7b Mon Sep 17 00:00:00 2001 From: ekatek Date: Fri, 19 Sep 2014 21:47:05 -0700 Subject: [PATCH 03/82] fix running from release to work --- tools/project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/project.js b/tools/project.js index 647075968a..f4e42252de 100644 --- a/tools/project.js +++ b/tools/project.js @@ -313,7 +313,7 @@ _.extend(Project.prototype, { // those. _.each(releasePackages, function(version, name) { allDeps.push({name: name, weak: true, - constraintStr: "=" + name, + constraintString: "=" + name, constraints: [ { version: version, type: 'exactly' } ]}); }); From 3ad9ab61e9fb2c2f33a4d72d707a6c8665cf8d0a Mon Sep 17 00:00:00 2001 From: ekatek Date: Fri, 19 Sep 2014 21:49:45 -0700 Subject: [PATCH 04/82] increment versions --- packages/meteor-tool/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index 322a56dc62..c66d2b1416 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.0.31-rc0' + version: '1.0.31-rc1' }); Package.includeTool(); diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index 9281b69e28..a27bea8580 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "0.9.3-rc0", + "version": "0.9.3-rc1", "recommended": false, "official": false, "description": "A release candidate of Meteor 0.9.3." From 35513fd745362340367e9366d50720de57f8e5c3 Mon Sep 17 00:00:00 2001 From: ekatek Date: Fri, 19 Sep 2014 22:24:01 -0700 Subject: [PATCH 05/82] fixed a bug in a more final way --- scripts/admin/meteor-release-experimental.json | 2 +- tools/project.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index a27bea8580..e987100070 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "0.9.3-rc1", + "version": "0.9.3-rc2", "recommended": false, "official": false, "description": "A release candidate of Meteor 0.9.3." diff --git a/tools/project.js b/tools/project.js index f4e42252de..f585ad0226 100644 --- a/tools/project.js +++ b/tools/project.js @@ -312,10 +312,7 @@ _.extend(Project.prototype, { // Finally, each release package is a weak exact constraint. So, let's add // those. _.each(releasePackages, function(version, name) { - allDeps.push({name: name, weak: true, - constraintString: "=" + name, - constraints: [ - { version: version, type: 'exactly' } ]}); + allDeps.push(utils.parseConstraint(name + "@=" + version)); }); // This is an UGLY HACK that has to do with our requirement to have a From ce9f3e0205a8f0f10a0f57d2419001ca0f6bfe5b Mon Sep 17 00:00:00 2001 From: ekatek Date: Fri, 19 Sep 2014 22:27:55 -0700 Subject: [PATCH 06/82] increment meteor-tool number --- packages/meteor-tool/package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index c66d2b1416..318d08583a 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.0.31-rc1' + version: '1.0.31-rc2' }); Package.includeTool(); From 5d8fb6d05b91e06a942cb767f4273fe8c7a80aa5 Mon Sep 17 00:00:00 2001 From: ekatek Date: Fri, 19 Sep 2014 22:34:39 -0700 Subject: [PATCH 07/82] release constraints are weak and also increment --- packages/accounts-meetup/package.js | 2 +- packages/meteor-tool/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 2 +- tools/project.js | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/accounts-meetup/package.js b/packages/accounts-meetup/package.js index 260c4e9610..d3c0bc6411 100644 --- a/packages/accounts-meetup/package.js +++ b/packages/accounts-meetup/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Login service for Meetup accounts", - version: "1.0.1--rc0" + version: "1.0.1-rc0" }); Package.on_use(function(api) { diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index 318d08583a..0d4f0493bf 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.0.31-rc2' + version: '1.0.31-rc3' }); Package.includeTool(); diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index e987100070..963a8a4e67 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "0.9.3-rc2", + "version": "0.9.3-rc3", "recommended": false, "official": false, "description": "A release candidate of Meteor 0.9.3." diff --git a/tools/project.js b/tools/project.js index f585ad0226..e61fb4c8e6 100644 --- a/tools/project.js +++ b/tools/project.js @@ -312,7 +312,8 @@ _.extend(Project.prototype, { // Finally, each release package is a weak exact constraint. So, let's add // those. _.each(releasePackages, function(version, name) { - allDeps.push(utils.parseConstraint(name + "@=" + version)); + _.extend(allDeps.push(utils.parseConstraint(name + "@=" + version), + { weak: true })); }); // This is an UGLY HACK that has to do with our requirement to have a From 3c9d7e26d05ecae0332207a88770ddf57dc42015 Mon Sep 17 00:00:00 2001 From: ekatek Date: Fri, 19 Sep 2014 22:36:30 -0700 Subject: [PATCH 08/82] push does not work like that --- tools/project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/project.js b/tools/project.js index e61fb4c8e6..0c020236d3 100644 --- a/tools/project.js +++ b/tools/project.js @@ -312,7 +312,7 @@ _.extend(Project.prototype, { // Finally, each release package is a weak exact constraint. So, let's add // those. _.each(releasePackages, function(version, name) { - _.extend(allDeps.push(utils.parseConstraint(name + "@=" + version), + allDeps.push(_.extend(utils.parseConstraint(name + "@=" + version), { weak: true })); }); From 811455ab14278948ce567864ca0a8c72ff303f28 Mon Sep 17 00:00:00 2001 From: ekatek Date: Fri, 19 Sep 2014 22:37:05 -0700 Subject: [PATCH 09/82] increment --- packages/meteor-tool/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index 0d4f0493bf..bcc01fcff7 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.0.31-rc3' + version: '1.0.31-rc4' }); Package.includeTool(); diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index 963a8a4e67..de20a089c5 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "0.9.3-rc3", + "version": "0.9.3-rc4", "recommended": false, "official": false, "description": "A release candidate of Meteor 0.9.3." From 64c63820a038e1f05df4776a6403a4841f8ec025 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Sun, 21 Sep 2014 10:17:54 -0700 Subject: [PATCH 10/82] Fix ReactiveDict on server (for iron:router) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note: We don’t officially support Tracker on the server. --- packages/reactive-dict/migration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/reactive-dict/migration.js b/packages/reactive-dict/migration.js index bb5832781b..4d273de55c 100644 --- a/packages/reactive-dict/migration.js +++ b/packages/reactive-dict/migration.js @@ -15,7 +15,7 @@ ReactiveDict._registerDictForMigrate = function (dictName, dict) { ReactiveDict._dictsToMigrate[dictName] = dict; }; -if (Package.reload) { +if (Meteor.isClient && Package.reload) { // Put old migrated data into ReactiveDict._migratedDictData, // where it can be accessed by ReactiveDict._loadMigratedDict. var migrationData = Package.reload.Reload._migrationData('reactive-dict'); From 559983ea0784abb202f326af08a2f9622584c308 Mon Sep 17 00:00:00 2001 From: ekatek Date: Sun, 21 Sep 2014 11:37:23 -0700 Subject: [PATCH 11/82] fix versionsFrom --- tools/package-source.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/package-source.js b/tools/package-source.js index 52e9cdab2d..2844eb5dd3 100644 --- a/tools/package-source.js +++ b/tools/package-source.js @@ -1294,7 +1294,7 @@ _.extend(PackageSource.prototype, { _.each(releaseRecords, function (releaseRecord) { var packages = releaseRecord.packages; if(_.has(packages, dep.package)) { - newConstraint.push(dep.package); + newConstraint.push(packages[dep.package]); } }); if (_.isEmpty(newConstraint)) return dep; From d1b23fbece6cfaee270e7ee0d888fbee43942984 Mon Sep 17 00:00:00 2001 From: ekatek Date: Sun, 21 Sep 2014 11:51:14 -0700 Subject: [PATCH 12/82] increment numbers --- packages/meteor-tool/package.js | 2 +- packages/reactive-dict/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index bcc01fcff7..bea5575c3b 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.0.31-rc4' + version: '1.0.31-rc5' }); Package.includeTool(); diff --git a/packages/reactive-dict/package.js b/packages/reactive-dict/package.js index 524960c8f4..4b29edcf2e 100644 --- a/packages/reactive-dict/package.js +++ b/packages/reactive-dict/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Reactive dictionary", - version: '1.0.3-rc0' + version: '1.0.3-rc1' }); Package.on_use(function (api) { diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index de20a089c5..c22818eeea 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "0.9.3-rc4", + "version": "0.9.3-rc5", "recommended": false, "official": false, "description": "A release candidate of Meteor 0.9.3." From e35e64b30c5fb3d1b2cf39f4a1166ef840ae0c46 Mon Sep 17 00:00:00 2001 From: ekatek Date: Mon, 22 Sep 2014 21:57:23 -0700 Subject: [PATCH 13/82] user the underscore instead of a tilde --- .../package-version-parser-tests.js | 72 +++++++++---------- tools/package-version-parser.js | 16 ++--- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/packages/package-version-parser/package-version-parser-tests.js b/packages/package-version-parser/package-version-parser-tests.js index 454c417181..b7361501c1 100644 --- a/packages/package-version-parser/package-version-parser-tests.js +++ b/packages/package-version-parser/package-version-parser-tests.js @@ -42,19 +42,19 @@ Tinytest.add("Smart Package version string parsing - compatible version, compati FAIL("foo@x.y.z"); FAIL("foo@<1.2"); FAIL("foo<1.2"); - FAIL("foo@1.2.3~abc"); - FAIL("foo@1.2.3+1234~1"); - FAIL("foo@1.2.3~1-rc1"); - FAIL("foo-1233@1.2.3~0"); - FAIL("foo-1233@1.2.3~"); - FAIL("foo-1233@1.2.3~0123"); + FAIL("foo@1.2.3_abc"); + FAIL("foo@1.2.3+1234_1"); + FAIL("foo@1.2.3_1-rc1"); + FAIL("foo-1233@1.2.3_0"); + FAIL("foo-1233@1.2.3_"); + FAIL("foo-1233@1.2.3_0123"); - t("foo@1.2.3~1", { name: "foo", constraints: [{ - version: "1.2.3~1", type: "compatible-with" } ]}); - t("foo-bar@3.2.1-rc0~123", { name: "foo-bar", constraints: [{ - version: "3.2.1-rc0~123", type: "compatible-with" } ]}); - t("foo-1233@1.2.3~5+1234", { name: "foo-1233", constraints: [{ - version: "1.2.3~5+1234", type: "compatible-with" } ]}); + t("foo@1.2.3_1", { name: "foo", constraints: [{ + version: "1.2.3_1", type: "compatible-with" } ]}); + t("foo-bar@3.2.1-rc0_123", { name: "foo-bar", constraints: [{ + version: "3.2.1-rc0_123", type: "compatible-with" } ]}); + t("foo-1233@1.2.3_5+1234", { name: "foo-1233", constraints: [{ + version: "1.2.3_5+1234", type: "compatible-with" } ]}); t("foo", { name: "foo", constraints: [{ version: null, type: "any-reasonable" } ]}); }); @@ -66,10 +66,10 @@ Tinytest.add("Smart Package version string parsing - compatible version, exactly { version: "1.2.3", type: "exactly" } ]}); t("foo-bar@=3.2.1", { name: "foo-bar", constraints: [{ version: "3.2.1", type: "exactly" } ]}); - t("foo@=1.2.3~1", { name: "foo", constraints: [{ - version: "1.2.3~1", type: "exactly" } ]}); - t("foo-bar@=3.2.1~34", { name: "foo-bar", constraints: [{ - version: "3.2.1~34", type: "exactly" } ]}); + t("foo@=1.2.3_1", { name: "foo", constraints: [{ + version: "1.2.3_1", type: "exactly" } ]}); + t("foo-bar@=3.2.1_34", { name: "foo-bar", constraints: [{ + version: "3.2.1_34", type: "exactly" } ]}); FAIL("42@=0.2.0"); FAIL("foo@=1.2.3.4"); @@ -81,7 +81,7 @@ Tinytest.add("Smart Package version string parsing - compatible version, exactly FAIL("foo@=<1.2"); FAIL("foo@<=1.2"); FAIL("foo<=1.2"); - FAIL("foo@=1.2.3~rc0"); + FAIL("foo@=1.2.3_rc0"); // We no longer support @>=. FAIL("foo@>=1.2.3"); @@ -112,14 +112,14 @@ Tinytest.add("Smart Package version string parsing - or", function (test) { [{ version: "3.2.1", type: "exactly"}, { version: "1.0.0", type: "compatible-with"}] }); - t("foo@=1.2.3~1 || 1.2.4", + t("foo@=1.2.3_1 || 1.2.4", { name: "foo", constraints: - [{ version: "1.2.3~1", type: "exactly"}, + [{ version: "1.2.3_1", type: "exactly"}, { version: "1.2.4", type: "compatible-with"}] }); - t("foo-bar@=3.2.1~34 || =3.2.1-rc1", + t("foo-bar@=3.2.1_34 || =3.2.1-rc1", { name: "foo-bar", constraints: - [{ version: "3.2.1~34", type: "exactly"}, + [{ version: "3.2.1_34", type: "exactly"}, { version: "3.2.1-rc1", type: "exactly"}] }); @@ -132,29 +132,29 @@ Tinytest.add("Smart Package version string parsing - or", function (test) { Tinytest.add("Meteor Version string parsing - less than", function (test) { test.isTrue(PackageVersion.lessThan("1.0.0", "1.2.0")); - test.isTrue(PackageVersion.lessThan("1.0.0~500", "1.2.0")); - test.isTrue(PackageVersion.lessThan("1.0.0~1", "1.0.0~2")); - test.isTrue(PackageVersion.lessThan("1.0.0", "1.0.0~2")); - test.isTrue(PackageVersion.lessThan("1.123.0~123", "3.0.0~2")); + test.isTrue(PackageVersion.lessThan("1.0.0_500", "1.2.0")); + test.isTrue(PackageVersion.lessThan("1.0.0_1", "1.0.0_2")); + test.isTrue(PackageVersion.lessThan("1.0.0", "1.0.0_2")); + test.isTrue(PackageVersion.lessThan("1.123.0_123", "3.0.0_2")); - test.isFalse(PackageVersion.lessThan("1.0.0~5", "1.0.0~2")); + test.isFalse(PackageVersion.lessThan("1.0.0_5", "1.0.0_2")); test.isFalse(PackageVersion.lessThan("1.0.0", "1.0.0")); - test.isFalse(PackageVersion.lessThan("1.0.0~5", "1.0.0~5")); - test.isFalse(PackageVersion.lessThan("1.0.1", "1.0.0~5")); + test.isFalse(PackageVersion.lessThan("1.0.0_5", "1.0.0_5")); + test.isFalse(PackageVersion.lessThan("1.0.1", "1.0.0_5")); }); Tinytest.add("Meteor Version string parsing - compare", function (test) { test.isTrue(PackageVersion.compare("1.0.0", "1.2.0") < 0); - test.isTrue(PackageVersion.compare("1.0.0~500", "1.2.0") < 0); - test.isTrue(PackageVersion.compare("1.0.0~1", "1.0.0~2") < 0); - test.isTrue(PackageVersion.compare("1.0.0", "1.0.0~2") < 0); - test.isTrue(PackageVersion.compare("1.123.0~123", "3.0.0~2") < 0); + test.isTrue(PackageVersion.compare("1.0.0_500", "1.2.0") < 0); + test.isTrue(PackageVersion.compare("1.0.0_1", "1.0.0_2") < 0); + test.isTrue(PackageVersion.compare("1.0.0", "1.0.0_2") < 0); + test.isTrue(PackageVersion.compare("1.123.0_123", "3.0.0_2") < 0); - test.isTrue(PackageVersion.compare("1.0.0~5", "1.0.0~2") > 0); + test.isTrue(PackageVersion.compare("1.0.0_5", "1.0.0_2") > 0); test.equal(PackageVersion.compare("1.0.0", "1.0.0"), 0); - test.equal(PackageVersion.compare("1.0.0~1", "1.0.0~1"), 0); + test.equal(PackageVersion.compare("1.0.0_1", "1.0.0_1"), 0); test.isTrue(PackageVersion.compare("1.2.0", "1.0.0") > 0); - test.isTrue(PackageVersion.compare("1.0.1", "1.0.0~5") > 0); + test.isTrue(PackageVersion.compare("1.0.1", "1.0.0_5") > 0); }); Tinytest.add("Invalid in 0.9.2", function (test) { @@ -163,7 +163,7 @@ Tinytest.add("Invalid in 0.9.2", function (test) { // These are invalid in 0.9.2, but valid in 0.9.3 and above. var invalidVersions = - ["1.0.0~1", "1.0.0 || 2.0.0", "1.0.0-rc1~1", + ["1.0.0_1", "1.0.0 || 2.0.0", "1.0.0-rc1_1", "3.4.0-rc1 || =1.0.0"]; _.each(invalidVersions, function (v) { test.isTrue(PackageVersion.invalidFirstFormatConstraint(v)); diff --git a/tools/package-version-parser.js b/tools/package-version-parser.js index 06c5f63793..20690bf62b 100644 --- a/tools/package-version-parser.js +++ b/tools/package-version-parser.js @@ -14,7 +14,7 @@ if (inTool) { var semver = inTool ? require ('semver') : Npm.require('semver'); var __ = inTool ? require('underscore') : _; -// Takes in a meteor version, for example 1.2.3-rc5~1+12345. +// Takes in a meteor version, for example 1.2.3-rc5_1+12345. // // Returns an object composed of the following: // semver: (ex: 1.2.3) @@ -25,9 +25,9 @@ var __ = inTool ? require('underscore') : _; var extractSemverPart = function (versionString) { if (!versionString) return { semver: "", wrapNum: -1 }; var noBuild = versionString.split('+'); - var splitVersion = noBuild[0].split('~'); + var splitVersion = noBuild[0].split('_'); var wrapNum = 0; - // If we find two +s, or two ~, that's super invalid. + // If we find two +s, or two _, that's super invalid. if (noBuild.length > 2 || splitVersion.length > 2) { throwVersionParserError( "Version string must look like semver (eg '1.2.3'), not '" @@ -36,11 +36,11 @@ var extractSemverPart = function (versionString) { wrapNum = splitVersion[1]; if (!/^\d+$/.test(wrapNum)) { throwVersionParserError( - "The wrap number (after ~) must contain only digits, so " + + "The wrap number (after _) must contain only digits, so " + versionString + " is invalid."); } else if (wrapNum[0] === "0") { throwVersionParserError( - "The wrap number (after ~) must not have a leading zero, so " + + "The wrap number (after _) must not have a leading zero, so " + versionString + " is invalid."); } } @@ -172,7 +172,7 @@ PV.getValidServerVersion = function (meteorVersionString) { } if (version.wrapNum) { - cleanVersion = cleanVersion + "~" + version.wrapNum; + cleanVersion = cleanVersion + "_" + version.wrapNum; } return cleanVersion; @@ -274,7 +274,7 @@ PV.constraintToFullString = function (parsedConstraint) { // Return true if the version constraint was invalid prior to 0.9.3 -// (adding ~ and || support) +// (adding _ and || support) // // NOTE: this is not used on the client yet. This package is used by the // package server to determine what is valid. @@ -284,6 +284,6 @@ PV.invalidFirstFormatConstraint = function (validConstraint) { // characters. Anything with those characters is invalid prior to // 0.9.3. XXX: If we ever have to go through these, we should write a more // complicated regex. - return (/~/.test(validConstraint) || + return (/_/.test(validConstraint) || /\|/.test(validConstraint)); }; From cbe4d6dd6db1d8f764761e0dbb7097cdfef9e941 Mon Sep 17 00:00:00 2001 From: ekatek Date: Mon, 22 Sep 2014 22:07:33 -0700 Subject: [PATCH 14/82] increment package versions --- packages/meteor-tool/package.js | 2 +- packages/package-version-parser/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index bea5575c3b..201290d9d0 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.0.31-rc5' + version: '1.0.31-rc6' }); Package.includeTool(); diff --git a/packages/package-version-parser/package.js b/packages/package-version-parser/package.js index 3d1a9607f9..d1db356c8f 100644 --- a/packages/package-version-parser/package.js +++ b/packages/package-version-parser/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Parses Meteor Smart Package version string", - version: "2.0.0-rc0" + version: "2.0.0-rc1" }); Npm.depends({ diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index c22818eeea..5876b9643b 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "0.9.3-rc5", + "version": "0.9.3-rc6", "recommended": false, "official": false, "description": "A release candidate of Meteor 0.9.3." From c740a5c02ab87ac3d726990138e6eda6f89310c4 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Mon, 22 Sep 2014 23:49:21 -0700 Subject: [PATCH 15/82] First pass at history.md --- History.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/History.md b/History.md index 99ea17ad3f..b5b57de161 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,63 @@ ## v.NEXT +## v0.9.3 + +### More Package Version Number Flexability + +* Packages now support for relying on multiple major versions of their + dependancies (eg `blaze@1.0.0 || 2.0.0`). Additionally, you can now + call `api.versionsFrom()` multiple times, or with an array + (eg `api.versionsFrom([, ])`. Meteor will + interpret this to mean that the package will work with packages from + all the listed releases. + +* Support for "wrapped package" version numbers. There is now `_` field + in version number. The `_` field must be integer, and versions with + the `_` are sorted after versions without. This allows using the + upstream version number as the Meteor package version number and being + able to publish multiple version of the Meteor package (eg + `jquery@1.11.1_2`). + +Note: packages using the `||` operator or the `_` symbol in their +versions or dependencies will be invisible to pre-0.9.3 users. Meteor +versions 0.9.2 and before do not understand the new version formats and +will not be able to use versions of packages that use the new features. + + +### Other Command-line tool improvments + +* More detailed constraint solver output. Meteor now tells you which + constraints prevent upgrading or adding new packages. This will make + it much easier to update your app to new versions. + +* Better handling of pre-release versions (eg versions with + `-`). Pre-release packages will now be included in an app if and only + if there is no way to meet the app's constraints without using a + pre-release package. + +* Add `meteor admin set-unmigrated` to allow maintainers to hide + pre-0.9.0 packages in `meteor search` & `meteor show`. This will not + stop users from continuing to use the package, but it helps prevent + new users from finding old non-functional packages. + +* Progress bars for time-intensive operations, like downloading large + packages. + + +### Other Changes + +* Offically support `Meteor.wrapAsync` (renamed from + `Meteor._wrapAsync`). Additionally, `Meteor.wrapAsync` now lets you + pass an object to bind as `this` in the wrapped call. See + https://docs.meteor.com/#meteor_wrapasync. + +* The `reactive-dict` package now allows an optional name argument to + enable data peristance during hot code push. + + +XXX patches contributed by + + ## v0.9.2.2 From 0c35bff3e20e728ba79a17985cd847bd4536c6ed Mon Sep 17 00:00:00 2001 From: Justin SB Date: Tue, 23 Sep 2014 10:58:40 -0700 Subject: [PATCH 16/82] Minimal fix for progress bar preventing 'meteor mongo' from exiting --- tools/console.js | 2 +- tools/main.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/console.js b/tools/console.js index 85eb497571..7da07a7a0f 100644 --- a/tools/console.js +++ b/tools/console.js @@ -152,7 +152,7 @@ _.extend(Console.prototype, { var self = this; Fiber(function () { while (true) { - sleep(10); + sleep(50); self._statusPoll(); } diff --git a/tools/main.js b/tools/main.js index f909866aaa..18f6f83aa8 100644 --- a/tools/main.js +++ b/tools/main.js @@ -1231,8 +1231,10 @@ commandName + ": You're not in a Meteor project directory.\n" + Console.setPretty(command.pretty); - Console.enableStatusPoll(); - Console.showProgressBar(); + if (command.pretty) { + Console.enableStatusPoll(); + Console.showProgressBar(); + } // Run the command! try { From 782c0ac1bbb9f37525d699bfdefa2798a3c27cba Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Tue, 23 Sep 2014 14:35:48 -0700 Subject: [PATCH 17/82] Support semver prerelease versions The semver library's compare functions already did the right thing, but our `PackageVersion.versionMagnitude` did not. It now almost correctly works for prerelease versions with a few caveats described in a [* XXX!] comment. While at it, add many tests which caught a separate bug due to adding a number to a string for versions such as "1.2.3_50". (That version would have been chosen over "5.0.0"!) --- .../package-version-parser-tests.js | 77 +++++++++++++------ tools/package-version-parser.js | 68 +++++++++++++--- 2 files changed, 113 insertions(+), 32 deletions(-) diff --git a/packages/package-version-parser/package-version-parser-tests.js b/packages/package-version-parser/package-version-parser-tests.js index b7361501c1..a55e499230 100644 --- a/packages/package-version-parser/package-version-parser-tests.js +++ b/packages/package-version-parser/package-version-parser-tests.js @@ -130,32 +130,63 @@ Tinytest.add("Smart Package version string parsing - or", function (test) { FAIL("foo@1.0.0-rc|1.0.0"); }); -Tinytest.add("Meteor Version string parsing - less than", function (test) { - test.isTrue(PackageVersion.lessThan("1.0.0", "1.2.0")); - test.isTrue(PackageVersion.lessThan("1.0.0_500", "1.2.0")); - test.isTrue(PackageVersion.lessThan("1.0.0_1", "1.0.0_2")); - test.isTrue(PackageVersion.lessThan("1.0.0", "1.0.0_2")); - test.isTrue(PackageVersion.lessThan("1.123.0_123", "3.0.0_2")); +Tinytest.add( + "Meteor Version string parsing - less than, compare, version magnitude", + function (test) { + var compare = function (v1, v2, expected) { + if (expected === '<') { + test.isTrue(PackageVersion.lessThan(v1, v2)); + test.isTrue(PackageVersion.versionMagnitude(v1) < PackageVersion.versionMagnitude(v2)); + test.isTrue(PackageVersion.compare(v1, v2) < 0); + } else if (expected === '=') { + test.isFalse(PackageVersion.lessThan(v1, v2)); + test.isFalse(PackageVersion.lessThan(v2, v1)); + test.isTrue(PackageVersion.versionMagnitude(v1) === PackageVersion.versionMagnitude(v2)); + test.isTrue(PackageVersion.compare(v1, v2) === 0); + } else if (expected === '>') { + test.isTrue(PackageVersion.lessThan(v2, v1)); + test.isTrue(PackageVersion.versionMagnitude(v1) > PackageVersion.versionMagnitude(v2)); + test.isTrue(PackageVersion.compare(v1, v2) > 0); + } else { + throw new Error("expected should be '<', '=' or '>'"); + } + }; - test.isFalse(PackageVersion.lessThan("1.0.0_5", "1.0.0_2")); - test.isFalse(PackageVersion.lessThan("1.0.0", "1.0.0")); - test.isFalse(PackageVersion.lessThan("1.0.0_5", "1.0.0_5")); - test.isFalse(PackageVersion.lessThan("1.0.1", "1.0.0_5")); -}); + compare("1.0.0", "1.2.0", "<"); + compare("1.0.0_200", "1.2.0", "<"); + compare("1.0.0_1", "1.0.0_2", "<"); + compare("1.0.0_2", "1.0.0_10", "<"); // verify that we compare ~N as numbers, not strings + compare("1.0.0", "1.0.0_2", "<"); + compare("1.123.0_123", "3.0.0_2", "<"); + compare("1.0.0_5", "1.0.0_2", ">"); + compare("1.0.0_200", "1.2.0", "<"); + compare("1.0.0_1", "1.0.0_2", "<"); + compare("1.0.0", "1.0.0_2", "<"); + compare("1.123.0_123", "3.0.0_2", "<"); -Tinytest.add("Meteor Version string parsing - compare", function (test) { - test.isTrue(PackageVersion.compare("1.0.0", "1.2.0") < 0); - test.isTrue(PackageVersion.compare("1.0.0_500", "1.2.0") < 0); - test.isTrue(PackageVersion.compare("1.0.0_1", "1.0.0_2") < 0); - test.isTrue(PackageVersion.compare("1.0.0", "1.0.0_2") < 0); - test.isTrue(PackageVersion.compare("1.123.0_123", "3.0.0_2") < 0); + compare("1.0.0_5", "1.0.0_2", ">"); + compare("1.0.0", "1.0.0", "="); + compare("1.0.0_5", "1.0.0_5", "="); + compare("1.2.0", "1.0.0", ">"); + compare("1.0.1", "1.0.0_5", ">"); - test.isTrue(PackageVersion.compare("1.0.0_5", "1.0.0_2") > 0); - test.equal(PackageVersion.compare("1.0.0", "1.0.0"), 0); - test.equal(PackageVersion.compare("1.0.0_1", "1.0.0_1"), 0); - test.isTrue(PackageVersion.compare("1.2.0", "1.0.0") > 0); - test.isTrue(PackageVersion.compare("1.0.1", "1.0.0_5") > 0); -}); + // Rule 11 from http://semver.org + compare("0.99.99", "1.0.0-alpha.1", "<"); + compare("1.0.0-alpha", "1.0.0-alpha.1", "<"); + compare("1.0.0-alpha.1", "1.0.0-alpha.beta", "<"); + compare("1.0.0-alpha.beta", "1.0.0-beta", "<"); + compare("1.0.0-beta", "1.0.0-beta.2", "<"); + compare("1.0.0-beta.2", "1.0.0-beta.11", "<"); + compare("1.0.0-beta.11", "1.0.0-rc.1", "<"); + compare("1.0.0-rc.1", "1.0.0", "<"); + compare("1.0.0-r.1", "1.0.0", "<"); // test single character prerelease parts + + // Our broken implementation of Rule 11 (see [*] above the + // declaration of PackageVersion.versionMagnitude). Maybe one day + // we'll fix it, in which case replace "===" with ">" + test.isTrue(PackageVersion.versionMagnitude("1.0.0-beta.0") === + PackageVersion.versionMagnitude("1.0.0-bear.0")); + }); Tinytest.add("Invalid in 0.9.2", function (test) { // Note that invalidFirstFormatConstraint assumes that the initial version diff --git a/tools/package-version-parser.js b/tools/package-version-parser.js index 20690bf62b..93ae270eb9 100644 --- a/tools/package-version-parser.js +++ b/tools/package-version-parser.js @@ -48,21 +48,71 @@ var extractSemverPart = function (versionString) { semver: (noBuild.length > 1) ? splitVersion[0] + "+" + noBuild[1] : splitVersion[0], - wrapNum: wrapNum + wrapNum: parseInt(wrapNum, 10) }; }; -// Converts a meteor version into a very large number, unique to that version. +// Converts a meteor version into a large floating point number, which +// is (more or less [*]) unique to that version. Satisfies the +// following guarantee: If PV.lessThan(v1, v2) then +// PV.versionMagnitude(v1) < PV.versionMagnitude(v2) [*] +// +// [* XXX!] We don't quite satisfy the uniqueness and comparison properties in +// these cases: +// 1. If any of the version parts are greater than 250 (pretty unlikely?) +// 2. If we're dealing with a prerelease version, we only look at the +// first two characters of each prerelease part. So, "1.0.0-beta" and +// "1.0.0-bear" will have the same magnitude. +// 3. If we're dealing with a prerelease version with more than two parts, eg +// "1.0.0-rc.0.1". In this comparison may fail since we'd get to the limit +// of JavaScript floating point precision. +// +// If we wanted to fix this, we'd make this function return a BigFloat +// instead of a vanilla JavaScript number. That will make the +// constraint solver slower (by how much?), and would require some +// careful thought. PV.versionMagnitude = function (versionString) { - // var v = semver.parse(versionString); - // return v.major * 10000 + v.minor * 100 + v.patch; - var version = extractSemverPart(versionString); var v = semver.parse(version.semver); - // XXX: This is kind of hacky and relies on not having more than 100 wrap - // numbers, for example. Probably OK. - return v.major * 1000000 + v.minor * 10000 + - v.patch * 100 + version.wrapNum; + + return v.major * 250 * 250 * 250 + + v.minor * 250 * 250 + + v.patch * 250 + + version.wrapNum + + prereleaseIdentifierToFraction(v.prerelease); +}; + +// Accepts an array, eg ["rc", 2, 3]. Returns a number in the range +// (-1, 0]. An empty array returns 0. A non-empty string returns a +// number that is "as large" as the its precedence. +var prereleaseIdentifierToFraction = function (prerelease) { + if (prerelease.length === 0) + return 0; + + return _.reduce(prerelease, function (memo, part, index) { + var digit; + if (typeof part === 'number') { + digit = part+1; + } else if (typeof part === 'string') { + var VALID_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + var validCharToNumber = function (ch) { + var result = VALID_CHARACTERS.indexOf(ch); + if (result === -1) + throw new Error("Unexpected character in prerelease identifier: " + ch); + else + return result; + }; + + digit = 251 + // Numeric parts always have lower precedence than non-numeric parts. + validCharToNumber(part[0]) * VALID_CHARACTERS.length + + (part[1] ? validCharToNumber(part[1]) : 0); + } else { + throw new Error("Unexpected prerelease identifier part: " + part + " of type " + typeof part); + } + + return memo + digit / Math.pow(3000, index+1); + }, -1); }; // Takes in two meteor versions. Returns true if the first one is less than the second. From b659994295efd52d6556b312afe282b913b191ac Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Tue, 23 Sep 2014 22:05:45 -0700 Subject: [PATCH 18/82] Add new NPM modules to license file. --- LICENSE.txt | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/LICENSE.txt b/LICENSE.txt index 4c09e63af0..87b924676c 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -95,6 +95,8 @@ css-parse: https://github.com/reworkcss/css-parse css-stringify: https://github.com/reworkcss/css-stringify callsite: https://github.com/visionmedia/callsite indexof: https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz +escape-html: https://github.com/component/escape-html +express: https://github.com/strongloop/express ---------- Copyright (c) 2010 TJ Holowaychuk @@ -102,6 +104,7 @@ Copyright (c) 2011 TJ Holowaychuk Copyright (c) 2012 TJ Holowaychuk Copyright (c) 2013 TJ Holowaychuk Copyright (c) 2011, 2013 TJ Holowaychuk +Copyright (c) 2009-2014 TJ Holowaychuk ---------- @@ -328,6 +331,7 @@ tty-browserify: https://github.com/substack/tty-browserify typedarray: https://github.com/substack/typedarray vm-browserify: https://github.com/substack/vm-browserify wordwrap: https://github.com/substack/node-wordwrap +yargs: https://github.com/chevex/yargs ---------- Copyright 2010, 2011, 2012, 2013 James Halliday (mail@substack.net) @@ -876,6 +880,74 @@ Modifications made by the following entities are licensed as above: - Eloy Duran, Fingertips +---------- +accepts: https://github.com/jshttp/accepts +merge-descriptors: https://github.com/component/merge-descriptors +type-is: https://github.com/jshttp/type-is +---------- + +Copyright (c) 2013 Jonathan Ong me@jongleberry.com +Copyright (c) 2014 Jonathan Ong + + +---------- +parseurl: https://github.com/expressjs/parseurl +---------- + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2014 Douglas Christopher Wilson + + +---------- +serve-static: https://github.com/expressjs/serve-static +---------- + +Copyright (c) 2010 Sencha Inc. +Copyright (c) 2011 LearnBoost +Copyright (c) 2011 TJ Holowaychuk +Copyright (c) 2014 Douglas Christopher Wilson + + +---------- +negotiator: https://github.com/jshttp/negotiator +---------- + +Original "Negotiator" program Copyright Federico Romero +Port to JavaScript Copyright Isaac Z. Schlueter + + +---------- +options: https://github.com/einaros/options.js +tinycolor: https://github.com/einaros/tinycolor +ws: https://github.com/einaros/ws +---------- + +Copyright (c) 2011 Einar Otto Stangvik +Copyright (c) 2012 Einar Otto Stangvik + + +---------- +path-to-regexp: https://github.com/component/path-to-regexp +---------- + +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) + + +---------- +truncate: https://github.com/FGRibreau/node-truncate +---------- + +Copyright (c) 2013 Francois-Guillaume Ribreau + + +---------- +utils-merge: https://github.com/jaredhanson/utils-merge +---------- + +Copyright (c) 2013 Jared Hanson + + + ============== Apache License @@ -1997,6 +2069,14 @@ Except where noted, this license applies to any and all software programs and associated documentation files created by the Original Author, when distributed with the Software. +---------- +strong-data-uri: https://github.com/strongloop/strong-data-uri +---------- + +Redistributed under the terms of the Artistic License, version 2.0. + +http://opensource.org/licenses/Artistic-2.0 + ---------- browserify: https://github.com/substack/node-browserify From 42550da8a5ffc4100842ecec7acc0eefd192aa56 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Tue, 23 Sep 2014 23:07:41 -0700 Subject: [PATCH 19/82] Update github committers. --- .mailmap | 6 ++++++ History.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 5ee6fc5e71..550b1158e2 100644 --- a/.mailmap +++ b/.mailmap @@ -41,6 +41,7 @@ GITHUB: marcandre GITHUB: mart-jansink GITHUB: MaximDubrovin GITHUB: meawoppl +GITHUB: meonkeys GITHUB: michaelbishop GITHUB: mitar GITHUB: mitar @@ -50,6 +51,7 @@ GITHUB: nathan-muir GITHUB: Neftedollar GITHUB: paulswartz GITHUB: Pent +GITHUB: prapicault GITHUB: queso GITHUB: rcy GITHUB: RichardLitt @@ -64,11 +66,15 @@ GITHUB: thatneat GITHUB: timhaines GITHUB: tmeasday GITHUB: twhy +GITHUB: waitingkuo +GITHUB: wulfmeister GITHUB: yeputons GITHUB: zol METEOR: arbesfeld METEOR: avital +METEOR: ben +METEOR: ben METEOR: debergalis METEOR: dgreensp METEOR: ekatek diff --git a/History.md b/History.md index b5b57de161..bcff9707f9 100644 --- a/History.md +++ b/History.md @@ -55,7 +55,7 @@ will not be able to use versions of packages that use the new features. enable data peristance during hot code push. -XXX patches contributed by +Patches by Github users meonkeys, mitar, mizzao, mquandalle, prapicault, waitingkuo, wulfmeister From c496bd716bacc24413cb4f948931eb73eb1309a0 Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Wed, 24 Sep 2014 16:16:39 -0700 Subject: [PATCH 20/82] Correct but failing test for lenient parsing of bad version number --- .../constraint-solver-tests.js | 20 ++++++ tools/tests/package-tests.js | 63 +++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/packages/constraint-solver/constraint-solver-tests.js b/packages/constraint-solver/constraint-solver-tests.js index 7b1f667bb9..3acc7097a3 100644 --- a/packages/constraint-solver/constraint-solver-tests.js +++ b/packages/constraint-solver/constraint-solver-tests.js @@ -311,6 +311,26 @@ Tinytest.add("constraint solver - no constraint dependency - anything", function test.isTrue(_.isString(versions.sparkle)); }); +Tinytest.add("constraint solver - ignore malformed version strings", function (test) { + var resolver = makeResolver([ + ["foo", "1.2.3", "1.2.3"], + ["foo", "1.2.3!bang@at#hash%invalid", "1.2.3!bang@at#hash%invalid"], + ["bar", "1.2.3", "1.2.3", {"foo": "1.2.3"}], + ["bar", "1.2.4", "1.2.4", {"foo": "1.2.3!bang@at#hash%invalid"}] + ]); + + testWithResolver(test, resolver, function (t, FAIL) { + FAIL({ "bar": "1.2.4" }, /not satisfied/); + + // Since we can't parse versions or dependencies of + // foo@1.2.3!band@at#hash%invalid or bar@1.2.4, ignore them when + // finding the right versions to use. + t({ "bar": "1.2.3"}, { + "bar": "1.2.3", + "foo": "1.2.3" + }, { _testing: true }); + }); +}); Tinytest.add("constraint solver - no constraint dependency - transitive dep still picked right", function (test) { var versions = defaultResolver.resolve( diff --git a/tools/tests/package-tests.js b/tools/tests/package-tests.js index a8fcfabbdf..146eb8f607 100644 --- a/tools/tests/package-tests.js +++ b/tools/tests/package-tests.js @@ -7,6 +7,7 @@ var _= require('underscore'); var fs = require("fs"); var path = require("path"); var packageClient = require("../package-client.js"); +var config = require("../config.js"); var username = "test"; var password = "testtest"; @@ -758,3 +759,65 @@ selftest.define("packages with organizations", ["net", "test-package-server"], f testUtils.login(s, "testtest", "testtest"); changeVersionAndPublish(s, true /* expect authorization failure */); }); + +selftest.define("malformed package names", [], function () { + var s = new Sandbox({warehouse: {v1: {recommended: true}}}); + s.set("METEOR_OFFLINE_CATALOG", "t"); + + var dataFile = config.getPackageStorage({root: s.warehouse}); + var data = JSON.parse(fs.readFileSync(dataFile, 'utf8')); + data.collections = data.collections || {}; + data.collections.packages = data.collections.packages || []; + data.collections.packages.push({ + "name": "bar", + "_id": utils.randomToken() + }); + data.collections.packages.push({ + "name": "foo", + "_id": utils.randomToken() + }); + + data.collections.versions = data.collections.versions || []; + data.collections.versions.push({ + "packageName": "bar", + "version": "1.2.4", + "earliestCompatibleVersion": "1.2.4", + "containsPlugins": false, + "description": "...", + "dependencies": { + "foo": { + "constraint": "1.2.3!bang@at#hash%invalid", + "references": [{"arch": "os"}] + } + } + }); + data.collections.versions.push({ + "packageName": "foo", + "version": "1.2.3!bang@at#hash%invalid", + "earliestCompatibleVersion": "1.2.3", + "containsPlugins": false, + "description": "...", + "dependencies": {} + }); + + fs.writeFileSync(dataFile, JSON.stringify(data)); +/* + run = s.run("search", "foo"); + run.match(/Neither packages nor releases .* could be found/); + run.expectExit(0); + + var run = s.run("search", "bar"); + run.match(/Neither packages nor releases .* could be found/); + run.expectExit(0); +*/ + var run = s.run("create", "myapp"); + run.expectExit(0); + + s.cd("myapp"); + run = s.run("add", "foo"); + run.matchErr("foo: no such package"); + run.expectExit(1); + run = s.run("add", "bar"); + run.matchErr("bar: no such package"); + run.expectExit(1); +}); From a401cd834ab299156b3974e0d6723b3acc5e3d94 Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Wed, 24 Sep 2014 17:34:40 -0700 Subject: [PATCH 21/82] Fix comment about deprecating _wrapAsync --- packages/meteor/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/meteor/helpers.js b/packages/meteor/helpers.js index ae620ab9bf..f172ec13f0 100644 --- a/packages/meteor/helpers.js +++ b/packages/meteor/helpers.js @@ -147,7 +147,7 @@ _.extend(Meteor, { var warnedAboutWrapAsync = false; /** - * @deprecated in 1.0.0 + * @deprecated in 0.9.3 */ Meteor._wrapAsync = function(fn, context) { if (! warnedAboutWrapAsync) { From 2a71dbfc41ae0f81e7d625f2327e926266f8349f Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Wed, 24 Sep 2014 17:44:44 -0700 Subject: [PATCH 22/82] Change output range for PackageVersionParser.versionMagnitude It's now back to returning 10000 for "1.0.0", as it was before the recent changes to allow for wrapped package version numbers and prerelease versions. Given that there are other constants in the cost function used in the constraint solver, this gives us much more confidence that we haven't fundamentally changed the behavior of `meteor add` or `meteor update` in 0.9.3. --- .../package-version-parser-tests.js | 11 +++++++---- tools/package-version-parser.js | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/package-version-parser/package-version-parser-tests.js b/packages/package-version-parser/package-version-parser-tests.js index a55e499230..b934f88b9c 100644 --- a/packages/package-version-parser/package-version-parser-tests.js +++ b/packages/package-version-parser/package-version-parser-tests.js @@ -153,16 +153,19 @@ Tinytest.add( }; compare("1.0.0", "1.2.0", "<"); - compare("1.0.0_200", "1.2.0", "<"); + compare("1.0.0_50", "1.0.1", "<"); + compare("1.0.0_50", "1.2.0", "<"); compare("1.0.0_1", "1.0.0_2", "<"); compare("1.0.0_2", "1.0.0_10", "<"); // verify that we compare ~N as numbers, not strings compare("1.0.0", "1.0.0_2", "<"); - compare("1.123.0_123", "3.0.0_2", "<"); + compare("1.99.0_99", "3.0.0_2", "<"); + compare("1.99.0", "2.0.0", "<"); compare("1.0.0_5", "1.0.0_2", ">"); - compare("1.0.0_200", "1.2.0", "<"); + compare("1.0.0_99", "1.2.0", "<"); + compare("1.0.0_99", "1.0.1", "<"); compare("1.0.0_1", "1.0.0_2", "<"); compare("1.0.0", "1.0.0_2", "<"); - compare("1.123.0_123", "3.0.0_2", "<"); + compare("1.99.0_99", "3.0.0_2", "<"); compare("1.0.0_5", "1.0.0_2", ">"); compare("1.0.0", "1.0.0", "="); diff --git a/tools/package-version-parser.js b/tools/package-version-parser.js index 93ae270eb9..0374c4d9a8 100644 --- a/tools/package-version-parser.js +++ b/tools/package-version-parser.js @@ -59,7 +59,7 @@ var extractSemverPart = function (versionString) { // // [* XXX!] We don't quite satisfy the uniqueness and comparison properties in // these cases: -// 1. If any of the version parts are greater than 250 (pretty unlikely?) +// 1. If any of the version parts are greater than 100 (pretty unlikely?) // 2. If we're dealing with a prerelease version, we only look at the // first two characters of each prerelease part. So, "1.0.0-beta" and // "1.0.0-bear" will have the same magnitude. @@ -75,11 +75,11 @@ PV.versionMagnitude = function (versionString) { var version = extractSemverPart(versionString); var v = semver.parse(version.semver); - return v.major * 250 * 250 * 250 + - v.minor * 250 * 250 + - v.patch * 250 + - version.wrapNum + - prereleaseIdentifierToFraction(v.prerelease); + return v.major * 100 * 100 + + v.minor * 100 + + v.patch + + version.wrapNum / 100 + + prereleaseIdentifierToFraction(v.prerelease) / 100 / 100; }; // Accepts an array, eg ["rc", 2, 3]. Returns a number in the range From 0d128ffbb5dcd9d61895cdbdc4bd39e320527912 Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Wed, 24 Sep 2014 17:44:44 -0700 Subject: [PATCH 23/82] Change output range for PackageVersionParser.versionMagnitude It's now back to returning 10000 for "1.0.0", as it was before the recent changes to allow for wrapped package version numbers and prerelease versions. Given that there are other constants in the cost function used in the constraint solver, this gives us much more confidence that we haven't fundamentally changed the behavior of `meteor add` or `meteor update` in 0.9.3. --- .../package-version-parser-tests.js | 11 +++++++---- tools/package-version-parser.js | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/package-version-parser/package-version-parser-tests.js b/packages/package-version-parser/package-version-parser-tests.js index a55e499230..b934f88b9c 100644 --- a/packages/package-version-parser/package-version-parser-tests.js +++ b/packages/package-version-parser/package-version-parser-tests.js @@ -153,16 +153,19 @@ Tinytest.add( }; compare("1.0.0", "1.2.0", "<"); - compare("1.0.0_200", "1.2.0", "<"); + compare("1.0.0_50", "1.0.1", "<"); + compare("1.0.0_50", "1.2.0", "<"); compare("1.0.0_1", "1.0.0_2", "<"); compare("1.0.0_2", "1.0.0_10", "<"); // verify that we compare ~N as numbers, not strings compare("1.0.0", "1.0.0_2", "<"); - compare("1.123.0_123", "3.0.0_2", "<"); + compare("1.99.0_99", "3.0.0_2", "<"); + compare("1.99.0", "2.0.0", "<"); compare("1.0.0_5", "1.0.0_2", ">"); - compare("1.0.0_200", "1.2.0", "<"); + compare("1.0.0_99", "1.2.0", "<"); + compare("1.0.0_99", "1.0.1", "<"); compare("1.0.0_1", "1.0.0_2", "<"); compare("1.0.0", "1.0.0_2", "<"); - compare("1.123.0_123", "3.0.0_2", "<"); + compare("1.99.0_99", "3.0.0_2", "<"); compare("1.0.0_5", "1.0.0_2", ">"); compare("1.0.0", "1.0.0", "="); diff --git a/tools/package-version-parser.js b/tools/package-version-parser.js index 93ae270eb9..0374c4d9a8 100644 --- a/tools/package-version-parser.js +++ b/tools/package-version-parser.js @@ -59,7 +59,7 @@ var extractSemverPart = function (versionString) { // // [* XXX!] We don't quite satisfy the uniqueness and comparison properties in // these cases: -// 1. If any of the version parts are greater than 250 (pretty unlikely?) +// 1. If any of the version parts are greater than 100 (pretty unlikely?) // 2. If we're dealing with a prerelease version, we only look at the // first two characters of each prerelease part. So, "1.0.0-beta" and // "1.0.0-bear" will have the same magnitude. @@ -75,11 +75,11 @@ PV.versionMagnitude = function (versionString) { var version = extractSemverPart(versionString); var v = semver.parse(version.semver); - return v.major * 250 * 250 * 250 + - v.minor * 250 * 250 + - v.patch * 250 + - version.wrapNum + - prereleaseIdentifierToFraction(v.prerelease); + return v.major * 100 * 100 + + v.minor * 100 + + v.patch + + version.wrapNum / 100 + + prereleaseIdentifierToFraction(v.prerelease) / 100 / 100; }; // Accepts an array, eg ["rc", 2, 3]. Returns a number in the range From 620dde5306044db09c99545205ffb151178beac4 Mon Sep 17 00:00:00 2001 From: ekatek Date: Wed, 24 Sep 2014 17:53:37 -0700 Subject: [PATCH 24/82] correcting a mistype in a field: since we changed the schema, this should be constraint.name --- packages/constraint-solver/constraint-solver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/constraint-solver/constraint-solver.js b/packages/constraint-solver/constraint-solver.js index 35f3a71b2c..052ade40fa 100644 --- a/packages/constraint-solver/constraint-solver.js +++ b/packages/constraint-solver/constraint-solver.js @@ -177,7 +177,7 @@ ConstraintSolver.PackagesResolver.prototype.resolve = function ( self._ensurePackageInfoLoaded(packageName); }); _.each(constraints, function (constraint) { - self._ensurePackageInfoLoaded(constraint.packageName); + self._ensurePackageInfoLoaded(constraint.name); }); _.each(options.previousSolution, function (version, packageName) { self._ensurePackageInfoLoaded(packageName); From 573f8815319396991eb9fa4e334a4b581fbd4b61 Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Wed, 24 Sep 2014 18:28:36 -0700 Subject: [PATCH 25/82] Simplify a test --- tools/tests/autoupdate.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/tests/autoupdate.js b/tools/tests/autoupdate.js index 29cae921f2..2d93951db9 100644 --- a/tools/tests/autoupdate.js +++ b/tools/tests/autoupdate.js @@ -6,9 +6,7 @@ var config = require("../config.js"); var Sandbox = selftest.Sandbox; var editPackageMetadata = function (sandbox, f) { - var dataFile = path.join(sandbox.warehouse, - 'package-metadata', 'v1.1', - config.getLocalPackageCacheFilename()); + var dataFile = config.getPackageStorage({root: sandbox.warehouse}); var data = JSON.parse(fs.readFileSync(dataFile, 'utf8')); f(data); fs.writeFileSync(dataFile, JSON.stringify(data)); From cb0811a10acab05528c5404b5ccc708bf7cf238b Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Wed, 24 Sep 2014 18:30:41 -0700 Subject: [PATCH 26/82] Uncomment test for `meteor search` with malformed versions --- tools/tests/package-tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/tests/package-tests.js b/tools/tests/package-tests.js index 146eb8f607..cc67e19448 100644 --- a/tools/tests/package-tests.js +++ b/tools/tests/package-tests.js @@ -801,7 +801,7 @@ selftest.define("malformed package names", [], function () { }); fs.writeFileSync(dataFile, JSON.stringify(data)); -/* + run = s.run("search", "foo"); run.match(/Neither packages nor releases .* could be found/); run.expectExit(0); @@ -809,7 +809,7 @@ selftest.define("malformed package names", [], function () { var run = s.run("search", "bar"); run.match(/Neither packages nor releases .* could be found/); run.expectExit(0); -*/ + var run = s.run("create", "myapp"); run.expectExit(0); From e8ebfe8aaeb44c7dfa955043b3540081ec2c49f8 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Wed, 24 Sep 2014 16:45:21 -0700 Subject: [PATCH 27/82] First cut of deprecating old helper syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with back-compat. The “old-style” syntax is `Template.foo.bar = …` instead of `Template.foo.helpers({bar: …})`. Properties of back-compat to test: You can replace an old-style helper (overwrite it). You can delete an old-style helper. We don’t have to support these capabilities, but we used them both in our test code, so apps probably do it too. We print a deprecation once per helper. This leads to a lot of warnings! It’s helpful for porting, though developers who for some reason don’t want to port yet may want a way to disable them. `spacebars-tests` pass. --- packages/blaze/lookup.js | 36 +++++++- packages/blaze/template.js | 14 +++- packages/spacebars-tests/template_tests.js | 98 +++++++++++++--------- 3 files changed, 106 insertions(+), 42 deletions(-) diff --git a/packages/blaze/lookup.js b/packages/blaze/lookup.js index 1032d5a691..b5813dfbab 100644 --- a/packages/blaze/lookup.js +++ b/packages/blaze/lookup.js @@ -29,6 +29,36 @@ var bindDataContext = function (x) { return x; }; +Blaze._OLDSTYLE_HELPER = {}; + +var getTemplateHelper = Blaze._getTemplateHelper = function (template, name) { + // XXX COMPAT WITH 0.9.3 + var isKnownOldStyleHelper = false; + + if (template.__helpers.has(name)) { + var helper = template.__helpers.get(name); + if (helper === Blaze._OLDSTYLE_HELPER) { + isKnownOldStyleHelper = true; + } else { + return helper; + } + } + + // old-style helper + if (name in template) { + // Only warn once per helper + if (! isKnownOldStyleHelper) { + template.__helpers.set(name, Blaze._OLDSTYLE_HELPER); + Blaze._warn('Assigning helper with ' + template.viewName + '.' + + name + ' = ... is deprecated. Use ' + template.viewName + + '.helpers(...) instead.'); + } + return template[name]; + } + + return null; +}; + var wrapHelper = function (f) { return Blaze._wrapCatchingExceptions(f, 'template helper'); }; @@ -50,6 +80,7 @@ var wrapHelper = function (f) { Blaze.View.prototype.lookup = function (name, _options) { var template = this.template; var lookupTemplate = _options && _options.template; + var helper; if (/^\./.test(name)) { // starts with a dot. must be a series of dots which maps to an @@ -59,8 +90,9 @@ Blaze.View.prototype.lookup = function (name, _options) { return Blaze._parentData(name.length - 1, true /*_functionWrapped*/); - } else if (template && (name in template)) { - return wrapHelper(bindDataContext(template[name])); + } else if (template && + ((helper = getTemplateHelper(template, name)) != null)) { + return wrapHelper(bindDataContext(helper)); } else if (lookupTemplate && (name in Blaze.Template) && (Blaze.Template[name] instanceof Blaze.Template)) { return Blaze.Template[name]; diff --git a/packages/blaze/template.js b/packages/blaze/template.js index 5e4cfeaafd..7de3c03d55 100644 --- a/packages/blaze/template.js +++ b/packages/blaze/template.js @@ -31,10 +31,22 @@ Blaze.Template = function (viewName, renderFunction) { this.viewName = viewName; this.renderFunction = renderFunction; + this.__helpers = new HelperMap; this.__eventMaps = []; }; var Template = Blaze.Template; +var HelperMap = function () {}; +HelperMap.prototype.get = function (name) { + return this[' '+name]; +}; +HelperMap.prototype.set = function (name, helper) { + this[' '+name] = helper; +}; +HelperMap.prototype.has = function (name) { + return (' '+name) in this; +}; + /** * @summary Returns true if `value` is a template object like `Template.myTemplate`. * @locus Client @@ -236,7 +248,7 @@ Blaze.TemplateInstance.prototype.autorun = function (f) { */ Template.prototype.helpers = function (dict) { for (var k in dict) - this[k] = dict[k]; + this.__helpers.set(k, dict[k]); }; /** diff --git a/packages/spacebars-tests/template_tests.js b/packages/spacebars-tests/template_tests.js index 25b40b17b5..e0dc187aa9 100644 --- a/packages/spacebars-tests/template_tests.js +++ b/packages/spacebars-tests/template_tests.js @@ -19,16 +19,35 @@ var clickIt = function (elem) { clickElement(elem); }; +// maybe use created callback on the template instead of this? +var extendTemplateWithInit = function (template, initFunc) { + var tmpl = new Template(template.viewName+'-extended', template.renderFunction); + tmpl.constructView = function (/*args*/) { + var view = Template.prototype.constructView.apply(this, arguments); + initFunc(view); + return view; + }; + return tmpl; +}; + +// Make a "clone" of origTemplate (but not its helpers) +var copyTemplate = function (origTemplate) { + return new Template(origTemplate.viewName, origTemplate.renderFunction); +}; + Tinytest.add("spacebars-tests - template_tests - simple helper", function (test) { - var tmpl = Template.spacebars_template_test_simple_helper; + var baseTmpl = Template.spacebars_template_test_simple_helper; + var tmpl1 = copyTemplate(baseTmpl); var R = ReactiveVar(1); - tmpl.foo = function (x) { - return x + R.get(); - }; - tmpl.bar = function () { - return 123; - }; - var div = renderToDiv(tmpl); + tmpl1.helpers({ + foo: function (x) { + return x + R.get(); + }, + bar: function () { + return 123; + } + }); + var div = renderToDiv(tmpl1); test.equal(canonicalizeHtml(div.innerHTML), "124"); R.set(2); @@ -36,26 +55,33 @@ Tinytest.add("spacebars-tests - template_tests - simple helper", function (test) test.equal(canonicalizeHtml(div.innerHTML), "125"); // Test that `{{foo bar}}` throws if `foo` is missing or not a function. - tmpl.foo = 3; + var tmpl2 = copyTemplate(baseTmpl); + tmpl2.helpers({foo: 3}); test.throws(function () { - renderToDiv(tmpl); + renderToDiv(tmpl2); }, /Can't call non-function/); - delete tmpl.foo; + var tmpl3 = copyTemplate(baseTmpl); test.throws(function () { - renderToDiv(tmpl); + renderToDiv(tmpl3); }, /No such function/); - tmpl.foo = function () {}; + var tmpl4 = copyTemplate(baseTmpl); + tmpl4.helpers({foo: function () {}}); // doesn't throw - div = renderToDiv(tmpl); + div = renderToDiv(tmpl4); test.equal(canonicalizeHtml(div.innerHTML), ''); - // now "foo" is a function in the data context - delete tmpl.foo; + // now make "foo" is a function in the data context + var tmpl5 = copyTemplate(baseTmpl); + tmpl5.helpers({ + bar: function () { + return 123; + } + }); R = ReactiveVar(1); - div = renderToDiv(tmpl, { foo: function (x) { + div = renderToDiv(tmpl5, { foo: function (x) { return x + R.get(); } }); test.equal(canonicalizeHtml(div.innerHTML), "124"); @@ -64,15 +90,15 @@ Tinytest.add("spacebars-tests - template_tests - simple helper", function (test) test.equal(canonicalizeHtml(div.innerHTML), "125"); test.throws(function () { - renderToDiv(tmpl, {foo: 3}); + renderToDiv(tmpl5, {foo: 3}); }, /Can't call non-function/); test.throws(function () { - renderToDiv(tmpl, {foo: null}); + renderToDiv(tmpl5, {foo: null}); }, /No such function/); test.throws(function () { - renderToDiv(tmpl, {}); + renderToDiv(tmpl5, {}); }, /No such function/); }); @@ -227,17 +253,6 @@ Tinytest.add("spacebars-tests - template_tests - inclusion args 2", function (te test.isTrue(span1 === span2); }); -// maybe use created callback on the template instead of this? -var extendTemplateWithInit = function (template, initFunc) { - var tmpl = new Template(template.viewName+'-extended', template.renderFunction); - tmpl.constructView = function (/*args*/) { - var view = Template.prototype.constructView.apply(this, arguments); - initFunc(view); - return view; - }; - return tmpl; -}; - Tinytest.add("spacebars-tests - template_tests - inclusion dotted args", function (test) { // `{{> foo bar.baz}}` var tmpl = Template.spacebars_template_test_inclusion_dotted_args; @@ -1173,7 +1188,7 @@ Tinytest.add('spacebars-tests - template_tests - inclusion helpers are isolated' var dep = new Tracker.Dependency; var subtmpl = Template.spacebars_template_test_inclusion_helpers_are_isolated_subtemplate; // make a copy so we can set "rendered" without mutating the original - var subtmplCopy = new Template(subtmpl.viewName, subtmpl.renderFunction); + var subtmplCopy = copyTemplate(subtmpl); var R = new ReactiveVar(subtmplCopy); tmpl.foo = function () { @@ -1596,31 +1611,36 @@ var runOneTwoTest = function (test, subTemplateName, optionsData) { Template.spacebars_test_helpers_stop_onetwo_attribute], function (tmpl) { - tmpl.one = Template[subTemplateName + '1']; - tmpl.two = Template[subTemplateName + '2']; + var sub1 = Template[subTemplateName + '1']; + var sub2 = Template[subTemplateName + '2']; + + tmpl.helpers({ + one: sub1, + two: sub2 + }); var buf = ''; var showOne = ReactiveVar(true); var dummy = ReactiveVar(0); - tmpl.showOne = function () { return showOne.get(); }; - tmpl.one.options = function () { + tmpl.helpers({showOne: function () { return showOne.get(); }}); + sub1.helpers({options: function () { var x = dummy.get(); buf += '1'; if (optionsData) return optionsData[x]; else return ['something']; - }; - tmpl.two.options = function () { + }}); + sub2.helpers({options: function () { var x = dummy.get(); buf += '2'; if (optionsData) return optionsData[x]; else return ['something']; - }; + }}); var div = renderToDiv(tmpl); Tracker.flush(); From a3f3b7b6902224ae83b9ab0c87ae2bf0b0bbadde Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Wed, 24 Sep 2014 19:04:17 -0700 Subject: [PATCH 28/82] Add tests for old-style helper back-compat --- packages/spacebars-tests/template_tests.html | 4 ++++ packages/spacebars-tests/template_tests.js | 22 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/packages/spacebars-tests/template_tests.html b/packages/spacebars-tests/template_tests.html index c3faed9d51..915a4fef54 100644 --- a/packages/spacebars-tests/template_tests.html +++ b/packages/spacebars-tests/template_tests.html @@ -996,3 +996,7 @@ Hi there! + + diff --git a/packages/spacebars-tests/template_tests.js b/packages/spacebars-tests/template_tests.js index e0dc187aa9..d2f7a8d56d 100644 --- a/packages/spacebars-tests/template_tests.js +++ b/packages/spacebars-tests/template_tests.js @@ -2932,3 +2932,25 @@ Tinytest.add("spacebars-tests - template_tests - falsy helper", function (test) var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'foo:0 GLOBAL_ZERO:0'); }); + +Tinytest.add("spacebars-tests - template_tests - old-style helpers", function (test) { + var tmpl = Template.spacebars_template_test_oldstyle_helpers; + + // Test old-style helper + tmpl.foo = 'hello'; + var div = renderToDiv(tmpl); + test.equal(canonicalizeHtml(div.innerHTML), 'hello'); + + // Test that replacing a helper still works (we don't cache). + // We can change this behavior if we need to, but it is more breaking + // to do so. + tmpl.foo = 'world'; + var div = renderToDiv(tmpl); + test.equal(canonicalizeHtml(div.innerHTML), 'world'); + + // Test deleting a helper. As with the previous case, we can + // break this, but we should do it intentionally. + delete tmpl.foo; + var div = renderToDiv(tmpl); + test.equal(canonicalizeHtml(div.innerHTML), ''); +}); From 88936518d83d5d67876a4927e7d7dedd6f02145d Mon Sep 17 00:00:00 2001 From: ekatek Date: Wed, 24 Sep 2014 19:23:55 -0700 Subject: [PATCH 29/82] test reproducing this bug: when you add a package with rcs, you end up adding the rcs, even if you did not explicitly ask for them. --- .../package-of-two-versions/packagerc.js | 2 +- tools/tests/publish.js | 79 ++++++++++++++++++- 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/tools/tests/packages/package-of-two-versions/packagerc.js b/tools/tests/packages/package-of-two-versions/packagerc.js index 1a8172641b..742226ff60 100644 --- a/tools/tests/packages/package-of-two-versions/packagerc.js +++ b/tools/tests/packages/package-of-two-versions/packagerc.js @@ -1,4 +1,4 @@ Package.describe({ summary: "Test package.", - version: "1.0.4-rc3" + version: "1.0.4-rc.3" }); diff --git a/tools/tests/publish.js b/tools/tests/publish.js index 4d462b9c84..0e66f34b32 100644 --- a/tools/tests/publish.js +++ b/tools/tests/publish.js @@ -138,7 +138,6 @@ selftest.define("publish-one-arch", ["slow", "net", "test-package-server"], func }); - selftest.define("list-with-a-new-version", ["slow", "net", "test-package-server"], function () { var s = new Sandbox; @@ -255,18 +254,91 @@ selftest.define("list-with-a-new-version", run.expectExit(0); // It works if ask for it, though. - run = s.run("add", fullPackageName + "@1.0.4-rc3"); + run = s.run("add", fullPackageName + "@1.0.4-rc.3"); run.waitSecs(100); run.expectExit(0); run = s.run("list"); run.waitSecs(10); run.match(fullPackageName); - run.match("1.0.4-rc3 "); + run.match("1.0.4-rc.3 "); run.forbidAll("New versions"); run.expectExit(0); }); }); + +selftest.define("do-not-update-to-rcs", + ["slow", "net", "test-package-server"], function () { + var s = new Sandbox; + + var username = "test"; + var password = "testtest"; + + testUtils.login(s, username, password); + var packageName = utils.randomToken(); + var fullPackageName = username + ":" + packageName; + var run; + + // Now, create a package. + s.createPackage(fullPackageName, "package-of-two-versions"); + // Publish the first version. + s.cd(fullPackageName, function () { + run = s.run("publish", "--create"); + run.waitSecs(15); + run.expectExit(0); + run.match("Done"); + }); + + // Now publish an 1.0.4-rc.3. + s.cp(fullPackageName+'/packagerc.js', fullPackageName+'/package.js'); + s.cd(fullPackageName, function () { + run = s.run("publish"); + run.waitSecs(15); + run.expectExit(0); + run.match("Done"); + }); + + // Create an app. Add the package to it. Check that list shows the package, at + // the non-rc version. + run = s.run('create', 'mapp'); + run.waitSecs(15); + run.expectExit(0); + s.cd('mapp', function () { + run = s.run("add", fullPackageName); + run.waitSecs(100); + run.expectExit(0); + run = s.run("list"); + run.waitSecs(10); + run.match(fullPackageName); + run.match("1.0.0 "); + run.forbidAll("New versions"); + run.expectExit(0); + + // Now, let's try to update. It should not work, since update will not bring + // you to an rc version automatically (unless it has to). + run = s.run("update", "packages-only"); + run.waitSecs(10); + run.match("Your packages are at their latest compatible versions."); + run.expectExit(0); + run = s.run("list"); + run.waitSecs(10); + run.match(fullPackageName); + run.match("1.0.0 "); + + // It works if ask for it, though. + run = s.run("add", fullPackageName + "@1.0.4-rc.3"); + run.waitSecs(100); + run.expectExit(0); + run = s.run("list"); + run.waitSecs(10); + run.match(fullPackageName); + run.match("1.0.4-rc.3 "); + run.forbidAll("New versions"); + run.expectExit(0); + }); +}); + + selftest.define("package-depends-on-either-version", ["slow", "net", "test-package-server"], function () { var s = new Sandbox; @@ -352,5 +424,4 @@ selftest.define("package-depends-on-either-version", depend = readVersions(); selftest.expectEqual(depend[fullPackageNameDep], "2.0.0"); selftest.expectEqual(depend[fullPackageAnother], "1.0.0"); - }); From 3278265b523a4c8d0553c36e87a3148cca7250eb Mon Sep 17 00:00:00 2001 From: ekatek Date: Wed, 24 Sep 2014 20:52:22 -0700 Subject: [PATCH 30/82] also testing correct behavior when there are two rcs: running update should move you to the newer rcs ifff you are already using an rc. Does not currently work. --- .../package-of-two-versions/packagerc2.js | 4 ++ tools/tests/publish.js | 50 +++++++++++++++++-- 2 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 tools/tests/packages/package-of-two-versions/packagerc2.js diff --git a/tools/tests/packages/package-of-two-versions/packagerc2.js b/tools/tests/packages/package-of-two-versions/packagerc2.js new file mode 100644 index 0000000000..8bae60a7cd --- /dev/null +++ b/tools/tests/packages/package-of-two-versions/packagerc2.js @@ -0,0 +1,4 @@ +Package.describe({ + summary: "Test package.", + version: "1.0.4-rc.4" +}); diff --git a/tools/tests/publish.js b/tools/tests/publish.js index 0e66f34b32..110d9a000d 100644 --- a/tools/tests/publish.js +++ b/tools/tests/publish.js @@ -289,6 +289,15 @@ selftest.define("do-not-update-to-rcs", run.match("Done"); }); + // Change the package to increment version and publish the new package. + s.cp(fullPackageName+'/package2.js', fullPackageName+'/package.js'); + s.cd(fullPackageName, function () { + run = s.run("publish"); + run.waitSecs(15); + run.expectExit(0); + run.match("Done"); + }); + // Now publish an 1.0.4-rc.3. s.cp(fullPackageName+'/packagerc.js', fullPackageName+'/package.js'); s.cd(fullPackageName, function () { @@ -298,19 +307,39 @@ selftest.define("do-not-update-to-rcs", run.match("Done"); }); + // Now publish an 1.0.4-rc.4. + s.cp(fullPackageName+'/packagerc2.js', fullPackageName+'/package.js'); + s.cd(fullPackageName, function () { + run = s.run("publish"); + run.waitSecs(15); + run.expectExit(0); + run.match("Done"); + }); + // Create an app. Add the package to it. Check that list shows the package, at // the non-rc version. run = s.run('create', 'mapp'); run.waitSecs(15); run.expectExit(0); s.cd('mapp', function () { + + // XXX: This test was failing because we were running from a situation that + // could not be resolved without using RCs. Since we had to use RCs already, + // we were OK with using the RC for the new package. That's bad! Anyway, at + // least we are testing that in the absense of other data, we should not add + // the RC. Ideally, we should consider running this test with a warehouse, + // but maybe not yet. + run = s.run("remove", "meteor-platform", "autopublish", "insecure"); + run.waitSecs(10); + run.expectExit(0); + run = s.run("add", fullPackageName); - run.waitSecs(100); + run.waitSecs(10); run.expectExit(0); run = s.run("list"); run.waitSecs(10); run.match(fullPackageName); - run.match("1.0.0 "); + run.match("1.0.1"); run.forbidAll("New versions"); run.expectExit(0); @@ -320,10 +349,16 @@ selftest.define("do-not-update-to-rcs", run.waitSecs(10); run.match("Your packages are at their latest compatible versions."); run.expectExit(0); + run = s.run("update"); + run.waitSecs(10); + run.match("Your packages are at their latest compatible versions."); + run.expectExit(0); run = s.run("list"); run.waitSecs(10); run.match(fullPackageName); - run.match("1.0.0 "); + // Check that we have 1.0.1 AND there is no star indicating new versions. + run.match("1.0.1 "); + run.expectExit(0); // It works if ask for it, though. run = s.run("add", fullPackageName + "@1.0.4-rc.3"); @@ -332,8 +367,13 @@ selftest.define("do-not-update-to-rcs", run = s.run("list"); run.waitSecs(10); run.match(fullPackageName); - run.match("1.0.4-rc.3 "); - run.forbidAll("New versions"); + run.match("1.0.4-rc.3"); + // run.match("New versions"); + run.expectExit(0); + + run = s.run("update", "packages-only"); + run.waitSecs(10); + run.match("1.0.4-rc.4"); run.expectExit(0); }); }); From 6feb5da9485e773fb0ebc542d1bb8185c1451d1d Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Wed, 24 Sep 2014 21:07:09 -0700 Subject: [PATCH 31/82] Let pre-release versions upgrade to later pre-release versions But only if they're on the same base version. --- packages/constraint-solver/resolver.js | 7 ++++--- tools/package-version-parser.js | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/constraint-solver/resolver.js b/packages/constraint-solver/resolver.js index be33cf1743..9166c4be01 100644 --- a/packages/constraint-solver/resolver.js +++ b/packages/constraint-solver/resolver.js @@ -418,10 +418,11 @@ ConstraintSolver.Constraint.prototype.isSatisfied = function ( throw Error("Unknown constraint type: " + currConstraint.type); } - // If you are asking for a pre-release, you need to get exactly that one. - // (@1.2.3-rc1 does not match 1.2.4.) + // If you are asking for a pre-release, you need to get a + // pre-release on the same release that has higher precendence. if (/-/.test(currConstraint.version)) { - return currConstraint.version === candidateUV.version; + return PackageVersion.prereleaseLessThan( + currConstraint.version, candidateUV.version); } // If you're not asking for a pre-release (and you are not in pre-releases-OK diff --git a/tools/package-version-parser.js b/tools/package-version-parser.js index 0374c4d9a8..2c4588cb74 100644 --- a/tools/package-version-parser.js +++ b/tools/package-version-parser.js @@ -337,3 +337,15 @@ PV.invalidFirstFormatConstraint = function (validConstraint) { return (/_/.test(validConstraint) || /\|/.test(validConstraint)); }; + +// Returns true if both v1 and v2 represent pre-releases off of the +// same base release, and v2 >= v1 +PV.prereleaseLessThan = function (v1, v2) { + if (!/-/.test(v1) || !/-/.test(v2)) + return false; + + if (v1.split('-')[0] !== v2.split('-')[0]) + return false; + + return PV.lessThan(v1, v2); +}; From 245059ef49ba069709378dca20a1b71daaec7e01 Mon Sep 17 00:00:00 2001 From: ekatek Date: Wed, 24 Sep 2014 21:28:36 -0700 Subject: [PATCH 32/82] if we are asking for a prerelease, we should run the same comparison as normal Previously, if we were asking for a pre-release, we would only return true if it was the same pre-release, or at least on the same release. But that's not true. 1.2.4 should be valid if we want 1.2.4-rc0, for example, and, even 1.2.3-rc0. (I mean, if it has the same ecv, which it might not). This is also what was causing some of the issues around 0.9.1 rollout, we think. So, we are going to try treating rcs like normal versions as far as comparisons go. We still don't want to give you an rc unless you asked for it though. --- packages/constraint-solver/resolver.js | 10 ++-------- tools/package-version-parser.js | 12 ------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/packages/constraint-solver/resolver.js b/packages/constraint-solver/resolver.js index 9166c4be01..d7fa36b3ab 100644 --- a/packages/constraint-solver/resolver.js +++ b/packages/constraint-solver/resolver.js @@ -418,17 +418,11 @@ ConstraintSolver.Constraint.prototype.isSatisfied = function ( throw Error("Unknown constraint type: " + currConstraint.type); } - // If you are asking for a pre-release, you need to get a - // pre-release on the same release that has higher precendence. - if (/-/.test(currConstraint.version)) { - return PackageVersion.prereleaseLessThan( - currConstraint.version, candidateUV.version); - } - // If you're not asking for a pre-release (and you are not in pre-releases-OK // mode), you'll only get it if it was a top level explicit mention (eg, in // the release). - if (/-/.test(candidateUV.version) && !resolveContext.useRCsOK) { + if (!/-/.test(currConstraint.version) && + /-/.test(candidateUV.version) && !resolveContext.useRCsOK) { if (currConstraint.version === candidateUV.version) return true; if (!_.has(resolveContext.topLevelPrereleases, self.name) || diff --git a/tools/package-version-parser.js b/tools/package-version-parser.js index 2c4588cb74..0374c4d9a8 100644 --- a/tools/package-version-parser.js +++ b/tools/package-version-parser.js @@ -337,15 +337,3 @@ PV.invalidFirstFormatConstraint = function (validConstraint) { return (/_/.test(validConstraint) || /\|/.test(validConstraint)); }; - -// Returns true if both v1 and v2 represent pre-releases off of the -// same base release, and v2 >= v1 -PV.prereleaseLessThan = function (v1, v2) { - if (!/-/.test(v1) || !/-/.test(v2)) - return false; - - if (v1.split('-')[0] !== v2.split('-')[0]) - return false; - - return PV.lessThan(v1, v2); -}; From 22845b6f1110762ea77017401a1196c3a1403bcb Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Wed, 24 Sep 2014 19:43:05 -0700 Subject: [PATCH 33/82] Port spacebars-tests to new-style helpers --- packages/blaze/lookup.js | 8 +- packages/spacebars-tests/template_tests.js | 580 +++++++++++-------- packages/spacebars-tests/templating_tests.js | 63 +- packages/templating/templating.js | 6 + 4 files changed, 377 insertions(+), 280 deletions(-) diff --git a/packages/blaze/lookup.js b/packages/blaze/lookup.js index b5813dfbab..aef979ca26 100644 --- a/packages/blaze/lookup.js +++ b/packages/blaze/lookup.js @@ -49,9 +49,11 @@ var getTemplateHelper = Blaze._getTemplateHelper = function (template, name) { // Only warn once per helper if (! isKnownOldStyleHelper) { template.__helpers.set(name, Blaze._OLDSTYLE_HELPER); - Blaze._warn('Assigning helper with ' + template.viewName + '.' + - name + ' = ... is deprecated. Use ' + template.viewName + - '.helpers(...) instead.'); + if (! template._NOWARN_OLDSTYLE_HELPERS) { + Blaze._warn('Assigning helper with `' + template.viewName + '.' + + name + ' = ...` is deprecated. Use `' + template.viewName + + '.helpers(...)` instead.'); + } } return template[name]; } diff --git a/packages/spacebars-tests/template_tests.js b/packages/spacebars-tests/template_tests.js index d2f7a8d56d..c09e4304b7 100644 --- a/packages/spacebars-tests/template_tests.js +++ b/packages/spacebars-tests/template_tests.js @@ -107,9 +107,9 @@ Tinytest.add("spacebars-tests - template_tests - dynamic template", function (te var aaa = Template.spacebars_template_test_aaa; var bbb = Template.spacebars_template_test_bbb; var R = ReactiveVar("aaa"); - tmpl.foo = function () { + tmpl.helpers({foo: function () { return R.get() === 'aaa' ? aaa : bbb; - }; + }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), "aaa"); @@ -121,12 +121,14 @@ Tinytest.add("spacebars-tests - template_tests - dynamic template", function (te Tinytest.add("spacebars-tests - template_tests - interpolate attribute", function (test) { var tmpl = Template.spacebars_template_test_interpolate_attribute; - tmpl.foo = function (x) { - return x+1; - }; - tmpl.bar = function () { - return 123; - }; + tmpl.helpers({ + foo: function (x) { + return x+1; + }, + bar: function () { + return 123; + } + }); var div = renderToDiv(tmpl); test.equal($(div).find('div')[0].className, "aaa124zzz"); @@ -137,8 +139,10 @@ Tinytest.add("spacebars-tests - template_tests - dynamic attrs", function (test) var R2 = ReactiveVar({x: "X"}); var R3 = ReactiveVar('selected'); - tmpl.attrsObj = function () { return R2.get(); }; - tmpl.singleAttr = function () { return R3.get(); }; + tmpl.helpers({ + attrsObj: function () { return R2.get(); }, + singleAttr: function () { return R3.get(); } + }); var div = renderToDiv(tmpl); var span = $(div).find('span')[0]; @@ -160,7 +164,9 @@ Tinytest.add("spacebars-tests - template_tests - triple", function (test) { var tmpl = Template.spacebars_template_test_triple; var R = ReactiveVar('blah'); - tmpl.html = function () { return R.get(); }; + tmpl.helpers({ + html: function () { return R.get(); } + }); var div = renderToDiv(tmpl); var elems = $(div).find("> *"); @@ -186,8 +192,10 @@ Tinytest.add("spacebars-tests - template_tests - triple", function (test) { test.equal(canonicalizeHtml(span.innerHTML), 'blah'); var tmpl = Template.spacebars_template_test_triple2; - tmpl.html = function () {}; - tmpl.html2 = function () { return null; }; + tmpl.helpers({ + html: function () {}, + html2: function () { return null; } + }); // no tmpl.html3 div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'xy'); @@ -197,7 +205,7 @@ Tinytest.add("spacebars-tests - template_tests - inclusion args", function (test var tmpl = Template.spacebars_template_test_inclusion_args; var R = ReactiveVar(Template.spacebars_template_test_aaa); - tmpl.foo = function () { return R.get(); }; + tmpl.helpers({foo: function () { return R.get(); }}); var div = renderToDiv(tmpl); // `{{> foo bar}}`, with `foo` resolving to Template.aaa, @@ -208,20 +216,22 @@ Tinytest.add("spacebars-tests - template_tests - inclusion args", function (test test.equal(canonicalizeHtml(div.innerHTML), 'bbb'); ////// Ok, now `foo` *is* Template.aaa - tmpl.foo = Template.spacebars_template_test_aaa; + tmpl.helpers({foo: Template.spacebars_template_test_aaa}); div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'aaa'); ////// Ok, now `foo` is a template that takes an argument; bar is a string. - tmpl.foo = Template.spacebars_template_test_bracketed_this; - tmpl.bar = 'david'; + tmpl.helpers({ + foo: Template.spacebars_template_test_bracketed_this, + bar: 'david' + }); div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), '[david]'); ////// Now `foo` is a template that takes an arg; bar is a function. - tmpl.foo = Template.spacebars_template_test_span_this; + tmpl.helpers({foo: Template.spacebars_template_test_span_this}); R = ReactiveVar('david'); - tmpl.bar = function () { return R.get(); }; + tmpl.helpers({bar: function () { return R.get(); }}); div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'david'); var span1 = div.querySelector('span'); @@ -236,13 +246,15 @@ Tinytest.add("spacebars-tests - template_tests - inclusion args 2", function (te // `{{> foo bar q=baz}}` var tmpl = Template.spacebars_template_test_inclusion_args2; - tmpl.foo = Template.spacebars_template_test_span_this; - tmpl.bar = function (options) { - return options.hash.q; - }; + tmpl.helpers({ + foo: Template.spacebars_template_test_span_this, + bar: function (options) { + return options.hash.q; + } + }); var R = ReactiveVar('david!'); - tmpl.baz = function () { return R.get().slice(0,5); }; + tmpl.helpers({ baz: function () { return R.get().slice(0,5); } }); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'david'); var span1 = div.querySelector('span'); @@ -258,15 +270,19 @@ Tinytest.add("spacebars-tests - template_tests - inclusion dotted args", functio var tmpl = Template.spacebars_template_test_inclusion_dotted_args; var initCount = 0; - tmpl.foo = extendTemplateWithInit( - Template.spacebars_template_test_bracketed_this, - function () { initCount++; }); + tmpl.helpers({ + foo: extendTemplateWithInit( + Template.spacebars_template_test_bracketed_this, + function () { initCount++; }) + }); var R = ReactiveVar('david'); - tmpl.bar = function () { - // make sure `this` is bound correctly - return { baz: this.symbol + R.get() }; - }; + tmpl.helpers({ + bar: function () { + // make sure `this` is bound correctly + return { baz: this.symbol + R.get() }; + } + }); var div = renderToDiv(tmpl, {symbol:'%'}); test.equal(initCount, 1); @@ -285,14 +301,14 @@ Tinytest.add("spacebars-tests - template_tests - inclusion slashed args", functi var tmpl = Template.spacebars_template_test_inclusion_dotted_args; var initCount = 0; - tmpl.foo = extendTemplateWithInit( + tmpl.helpers({foo: extendTemplateWithInit( Template.spacebars_template_test_bracketed_this, - function () { initCount++; }); + function () { initCount++; }) }); var R = ReactiveVar('david'); - tmpl.bar = function () { + tmpl.helpers({bar: function () { // make sure `this` is bound correctly return { baz: this.symbol + R.get() }; - }; + }}); var div = renderToDiv(tmpl, {symbol:'%'}); test.equal(initCount, 1); @@ -305,9 +321,9 @@ Tinytest.add("spacebars-tests - template_tests - block helper", function (test) // `{{#foo}}bar{{else}}baz{{/foo}}` var tmpl = Template.spacebars_template_test_block_helper; var R = ReactiveVar(Template.spacebars_template_test_content); - tmpl.foo = function () { + tmpl.helpers({foo: function () { return R.get(); - }; + }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), "bar"); @@ -319,12 +335,12 @@ Tinytest.add("spacebars-tests - template_tests - block helper", function (test) Tinytest.add("spacebars-tests - template_tests - block helper function with one string arg", function (test) { // `{{#foo "bar"}}content{{/foo}}` var tmpl = Template.spacebars_template_test_block_helper_function_one_string_arg; - tmpl.foo = function () { + tmpl.helpers({foo: function () { if (String(this) === "bar") return Template.spacebars_template_test_content; else return null; - }; + }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), "content"); }); @@ -332,13 +348,15 @@ Tinytest.add("spacebars-tests - template_tests - block helper function with one Tinytest.add("spacebars-tests - template_tests - block helper function with one helper arg", function (test) { var tmpl = Template.spacebars_template_test_block_helper_function_one_helper_arg; var R = ReactiveVar("bar"); - tmpl.bar = function () { return R.get(); }; - tmpl.foo = function () { - if (String(this) === "bar") - return Template.spacebars_template_test_content; - else - return null; - }; + tmpl.helpers({ + bar: function () { return R.get(); }, + foo: function () { + if (String(this) === "bar") + return Template.spacebars_template_test_content; + else + return null; + } + }); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), "content"); @@ -350,7 +368,7 @@ Tinytest.add("spacebars-tests - template_tests - block helper function with one Tinytest.add("spacebars-tests - template_tests - block helper component with one helper arg", function (test) { var tmpl = Template.spacebars_template_test_block_helper_component_one_helper_arg; var R = ReactiveVar(true); - tmpl.bar = function () { return R.get(); }; + tmpl.helpers({bar: function () { return R.get(); }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), "content"); @@ -362,12 +380,14 @@ Tinytest.add("spacebars-tests - template_tests - block helper component with one Tinytest.add("spacebars-tests - template_tests - block helper component with three helper args", function (test) { var tmpl = Template.spacebars_template_test_block_helper_component_three_helper_args; var R = ReactiveVar("bar"); - tmpl.bar_or_baz = function () { - return R.get(); - }; - tmpl.equals = function (x, y) { - return x === y; - }; + tmpl.helpers({ + bar_or_baz: function () { + return R.get(); + }, + equals: function (x, y) { + return x === y; + } + }); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), "content"); @@ -383,18 +403,21 @@ Tinytest.add("spacebars-tests - template_tests - block helper with dotted arg", var R3 = ReactiveVar(100); var initCount = 0; - tmpl.foo = extendTemplateWithInit( - Template.spacebars_template_test_bracketed_this, - function () { initCount++; }); - tmpl.bar = function () { - return { - r1: R1.get(), - baz: function (r3) { - return this.r1 + R2.get() + r3; - } - }; - }; - tmpl.qux = function () { return R3.get(); }; + tmpl.helpers({ + foo: extendTemplateWithInit( + Template.spacebars_template_test_bracketed_this, + function () { initCount++; }), + + bar: function () { + return { + r1: R1.get(), + baz: function (r3) { + return this.r1 + R2.get() + r3; + } + }; + }, + qux: function () { return R3.get(); } + }); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), "[111]"); @@ -454,9 +477,11 @@ Tinytest.add("spacebars-tests - template_tests - nested content", function (test var tmpl = Template.spacebars_template_test_nested_content; var R = ReactiveVar(true); - tmpl.flag = function () { - return R.get(); - }; + tmpl.helpers({ + flag: function () { + return R.get(); + } + }); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'hello'); R.set(false); @@ -469,9 +494,11 @@ Tinytest.add("spacebars-tests - template_tests - nested content", function (test // Also test that `{{> Template.contentBlock}}` in a custom block helper works. tmpl = Template.spacebars_template_test_nested_content2; R = ReactiveVar(true); - tmpl.x = function () { - return R.get(); - }; + tmpl.helpers({ + x: function () { + return R.get(); + } + }); div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'hello'); R.set(false); @@ -485,11 +512,13 @@ Tinytest.add("spacebars-tests - template_tests - nested content", function (test Tinytest.add("spacebars-tests - template_tests - if", function (test) { var tmpl = Template.spacebars_template_test_if; var R = ReactiveVar(true); - tmpl.foo = function () { - return R.get(); - }; - tmpl.bar = 1; - tmpl.baz = 2; + tmpl.helpers({ + foo: function () { + return R.get(); + }, + bar: 1, + baz: 2 + }); var div = renderToDiv(tmpl); var rendersTo = function (html) { divRendersTo(test, div, html); }; @@ -501,7 +530,7 @@ Tinytest.add("spacebars-tests - template_tests - if", function (test) { Tinytest.add("spacebars-tests - template_tests - if in with", function (test) { var tmpl = Template.spacebars_template_test_if_in_with; - tmpl.foo = {bar: "bar"}; + tmpl.helpers({foo: {bar: "bar"}}); var div = renderToDiv(tmpl); divRendersTo(test, div, "bar bar"); @@ -510,9 +539,11 @@ Tinytest.add("spacebars-tests - template_tests - if in with", function (test) { Tinytest.add("spacebars-tests - template_tests - each on cursor", function (test) { var tmpl = Template.spacebars_template_test_each; var coll = new Mongo.Collection(null); - tmpl.items = function () { - return coll.find({}, {sort: {pos: 1}}); - }; + tmpl.helpers({ + items: function () { + return coll.find({}, {sort: {pos: 1}}); + } + }); var div = renderToDiv(tmpl); var rendersTo = function (html) { divRendersTo(test, div, html); }; @@ -533,12 +564,14 @@ Tinytest.add("spacebars-tests - template_tests - each on cursor", function (test Tinytest.add("spacebars-tests - template_tests - each on array", function (test) { var tmpl = Template.spacebars_template_test_each; var R = new ReactiveVar([]); - tmpl.items = function () { - return R.get(); - }; - tmpl.text = function () { - return this; - }; + tmpl.helpers({ + items: function () { + return R.get(); + }, + text: function () { + return this; + } + }); var div = renderToDiv(tmpl); var rendersTo = function (html) { divRendersTo(test, div, html); }; @@ -560,13 +593,21 @@ Tinytest.add("spacebars-tests - template_tests - each on array", function (test) Tinytest.add("spacebars-tests - template_tests - ..", function (test) { var tmpl = Template.spacebars_template_test_dots; - Template.spacebars_template_test_dots_subtemplate.getTitle = function (from) { - return from.title; - }; - tmpl.foo = {title: "foo"}; - tmpl.foo.bar = {title: "bar"}; - tmpl.foo.bar.items = [{title: "item"}]; + Template.spacebars_template_test_dots_subtemplate.helpers({ + getTitle: function (from) { + return from.title; + } + }); + + tmpl.helpers({ + foo: { + title: "foo", + bar: {title: "bar", + items: [{title: "item"}]} + } + }); + var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), [ @@ -586,9 +627,11 @@ Tinytest.add("spacebars-tests - template_tests - select tags", function (test) { // {optgroup: (id), value: (string), selected: (boolean), label: (string)} var options = new Mongo.Collection(null); - tmpl.optgroups = function () { return optgroups.find(); }; - tmpl.options = function () { return options.find({optgroup: this._id}); }; - tmpl.selectedAttr = function () { return this.selected ? {selected: true} : {}; }; + tmpl.helpers({ + optgroups: function () { return optgroups.find(); }, + options: function () { return options.find({optgroup: this._id}); }, + selectedAttr: function () { return this.selected ? {selected: true} : {}; } + }); var div = renderToDiv(tmpl); var selectEl = $(div).find('select')[0]; @@ -691,8 +734,10 @@ Tinytest.add("spacebars-tests - template_tests - select tags", function (test) { }); Tinytest.add('spacebars-tests - template_tests - {{#with}} falsy; issue #770', function (test) { - Template.test_template_issue770.value1 = function () { return "abc"; }; - Template.test_template_issue770.value2 = function () { return false; }; + Template.test_template_issue770.helpers({ + value1: function () { return "abc"; }, + value2: function () { return false; } + }); var div = renderToDiv(Template.test_template_issue770); test.equal(canonicalizeHtml(div.innerHTML), "abc xxx abc"); @@ -700,9 +745,11 @@ Tinytest.add('spacebars-tests - template_tests - {{#with}} falsy; issue #770', f Tinytest.add("spacebars-tests - template_tests - tricky attrs", function (test) { var tmpl = Template.spacebars_template_test_tricky_attrs; - tmpl.theType = function () { return 'text'; }; var R = ReactiveVar('foo'); - tmpl.theClass = function () { return R.get(); }; + tmpl.helpers({ + theType: function () { return 'text'; }, + theClass: function () { return R.get(); } + }); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML).slice(0, 30), @@ -728,9 +775,9 @@ Tinytest.add('spacebars-tests - template_tests - textarea', function (test) { var R = ReactiveVar('hello'); - tmpl.foo = function () { + tmpl.helpers({foo: function () { return R.get(); - }; + }}); var div = renderToDiv(tmpl); var textarea = div.querySelector('textarea'); @@ -747,9 +794,9 @@ Tinytest.add('spacebars-tests - template_tests - textarea 2', function (test) { var R = ReactiveVar(true); - tmpl.foo = function () { + tmpl.helpers({foo: function () { return R.get(); - }; + }}); var div = renderToDiv(tmpl); var textarea = div.querySelector('textarea'); @@ -762,7 +809,6 @@ Tinytest.add('spacebars-tests - template_tests - textarea 2', function (test) { R.set(true); Tracker.flush(); test.equal(textarea.value, ''); - }); Tinytest.add('spacebars-tests - template_tests - textarea 3', function (test) { @@ -770,9 +816,9 @@ Tinytest.add('spacebars-tests - template_tests - textarea 3', function (test) { var R = ReactiveVar('hello'); - tmpl.foo = function () { + tmpl.helpers({foo: function () { return R.get(); - }; + }}); var div = renderToDiv(tmpl); var textarea = div.querySelector('textarea'); @@ -790,9 +836,9 @@ Tinytest.add('spacebars-tests - template_tests - textarea each', function (test) var R = ReactiveVar(['APPLE', 'BANANA']); - tmpl.foo = function () { + tmpl.helpers({foo: function () { return R.get(); - }; + }}); var div = renderToDiv(tmpl); var textarea = div.querySelector('textarea'); @@ -828,9 +874,11 @@ testAsyncMulti('spacebars-tests - template_tests - defer in rendered callbacks', } }); - tmpl.items = function () { - return coll.find(); - }; + tmpl.helpers({ + items: function () { + return coll.find(); + } + }); var subtmpl = Template.spacebars_template_test_defer_in_rendered_subtemplate; @@ -873,16 +921,18 @@ Tinytest.add('spacebars-tests - template_tests - with someData', function (test) var foo = ReactiveVar('AAA'); var someDataRuns = 0; - tmpl.someData = function () { - someDataRuns++; - return {}; - }; - tmpl.foo = function () { - return foo.get(); - }; - tmpl.bar = function () { - return 'YO'; - }; + tmpl.helpers({ + someData: function () { + someDataRuns++; + return {}; + }, + foo: function () { + return foo.get(); + }, + bar: function () { + return 'YO'; + } + }); var div = renderToDiv(tmpl); @@ -904,7 +954,7 @@ Tinytest.add('spacebars-tests - template_tests - #each stops when rendered eleme var tmpl = Template.spacebars_template_test_each_stops; var coll = new Mongo.Collection(null); coll.insert({}); - tmpl.items = function () { return coll.find(); }; + tmpl.helpers({items: function () { return coll.find(); }}); var div = renderToDiv(tmpl); divRendersTo(test, div, 'x'); @@ -922,12 +972,14 @@ Tinytest.add('spacebars-tests - template_tests - block helpers in attribute', fu var tmpl = Template.spacebars_template_test_block_helpers_in_attribute; var coll = new Mongo.Collection(null); - tmpl.classes = function () { + tmpl.helpers({ + classes: function () { return coll.find({}, {sort: {name: 1}}); - }; - tmpl.startsLowerCase = function (name) { - return /^[a-z]/.test(name); - }; + }, + startsLowerCase: function (name) { + return /^[a-z]/.test(name); + } + }); coll.insert({name: 'David'}); coll.insert({name: 'noodle'}); coll.insert({name: 'donut'}); @@ -965,7 +1017,7 @@ Tinytest.add('spacebars-tests - template_tests - block helpers in attribute 2', var R = ReactiveVar(true); - tmpl.foo = function () { return R.get(); }; + tmpl.helpers({foo: function () { return R.get(); }}); var div = renderToDiv(tmpl); var input = div.querySelector('input'); @@ -986,14 +1038,16 @@ Tinytest.add('spacebars-tests - template_tests - constant #each argument', funct var justReturnRuns = 0; // how many times `justReturn` is called var R = ReactiveVar(1); - tmpl.someData = function () { - return R.get(); - }; - tmpl.anArray = ['foo', 'bar']; - tmpl.justReturn = function (x) { - justReturnRuns++; - return String(x); - }; + tmpl.helpers({ + someData: function () { + return R.get(); + }, + anArray: ['foo', 'bar'], + justReturn: function (x) { + justReturnRuns++; + return String(x); + } + }); var div = renderToDiv(tmpl); @@ -1011,10 +1065,12 @@ Tinytest.add('spacebars-tests - template_tests - constant #each argument', funct Tinytest.addAsync('spacebars-tests - template_tests - #markdown - basic', function (test, onComplete) { var tmpl = Template.spacebars_template_test_markdown_basic; - tmpl.obj = {snippet: "hi"}; - tmpl.hi = function () { - return this.snippet; - }; + tmpl.helpers({ + obj: {snippet: "hi"}, + hi: function () { + return this.snippet; + } + }); var div = renderToDiv(tmpl); Meteor.call("getAsset", "markdown_basic.html", function (err, html) { @@ -1042,7 +1098,7 @@ testAsyncMulti('spacebars-tests - template_tests - #markdown - if', [ var self = this; var tmpl = Template.spacebars_template_test_markdown_if; var R = new ReactiveVar(false); - tmpl.cond = function () { return R.get(); }; + tmpl.helpers({cond: function () { return R.get(); }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), canonicalizeHtml(self.html1)); @@ -1069,7 +1125,7 @@ testAsyncMulti('spacebars-tests - template_tests - #markdown - each', [ var self = this; var tmpl = Template.spacebars_template_test_markdown_each; var R = new ReactiveVar([]); - tmpl.seq = function () { return R.get(); }; + tmpl.helpers({seq: function () { return R.get(); }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), canonicalizeHtml(self.html1)); @@ -1083,7 +1139,7 @@ testAsyncMulti('spacebars-tests - template_tests - #markdown - each', [ Tinytest.add('spacebars-tests - template_tests - #markdown - inclusion', function (test) { var tmpl = Template.spacebars_template_test_markdown_inclusion; var subtmpl = Template.spacebars_template_test_markdown_inclusion_subtmpl; - subtmpl.foo = "bar"; + subtmpl.helpers({foo: "bar"}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), "

Foo is bar.

"); }); @@ -1109,10 +1165,10 @@ Tinytest.add('spacebars-tests - template_tests - simple helpers are isolated', f _.each(runs, function (run) { var tmpl = Template.spacebars_template_test_simple_helpers_are_isolated; var dep = new Tracker.Dependency; - tmpl.foo = function () { + tmpl.helpers({foo: function () { dep.depend(); return run.helper(); - }; + }}); var div = renderToDiv(tmpl); var fooTextNode = _.find(div.childNodes, function (node) { return node.nodeValue === run.nodeValue; @@ -1136,10 +1192,10 @@ Tinytest.add('spacebars-tests - template_tests - simple helpers are isolated', f Tinytest.add('spacebars-tests - template_tests - attribute helpers are isolated', function (test) { var tmpl = Template.spacebars_template_test_attr_helpers_are_isolated; var dep = new Tracker.Dependency; - tmpl.foo = function () { + tmpl.helpers({foo: function () { dep.depend(); return "foo"; - }; + }}); var div = renderToDiv(tmpl); var pElement = div.querySelector('p'); @@ -1160,10 +1216,10 @@ Tinytest.add('spacebars-tests - template_tests - attribute helpers are isolated' Tinytest.add('spacebars-tests - template_tests - attribute object helpers are isolated', function (test) { var tmpl = Template.spacebars_template_test_attr_object_helpers_are_isolated; var dep = new Tracker.Dependency; - tmpl.attrs = function () { + tmpl.helpers({attrs: function () { dep.depend(); return {foo: "bar"}; - }; + }}); var div = renderToDiv(tmpl); var pElement = div.querySelector('p'); @@ -1191,10 +1247,10 @@ Tinytest.add('spacebars-tests - template_tests - inclusion helpers are isolated' var subtmplCopy = copyTemplate(subtmpl); var R = new ReactiveVar(subtmplCopy); - tmpl.foo = function () { + tmpl.helpers({foo: function () { dep.depend(); return R.get(); - }; + }}); var div = renderToDiv(tmpl); subtmplCopy.rendered = function () { @@ -1282,7 +1338,7 @@ Tinytest.add("spacebars-tests - template_tests - double", function (test) { var tmpl = Template.spacebars_template_test_double; var run = function (foo, expectedResult) { - tmpl.foo = foo; + tmpl.helpers({foo: foo}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), expectedResult); }; @@ -1310,8 +1366,10 @@ Tinytest.add("spacebars-tests - template_tests - inclusion lookup order", functi spacebars_template_test_inclusion_lookup_subtmpl3}; }; - tmpl.spacebars_template_test_inclusion_lookup_subtmpl = - Template.spacebars_template_test_inclusion_lookup_subtmpl2; + tmpl.helpers({ + spacebars_template_test_inclusion_lookup_subtmpl: + Template.spacebars_template_test_inclusion_lookup_subtmpl2 + }); test.equal(canonicalizeHtml(renderToDiv(tmpl, tmplData).innerHTML), ["This is generated by a helper with the same name.", @@ -1321,7 +1379,7 @@ Tinytest.add("spacebars-tests - template_tests - inclusion lookup order", functi Tinytest.add("spacebars-tests - template_tests - content context", function (test) { var tmpl = Template.spacebars_template_test_content_context; var R = ReactiveVar(true); - tmpl.foo = { + tmpl.helpers({foo: { firstLetter: 'F', secondLetter: 'O', bar: { @@ -1329,7 +1387,7 @@ Tinytest.add("spacebars-tests - template_tests - content context", function (tes firstLetter: 'B', secondLetter: 'A' } - }; + }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'BO'); @@ -1347,30 +1405,36 @@ _.each(['textarea', 'text', 'password', 'submit', 'button', if (type === 'select') { tmpl = Template.spacebars_test_control_select; - tmpl.options = ['This is a test', 'This is a fridge', - 'This is a frog', 'This is a new frog', 'foobar', - 'This is a photograph', 'This is a monkey', - 'This is a donkey']; - tmpl.selected = function () { - R2.get(); // Re-render when R2 is changed, even though it - // doesn't affect HTML. - return ('This is a ' + R.get().x) === this.toString(); - }; + tmpl.helpers({ + options: ['This is a test', 'This is a fridge', + 'This is a frog', 'This is a new frog', 'foobar', + 'This is a photograph', 'This is a monkey', + 'This is a donkey'], + selected: function () { + R2.get(); // Re-render when R2 is changed, even though it + // doesn't affect HTML. + return ('This is a ' + R.get().x) === this.toString(); + } + }); } else if (type === 'textarea') { tmpl = Template.spacebars_test_control_textarea; - tmpl.value = function () { - R2.get(); // Re-render when R2 is changed, even though it - // doesn't affect HTML. - return 'This is a ' + R.get().x; - }; + tmpl.helpers({ + value: function () { + R2.get(); // Re-render when R2 is changed, even though it + // doesn't affect HTML. + return 'This is a ' + R.get().x; + } + }); } else { tmpl = Template.spacebars_test_control_input; - tmpl.value = function () { - R2.get(); // Re-render when R2 is changed, even though it - // doesn't affect HTML. - return 'This is a ' + R.get().x; - }; - tmpl.type = type; + tmpl.helpers({ + value: function () { + R2.get(); // Re-render when R2 is changed, even though it + // doesn't affect HTML. + return 'This is a ' + R.get().x; + }, + type: type + }); }; var div = renderToDiv(tmpl); @@ -1428,13 +1492,15 @@ Tinytest.add("spacebars-tests - template_tests - radio", function(test) { var R2 = ReactiveVar(""); var change_buf = []; var tmpl = Template.spacebars_test_control_radio; - tmpl.bands = ["AM", "FM", "XM"]; - tmpl.isChecked = function () { - return R.get() === this.toString(); - }; - tmpl.band = function () { - return R.get(); - }; + tmpl.helpers({ + bands: ["AM", "FM", "XM"], + isChecked: function () { + return R.get() === this.toString(); + }, + band: function () { + return R.get(); + } + }); tmpl.events({ 'change input': function (event) { var btn = event.target; @@ -1496,14 +1562,17 @@ Tinytest.add("spacebars-tests - template_tests - radio", function(test) { Tinytest.add("spacebars-tests - template_tests - checkbox", function(test) { var tmpl = Template.spacebars_test_control_checkbox; - tmpl.labels = ["Foo", "Bar", "Baz"]; + var labels = ["Foo", "Bar", "Baz"]; var Rs = {}; - _.each(tmpl.labels, function (label) { + _.each(labels, function (label) { Rs[label] = ReactiveVar(false); }); - tmpl.isChecked = function () { - return Rs[this.toString()].get(); - }; + tmpl.helpers({ + labels: labels, + isChecked: function () { + return Rs[this.toString()].get(); + } + }); var changeBuf = []; var div = renderToDiv(tmpl); @@ -1565,13 +1634,14 @@ Tinytest.add('spacebars-tests - template_tests - unfound template', function (te Tinytest.add('spacebars-tests - template_tests - helper passed to #if called exactly once when invalidated', function (test) { var tmpl = Template.spacebars_test_if_helper; + var foo; var count = 0; var d = new Tracker.Dependency; - tmpl.foo = function () { + tmpl.helpers({foo: function () { d.depend(); count++; return foo; - }; + }}); foo = false; var div = renderToDiv(tmpl); @@ -1587,13 +1657,14 @@ Tinytest.add('spacebars-tests - template_tests - helper passed to #if called exa Tinytest.add('spacebars-tests - template_tests - custom block helper functions called exactly once when invalidated', function (test) { var tmpl = Template.spacebars_test_block_helper_function; + var foo; var count = 0; var d = new Tracker.Dependency; - tmpl.foo = function () { + tmpl.helpers({foo: function () { d.depend(); count++; return Template.spacebars_template_test_aaa; - }; + }}); foo = false; renderToDiv(tmpl); @@ -1705,9 +1776,9 @@ Tinytest.add('spacebars-tests - template_tests - no data context is seen as an e var dataInDestroyed = 'UNSET'; var dataInEvent = 'UNSET'; - tmpl.foo = function () { + tmpl.helpers({foo: function () { dataInHelper = this; - }; + }}); tmpl.created = function () { dataInCreated = this.data; }; @@ -1741,7 +1812,7 @@ Tinytest.add('spacebars-tests - template_tests - no data context is seen as an e Tinytest.add('spacebars-tests - template_tests - falsy with', function (test) { var tmpl = Template.spacebars_test_falsy_with; var R = ReactiveVar(null); - tmpl.obj = function () { return R.get(); }; + tmpl.helpers({obj: function () { return R.get(); }}); var div = renderToDiv(tmpl); divRendersTo(test, div, ""); @@ -1763,8 +1834,8 @@ Tinytest.add("spacebars-tests - template_tests - helpers don't leak", function ( // Also test that custom block helpers (implemented as templates) do NOT // interfere with helper lookup in the current template - Template.spacebars_test_helpers_dont_leak2.bonus = - function () { return 'BONUS'; }; + Template.spacebars_test_helpers_dont_leak2.helpers({ + bonus: function () { return 'BONUS'; }}); var div = renderToDiv(tmpl); divRendersTo(test, div, "correct BONUS"); @@ -1852,7 +1923,7 @@ Tinytest.add("spacebars-tests - template_tests - tables", function (test) { divRendersTo(test, div, '
Foo
'); var tmpl2 = Template.spacebars_test_tables2; - tmpl2.foo = 'Foo'; + tmpl2.helpers({foo: 'Foo'}); div = renderToDiv(tmpl2); test.equal(_.pluck(div.querySelectorAll('*'), 'tagName'), ['TABLE', 'TR', 'TD']); @@ -1897,7 +1968,9 @@ Tinytest.add("spacebars-tests - template_tests - toHTML", function (test) { }; R.set(val); - tmplForHelper[helper] = getR; + var helpers = {}; + helpers[helper] = getR; + tmplForHelper.helpers(helpers); test.equal(canonicalizeHtml(Blaze.toHTML(tmplToRender)), "bar"); test.equal(count, 1); R.set(""); @@ -1934,10 +2007,10 @@ Tinytest.add("spacebars-tests - template_tests - {{#with}} with mutated data con var tmpl = Template.spacebars_test_with_mutated_data_context; var foo = {value: 0}; var dep = new Tracker.Dependency; - tmpl.foo = function () { + tmpl.helpers({foo: function () { dep.depend(); return foo; - }; + }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), '0'); @@ -1952,9 +2025,9 @@ Tinytest.add("spacebars-tests - template_tests - javascript scheme urls", function (test) { var tmpl = Template.spacebars_test_url_attribute; var sessionKey = "foo-" + Random.id(); - tmpl.foo = function () { + tmpl.helpers({foo: function () { return Session.get(sessionKey); - }; + }}); var numUrlAttrs = 4; var div = renderToDiv(tmpl); @@ -2024,9 +2097,9 @@ Tinytest.add("spacebars-tests - template_tests - event handlers get cleaned up w var subtmpl = Template.spacebars_test_event_handler_cleanup_sub; var rv = new ReactiveVar(true); - tmpl.foo = function () { + tmpl.helpers({foo: function () { return rv.get(); - }; + }}); subtmpl.events({ "click/mouseover": function () { } @@ -2073,9 +2146,9 @@ Tinytest.add( var coll = new Mongo.Collection(null); var rv = new ReactiveVar; - tmpl.items = function () { + tmpl.helpers({items: function () { return coll.find(); - }; + }}); var div = renderToDiv(tmpl); @@ -2105,9 +2178,9 @@ Tinytest.add( function (test) { var tmpl = Template.spacebars_test_ui_hooks; var rv = new ReactiveVar([]); - tmpl.items = function () { + tmpl.helpers({items: function () { return rv.get(); - }; + }}); var div = renderToDiv(tmpl); @@ -2173,9 +2246,9 @@ Tinytest.add( var tmpl = Template.spacebars_test_ui_hooks_nested; var rv = new ReactiveVar(true); - tmpl.foo = function () { + tmpl.helpers({foo: function () { return rv.get(); - }; + }}); var subtmpl = Template.spacebars_test_ui_hooks_nested_sub; var uiHookCalled = false; @@ -2214,9 +2287,9 @@ Tinytest.add( tmpl.created = function () { this.value = value; }; - tmpl.foo = function () { + tmpl.helpers({foo: function () { instanceFromHelper = Template.instance(); - }; + }}); var div = renderToDiv(tmpl); test.equal(instanceFromHelper.value, value); @@ -2231,9 +2304,9 @@ Tinytest.add( var rv = new ReactiveVar(""); var instanceFromHelper; - tmpl.foo = function () { + tmpl.helpers({foo: function () { return Template.instance().data; - }; + }}); var div = renderToDiv(tmpl, function () { return rv.get(); }); rv.set("first"); @@ -2254,10 +2327,10 @@ Tinytest.add( var tmpl = Template.spacebars_test_with_cleanup; var rv = new ReactiveVar(""); var helperCalled = false; - tmpl.foo = function () { + tmpl.helpers({foo: function () { helperCalled = true; return rv.get(); - }; + }}); var div = renderToDiv(tmpl); rv.set("first"); @@ -2282,16 +2355,17 @@ Tinytest.add( var height = new ReactiveVar(0); var bar = new ReactiveVar("bar"); - childTmpl.a = ["a"]; - childTmpl.b = function () { return bar.get(); }; - childTmpl.c = ["c"]; - - childTmpl.foo = function () { - var a = Template.parentData(height.get()); - var b = UI._parentData(height.get()); // back-compat - test.equal(a, b); - return a; - }; + childTmpl.helpers({ + a: ["a"], + b: function () { return bar.get(); }, + c: ["c"], + foo: function () { + var a = Template.parentData(height.get()); + var b = UI._parentData(height.get()); // back-compat + test.equal(a, b); + return a; + } + }); var div = renderToDiv(parentTmpl); test.equal(canonicalizeHtml(div.innerHTML), "d"); @@ -2348,9 +2422,9 @@ Tinytest.add( var R = ReactiveVar([{_id: 'A'}]); - outerTmpl.items = function () { + outerTmpl.helpers({items: function () { return R.get(); - }; + }}); var div = renderToDiv(outerTmpl); divRendersTo(test, div, '
A
'); @@ -2378,8 +2452,10 @@ Tinytest.add( var R = ReactiveVar('aaa'); var tmpl = Template.spacebars_test_ui_render; - tmpl.greeting = function () { return this.greeting || 'Hello'; }; - tmpl.r = function () { return R.get(); }; + tmpl.helpers({ + greeting: function () { return this.greeting || 'Hello'; }, + r: function () { return R.get(); } + }); tmpl.created = function () { created = true; }; tmpl.rendered = function () { rendered = true; }; tmpl.destroyed = function () { destroyed = true; }; @@ -2450,16 +2526,16 @@ Tinytest.add( var Acalls = ''; var A = ReactiveVar('hi'); - tmpl.A = function (chr) { + tmpl.helpers({A: function (chr) { Acalls += chr; return A.get(); - }; + }}); var Bcalls = 0; var B = ReactiveVar(['one', 'two']); - tmpl.B = function () { + tmpl.helpers({B: function () { Bcalls++; return B.get(); - }; + }}); // Assert how many times A and B were accessed (since last time) // and how many autoruns are listening to them. @@ -2500,9 +2576,9 @@ Tinytest.add( function (test) { var tmpl = Template.spacebars_test_focus_blur_outer; var cond = ReactiveVar(true); - tmpl.cond = function () { + tmpl.helpers({cond: function () { return cond.get(); - }; + }}); var buf = []; Template.spacebars_test_focus_blur_inner.events({ 'focus input': function () { @@ -2577,9 +2653,9 @@ Tinytest.add( function (test) { var tmpl = Template.spacebars_test_event_cleanup_on_destroyed_outer; var cond = ReactiveVar(true); - tmpl.cond = function () { + tmpl.helpers({cond: function () { return cond.get(); - }; + }}); Template.spacebars_test_event_cleanup_on_destroyed_inner.events({ 'click span': function () {}}); @@ -2609,9 +2685,9 @@ _.each([1, 2, 3], function (n) { var tmpl = Template['spacebars_test_isolated_lookup' + n]; var R = ReactiveVar(Template.spacebars_template_test_aaa); - tmpl.bar = function () { + tmpl.helpers({bar: function () { return R.get(); - }; + }}); var div = renderToDiv( tmpl, @@ -2796,7 +2872,7 @@ Tinytest.add( function (test) { var tmpl = Template.spacebars_template_test_input_field_to_same_value; var R = ReactiveVar("BLAH"); - tmpl.foo = function () { return R.get(); }; + tmpl.helpers({foo: function () { return R.get(); }}); var div = renderToDiv(tmpl); document.body.appendChild(div); @@ -2888,9 +2964,9 @@ Tinytest.add("spacebars-tests - template_tests - contentBlock back-compat", func var tmpl = Template.spacebars_template_test_content_backcompat; var R = ReactiveVar(true); - tmpl.flag = function () { + tmpl.helpers({flag: function () { return R.get(); - }; + }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'hello'); R.set(false); @@ -2907,7 +2983,7 @@ Tinytest.add("spacebars-tests - template_tests - contentBlock back-compat", func Tinytest.add("spacebars-tests - template_tests - content context back-compat", function (test) { var tmpl = Template.spacebars_template_test_content_context_backcompat; var R = ReactiveVar(true); - tmpl.foo = { + tmpl.helpers({foo: { firstLetter: 'F', secondLetter: 'O', bar: { @@ -2915,7 +2991,7 @@ Tinytest.add("spacebars-tests - template_tests - content context back-compat", f firstLetter: 'B', secondLetter: 'A' } - }; + }}); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'BO'); @@ -2926,7 +3002,7 @@ Tinytest.add("spacebars-tests - template_tests - content context back-compat", f Tinytest.add("spacebars-tests - template_tests - falsy helper", function (test) { var tmpl = Template.spacebars_template_test_falsy_helper; - tmpl.foo = 0; + tmpl.helpers({foo: 0}); Template.registerHelper('GLOBAL_ZERO', 0); var div = renderToDiv(tmpl); @@ -2935,21 +3011,23 @@ Tinytest.add("spacebars-tests - template_tests - falsy helper", function (test) Tinytest.add("spacebars-tests - template_tests - old-style helpers", function (test) { var tmpl = Template.spacebars_template_test_oldstyle_helpers; + tmpl._NOWARN_OLDSTYLE_HELPERS = true; // Test old-style helper tmpl.foo = 'hello'; var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'hello'); - // Test that replacing a helper still works (we don't cache). + // Test that replacing a helper still works (i.e. we don't cache them). // We can change this behavior if we need to, but it is more breaking - // to do so. + // to do so. It breaks some unit tests, for example. tmpl.foo = 'world'; var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), 'world'); - // Test deleting a helper. As with the previous case, we can - // break this, but we should do it intentionally. + // Test that you can delete an old-style helper with `delete`. + // As with the previous case, we can break this functionality, but + // we should do it intentionally. delete tmpl.foo; var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), ''); diff --git a/packages/spacebars-tests/templating_tests.js b/packages/spacebars-tests/templating_tests.js index a4e07c5a12..a8baddd477 100644 --- a/packages/spacebars-tests/templating_tests.js +++ b/packages/spacebars-tests/templating_tests.js @@ -21,9 +21,11 @@ Tinytest.add("spacebars-tests - templating_tests - assembly", function (test) { // Another production bug -- we must use LiveRange to replace the // placeholder, or risk breaking other LiveRanges Session.set("stuff", true); // XXX bad form to use Session in a test? - Template.test_assembly_b1.stuff = function () { - return Session.get("stuff"); - }; + Template.test_assembly_b1.helpers({ + stuff: function () { + return Session.get("stuff"); + } + }); var onscreen = renderToDiv(Template.test_assembly_b0); test.equal(canonicalizeHtml(onscreen.innerHTML), "xyhi"); Session.set("stuff", false); @@ -71,9 +73,11 @@ Tinytest.add("spacebars-tests - templating_tests - table assembly", function(tes Tinytest.add("spacebars-tests - templating_tests - event handler this", function(test) { - Template.test_event_data_with.ONE = {str: "one"}; - Template.test_event_data_with.TWO = {str: "two"}; - Template.test_event_data_with.THREE = {str: "three"}; + Template.test_event_data_with.helpers({ + ONE: {str: "one"}, + TWO: {str: "two"}, + THREE: {str: "three"} + }); Template.test_event_data_with.events({ 'click': function(event, template) { @@ -84,8 +88,7 @@ Tinytest.add("spacebars-tests - templating_tests - event handler this", function }); var event_buf = []; - var containerDiv = renderToDiv(Template.test_event_data_with, - Template.test_event_data_with.ONE); + var containerDiv = renderToDiv(Template.test_event_data_with, {str: "one"}); var cleanupDiv = addToBody(containerDiv); var divs = containerDiv.getElementsByTagName("div"); @@ -164,12 +167,14 @@ if (document.addEventListener) { Tinytest.add("spacebars-tests - templating_tests - safestring", function(test) { - Template.test_safestring_a.foo = function() { - return "
"; - }; - Template.test_safestring_a.bar = function() { - return new Spacebars.SafeString("
"); - }; + Template.test_safestring_a.helpers({ + foo: function() { + return "
"; + }, + bar: function() { + return new Spacebars.SafeString("
"); + } + }); var obj = {fooprop: "
", barprop: new Spacebars.SafeString("
")}; @@ -223,10 +228,12 @@ Tinytest.add("spacebars-tests - templating_tests - helpers and dots", function(t Template.registerHelper("fancyhelper", getFancyObject); - Template.test_helpers_a.platypus = 'bill'; - Template.test_helpers_a.warthog = function() { - return 'snout'; - }; + Template.test_helpers_a.helpers({ + platypus: 'bill', + warthog: function() { + return 'snout'; + } + }); var listFour = function(a, b, c, d, options) { test.isTrue(options instanceof Spacebars.kw); @@ -331,7 +338,7 @@ Tinytest.add("spacebars-tests - templating_tests - helpers and dots", function(t // test interpretation of arguments - Template.test_helpers_h.helperListFour = listFour; + Template.test_helpers_h.helpers({helperListFour: listFour}); html = canonicalizeHtml( renderToDiv(Template.test_helpers_h, dataObj).innerHTML); @@ -354,10 +361,12 @@ Tinytest.add("spacebars-tests - templating_tests - helpers and dots", function(t Tinytest.add("spacebars-tests - templating_tests - rendered template", function(test) { var R = ReactiveVar('foo'); - Template.test_render_a.foo = function() { - R.get(); - return this.x + 1; - }; + Template.test_render_a.helpers({ + foo: function() { + R.get(); + return this.x + 1; + } + }); var div = renderToDiv(Template.test_render_a, {x: 123}); test.equal($(div).text().match(/\S+/)[0], "124"); @@ -382,10 +391,10 @@ Tinytest.add("spacebars-tests - templating_tests - rendered template", function( R = ReactiveVar('foo'); - Template.test_render_b.foo = function() { + Template.test_render_b.helpers({foo: function() { R.get(); return (+this) + 1; - }; + }}); div = renderToDiv(Template.test_render_b, {x: 123}); test.equal($(div).text().match(/\S+/)[0], "201"); @@ -459,6 +468,7 @@ Tinytest.add("spacebars-tests - templating_tests - template arg", function (test Tinytest.add("spacebars-tests - templating_tests - helpers", function (test) { var tmpl = Template.test_template_helpers_a; + tmpl._NOWARN_OLDSTYLE_HELPERS = true; tmpl.foo = 'z'; tmpl.helpers({bar: 'b'}); // helpers(...) takes precendence of assigned helper @@ -582,7 +592,8 @@ Tinytest.add('spacebars-tests - templating_tests - helper typecast Issue #617', Tinytest.add('spacebars-tests - templating_tests - each falsy Issue #801', function (test) { //Minor test for issue #801 (#each over array containing nulls) - Template.test_template_issue801.values = function() { return [0,1,2,null,undefined,false]; }; + Template.test_template_issue801.helpers({ + values: function() { return [0,1,2,null,undefined,false]; }}); var div = renderToDiv(Template.test_template_issue801); test.equal(canonicalizeHtml(div.innerHTML), "012"); }); diff --git a/packages/templating/templating.js b/packages/templating/templating.js index 00b0fc88d7..e9de901ef2 100644 --- a/packages/templating/templating.js +++ b/packages/templating/templating.js @@ -21,6 +21,12 @@ Template.__checkName = function (name) { Template.__define__ = function (name, renderFunc) { Template.__checkName(name); Template[name] = new Template("Template." + name, renderFunc); + // Exempt packages built pre-0.9.0 from warnings about using old + // helper syntax, because we can. It's not very useful to get a + // warning about someone else's code (like a package on Atmosphere), + // and this should at least put a bit of a dent in number of warnings + // that come from packages that haven't been updated lately. + Template[name]._NOWARN_OLDSTYLE_HELPERS = true; }; // Define a template `Template.body` that renders its From 170d0bc3bd2071527b7e33248a49cd12b7bc2cfe Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Wed, 24 Sep 2014 22:18:57 -0700 Subject: [PATCH 34/82] Port more helpers to the preferred syntax --- .../login_buttons_dialogs.js | 79 ++++++++++--------- packages/spacebars/dynamic.js | 39 ++++----- packages/spacebars/dynamic_tests.js | 68 +++++++++------- 3 files changed, 103 insertions(+), 83 deletions(-) diff --git a/packages/accounts-ui-unstyled/login_buttons_dialogs.js b/packages/accounts-ui-unstyled/login_buttons_dialogs.js index 893a1290ce..b51dd58e5a 100644 --- a/packages/accounts-ui-unstyled/login_buttons_dialogs.js +++ b/packages/accounts-ui-unstyled/login_buttons_dialogs.js @@ -69,9 +69,11 @@ var resetPassword = function () { }); }; -Template._resetPasswordDialog.inResetPasswordFlow = function () { - return loginButtonsSession.get('resetPasswordToken'); -}; +Template._resetPasswordDialog.helpers({ + inResetPasswordFlow: function () { + return loginButtonsSession.get('resetPasswordToken'); + } +}); // // justResetPasswordDialog template @@ -83,11 +85,12 @@ Template._justResetPasswordDialog.events({ } }); -Template._justResetPasswordDialog.visible = function () { - return loginButtonsSession.get('justResetPassword'); -}; - -Template._justResetPasswordDialog.displayName = displayName; +Template._justResetPasswordDialog.helpers({ + visible: function () { + return loginButtonsSession.get('justResetPassword'); + }, + displayName: displayName +}); @@ -127,9 +130,11 @@ var enrollAccount = function () { }); }; -Template._enrollAccountDialog.inEnrollAccountFlow = function () { - return loginButtonsSession.get('enrollAccountToken'); -}; +Template._enrollAccountDialog.helpers({ + inEnrollAccountFlow: function () { + return loginButtonsSession.get('enrollAccountToken'); + } +}); // @@ -142,11 +147,12 @@ Template._justVerifiedEmailDialog.events({ } }); -Template._justVerifiedEmailDialog.visible = function () { - return loginButtonsSession.get('justVerifiedEmail'); -}; - -Template._justVerifiedEmailDialog.displayName = displayName; +Template._justVerifiedEmailDialog.helpers({ + visible: function () { + return loginButtonsSession.get('justVerifiedEmail'); + }, + displayName: displayName +}); // @@ -159,10 +165,12 @@ Template._loginButtonsMessagesDialog.events({ } }); -Template._loginButtonsMessagesDialog.visible = function () { - var hasMessage = loginButtonsSession.get('infoMessage') || loginButtonsSession.get('errorMessage'); - return !dropdown() && hasMessage; -}; +Template._loginButtonsMessagesDialog.helpers({ + visible: function () { + var hasMessage = loginButtonsSession.get('infoMessage') || loginButtonsSession.get('errorMessage'); + return !dropdown() && hasMessage; + } +}); // @@ -245,22 +253,21 @@ var configurationFields = function () { return template.fields(); }; -Template._configureLoginServiceDialog.configurationFields = function () { - return configurationFields(); -}; - -Template._configureLoginServiceDialog.visible = function () { - return loginButtonsSession.get('configureLoginServiceDialogVisible'); -}; - -Template._configureLoginServiceDialog.configurationSteps = function () { - // renders the appropriate template - return configureLoginServiceDialogTemplateForService(); -}; - -Template._configureLoginServiceDialog.saveDisabled = function () { - return loginButtonsSession.get('configureLoginServiceDialogSaveDisabled'); -}; +Template._configureLoginServiceDialog.helpers({ + configurationFields: function () { + return configurationFields(); + }, + visible: function () { + return loginButtonsSession.get('configureLoginServiceDialogVisible'); + }, + configurationSteps: function () { + // renders the appropriate template + return configureLoginServiceDialogTemplateForService(); + }, + saveDisabled: function () { + return loginButtonsSession.get('configureLoginServiceDialogSaveDisabled'); + } +}); // XXX from http://epeli.github.com/underscore.string/lib/underscore.string.js var capitalize = function(str){ diff --git a/packages/spacebars/dynamic.js b/packages/spacebars/dynamic.js index 14089df763..eeb4560126 100644 --- a/packages/spacebars/dynamic.js +++ b/packages/spacebars/dynamic.js @@ -8,24 +8,27 @@ * @param {Object} [data] Optional. The data context in which to include the template. */ -Template.__dynamicWithDataContext.chooseTemplate = function (name) { - return Template[name] || null; -}; - -Template.__dynamic.dataContextPresent = function () { - return _.has(this, "data"); -}; - -Template.__dynamic.checkContext = function () { - if (! _.has(this, "template")) { - throw new Error("Must specify name in the 'template' argument " + - "to {{> Template.dynamic}}."); +Template.__dynamicWithDataContext.helpers({ + chooseTemplate: function (name) { + return Template[name] || null; } +}); - _.each(this, function (v, k) { - if (k !== "template" && k !== "data") { - throw new Error("Invalid argument to {{> Template.dynamic}}: " + - k); +Template.__dynamic.helpers({ + dataContextPresent: function () { + return _.has(this, "data"); + }, + checkContext: function () { + if (! _.has(this, "template")) { + throw new Error("Must specify name in the 'template' argument " + + "to {{> Template.dynamic}}."); } - }); -}; + + _.each(this, function (v, k) { + if (k !== "template" && k !== "data") { + throw new Error("Invalid argument to {{> Template.dynamic}}: " + + k); + } + }); + } +}); diff --git a/packages/spacebars/dynamic_tests.js b/packages/spacebars/dynamic_tests.js index bfacd10e35..415f0f332c 100644 --- a/packages/spacebars/dynamic_tests.js +++ b/packages/spacebars/dynamic_tests.js @@ -4,12 +4,14 @@ Tinytest.add( var nameVar = new ReactiveVar; var dataVar = new ReactiveVar; - tmpl.templateName = function () { - return nameVar.get(); - }; - tmpl.templateData = function () { - return dataVar.get(); - }; + tmpl.helpers({ + templateName: function () { + return nameVar.get(); + }, + templateData: function () { + return dataVar.get(); + } + }); // No template chosen var div = renderToDiv(tmpl); @@ -35,9 +37,11 @@ Tinytest.add( var tmpl = Template.ui_dynamic_test_no_data; var nameVar = new ReactiveVar; - tmpl.templateName = function () { - return nameVar.get(); - }; + tmpl.helpers({ + templateName: function () { + return nameVar.get(); + } + }); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), ""); @@ -56,12 +60,14 @@ Tinytest.add( var nameVar = new ReactiveVar(); var dataVar = new ReactiveVar(); - tmpl.templateName = function () { - return nameVar.get(); - }; - tmpl.context = function () { - return dataVar.get(); - }; + tmpl.helpers({ + templateName: function () { + return nameVar.get(); + }, + context: function () { + return dataVar.get(); + } + }); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), ""); @@ -88,12 +94,14 @@ Tinytest.add( var nameVar = new ReactiveVar(); var dataVar = new ReactiveVar(); - tmpl.templateName = function () { - return nameVar.get(); - }; - tmpl.context = function () { - return dataVar.get(); - }; + tmpl.helpers({ + templateName: function () { + return nameVar.get(); + }, + context: function () { + return dataVar.get(); + } + }); var div = renderToDiv(tmpl); test.equal(canonicalizeHtml(div.innerHTML), ""); @@ -135,9 +143,9 @@ Tinytest.add( var subtmpl = Template.ui_dynamic_test_falsey_context_sub; var subtmplContext; - subtmpl.foo = function () { + subtmpl.helpers({foo: function () { subtmplContext = this; - }; + }}); var div = renderToDiv(tmpl); // Because `this` can only be an object, Blaze normalizes falsey @@ -152,12 +160,14 @@ Tinytest.add( var nameVar = new ReactiveVar; var dataVar = new ReactiveVar; - tmpl.templateName = function () { - return nameVar.get(); - }; - tmpl.templateData = function () { - return dataVar.get(); - }; + tmpl.helpers({ + templateName: function () { + return nameVar.get(); + }, + templateData: function () { + return dataVar.get(); + } + }); // No template chosen var div = renderToDiv(tmpl); From 58c110499ec176cb3a83dae5bbc3b153598608be Mon Sep 17 00:00:00 2001 From: ekatek Date: Wed, 24 Sep 2014 22:35:05 -0700 Subject: [PATCH 35/82] fix the test for updating RCs and make list tell you about new rcs sometimes 1. Fixes the test for updating to a new rc. First, change the ordering -- since we order RCs now, it means that if you add rc.3 while rc.4 is available it just adds rc.4. So, now, we publish rc.4 after rc.3 has been added, run update (with the right options) and check that it worked. 2. When you run list, we check if there are newer versions of packages. Usually we just look at mainline versions. But if you are already using an rc version of a package, you might care about new rcs too. So, in that case, we check the latest of *all* available versions. --- tools/commands-packages.js | 11 ++++++++++- tools/tests/publish.js | 33 +++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/tools/commands-packages.js b/tools/commands-packages.js index bbd1b1593b..0a5c4f5035 100644 --- a/tools/commands-packages.js +++ b/tools/commands-packages.js @@ -1321,7 +1321,16 @@ main.registerCommand({ } var versionAddendum = "" ; - var latest = catalog.complete.getLatestMainlineVersion(name, version); + // If we are not using an rc for this package, then we are not going to + // update to an rc. But if we are using a pre-release version, then we + // care about other pre-release versions, and might want to update to a + // newer one. + var latest; + if (!/-/.test(version)) { + latest = catalog.complete.getLatestMainlineVersion(name, version); + } else { + latest = catalog.complete.getLatestVersion(name, version); + } var packageVersionParser = require('./package-version-parser.js'); if (latest && version !== latest.version && diff --git a/tools/tests/publish.js b/tools/tests/publish.js index 110d9a000d..dfe890dd36 100644 --- a/tools/tests/publish.js +++ b/tools/tests/publish.js @@ -284,7 +284,7 @@ selftest.define("do-not-update-to-rcs", // Publish the first version. s.cd(fullPackageName, function () { run = s.run("publish", "--create"); - run.waitSecs(15); + run.waitSecs(30); run.expectExit(0); run.match("Done"); }); @@ -307,15 +307,6 @@ selftest.define("do-not-update-to-rcs", run.match("Done"); }); - // Now publish an 1.0.4-rc.4. - s.cp(fullPackageName+'/packagerc2.js', fullPackageName+'/package.js'); - s.cd(fullPackageName, function () { - run = s.run("publish"); - run.waitSecs(15); - run.expectExit(0); - run.match("Done"); - }); - // Create an app. Add the package to it. Check that list shows the package, at // the non-rc version. run = s.run('create', 'mapp'); @@ -367,11 +358,29 @@ selftest.define("do-not-update-to-rcs", run = s.run("list"); run.waitSecs(10); run.match(fullPackageName); + run.match("1.0.4-rc.3"); // We got the rc version. + }); + + // Now publish an 1.0.4-rc.4. + s.cp(fullPackageName+'/packagerc2.js', fullPackageName+'/package.js'); + s.cd(fullPackageName, function () { + run = s.run("publish"); + run.waitSecs(15); + run.expectExit(0); + run.match("Done"); + }); + + s.cd('mapp', function () { + // If we run list, we see that we might want to upgrade. + run = s.run("list"); + run.waitSecs(10); + run.match(fullPackageName); run.match("1.0.4-rc.3"); - // run.match("New versions"); + run.match("New versions"); run.expectExit(0); - run = s.run("update", "packages-only"); + // And if we run update, we will get the new rc. + run = s.run("update", "--packages-only"); run.waitSecs(10); run.match("1.0.4-rc.4"); run.expectExit(0); From 8fe23b418b3c3cad690ea3171bb64a8fac711576 Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Wed, 24 Sep 2014 23:19:59 -0700 Subject: [PATCH 36/82] Ignore packages with malformed versions or malformed constraints This allows us to later increase the pool for well-formed versions without requiring moving the catalog's data.json into a new folder, which would require re-syncing the entire catalog. --- .../constraint-solver-tests.js | 21 ------------ .../package-version-parser-tests.js | 11 +++++++ tools/catalog-base.js | 24 ++++++++++++-- tools/package-version-parser.js | 8 +++++ tools/tests/package-tests.js | 33 ++++++++++++++----- 5 files changed, 65 insertions(+), 32 deletions(-) diff --git a/packages/constraint-solver/constraint-solver-tests.js b/packages/constraint-solver/constraint-solver-tests.js index 3acc7097a3..f36f118bd7 100644 --- a/packages/constraint-solver/constraint-solver-tests.js +++ b/packages/constraint-solver/constraint-solver-tests.js @@ -311,27 +311,6 @@ Tinytest.add("constraint solver - no constraint dependency - anything", function test.isTrue(_.isString(versions.sparkle)); }); -Tinytest.add("constraint solver - ignore malformed version strings", function (test) { - var resolver = makeResolver([ - ["foo", "1.2.3", "1.2.3"], - ["foo", "1.2.3!bang@at#hash%invalid", "1.2.3!bang@at#hash%invalid"], - ["bar", "1.2.3", "1.2.3", {"foo": "1.2.3"}], - ["bar", "1.2.4", "1.2.4", {"foo": "1.2.3!bang@at#hash%invalid"}] - ]); - - testWithResolver(test, resolver, function (t, FAIL) { - FAIL({ "bar": "1.2.4" }, /not satisfied/); - - // Since we can't parse versions or dependencies of - // foo@1.2.3!band@at#hash%invalid or bar@1.2.4, ignore them when - // finding the right versions to use. - t({ "bar": "1.2.3"}, { - "bar": "1.2.3", - "foo": "1.2.3" - }, { _testing: true }); - }); -}); - Tinytest.add("constraint solver - no constraint dependency - transitive dep still picked right", function (test) { var versions = defaultResolver.resolve( ["sparkle", "sparky-forms"], diff --git a/packages/package-version-parser/package-version-parser-tests.js b/packages/package-version-parser/package-version-parser-tests.js index b934f88b9c..761a7a6851 100644 --- a/packages/package-version-parser/package-version-parser-tests.js +++ b/packages/package-version-parser/package-version-parser-tests.js @@ -14,6 +14,17 @@ var FAIL = function (versionString) { }); }; +Tinytest.add("Smart Package version string parsing - isValidVersion", function (test) { + var validVersions = ["0.1.1", "1.0.0_2", "2.0.0-pre.2", "2.0.1-pre.2_50"]; + var invalidVersions = ["0.1.1!", "1.0.0~2", "3.2.0.0", "=2.0.1"]; + _.each(validVersions, function (v) { + test.isTrue(PackageVersion.isValidVersion(v)); + }); + _.each(invalidVersions, function (v) { + test.isFalse(PackageVersion.isValidVersion(v)); + }); +}); + Tinytest.add("Smart Package version string parsing - old format", function (test) { currentTest = test; diff --git a/tools/catalog-base.js b/tools/catalog-base.js index 5f9be61d4a..7193908948 100644 --- a/tools/catalog-base.js +++ b/tools/catalog-base.js @@ -152,9 +152,27 @@ _.extend(baseCatalog.BaseCatalog.prototype, { if (!_.has(self.versions, name)) { return []; } - var ret = _.keys(self.versions[name]); - ret.sort(packageVersionParser.compare); - return ret; + + var validVersions = []; + + // filter out any package with a malformed version, or with any + // dependencies that have malformed versions. + _.each(self.versions[name], function (entry, version) { + if (! packageVersionParser.isValidVersion(version)) + return; + + if (! _.all(entry.dependencies, function (dependency, packageName) { + return !dependency.constraint || + packageVersionParser.isValidVersion(dependency.constraint); + })) { + return; + } + + validVersions.push(version); + }); + + + return validVersions.sort(packageVersionParser.compare); }, // Return information about a particular version of a package, or diff --git a/tools/package-version-parser.js b/tools/package-version-parser.js index 0374c4d9a8..96ef73ff42 100644 --- a/tools/package-version-parser.js +++ b/tools/package-version-parser.js @@ -82,6 +82,14 @@ PV.versionMagnitude = function (versionString) { prereleaseIdentifierToFraction(v.prerelease) / 100 / 100; }; +PV.isValidVersion = function (versionString) { + try { + return semver.valid(extractSemverPart(versionString).semver); + } catch (e) { + return false; + } +}; + // Accepts an array, eg ["rc", 2, 3]. Returns a number in the range // (-1, 0]. An empty array returns 0. A non-empty string returns a // number that is "as large" as the its precedence. diff --git a/tools/tests/package-tests.js b/tools/tests/package-tests.js index cc67e19448..bd339ff6c2 100644 --- a/tools/tests/package-tests.js +++ b/tools/tests/package-tests.js @@ -778,6 +778,14 @@ selftest.define("malformed package names", [], function () { }); data.collections.versions = data.collections.versions || []; + data.collections.versions.push({ + "packageName": "bar", + "version": "1.2.3", + "earliestCompatibleVersion": "1.2.3", + "containsPlugins": false, + "description": "...", + "dependencies": {} + }); data.collections.versions.push({ "packageName": "bar", "version": "1.2.4", @@ -786,14 +794,14 @@ selftest.define("malformed package names", [], function () { "description": "...", "dependencies": { "foo": { - "constraint": "1.2.3!bang@at#hash%invalid", + "constraint": "1.2.3!bang:colon#hash%invalid", "references": [{"arch": "os"}] } } }); data.collections.versions.push({ "packageName": "foo", - "version": "1.2.3!bang@at#hash%invalid", + "version": "1.2.3!bang:colon#hash%invalid", "earliestCompatibleVersion": "1.2.3", "containsPlugins": false, "description": "...", @@ -803,21 +811,30 @@ selftest.define("malformed package names", [], function () { fs.writeFileSync(dataFile, JSON.stringify(data)); run = s.run("search", "foo"); - run.match(/Neither packages nor releases .* could be found/); + run.matchErr(/Neither packages nor releases .* could be found/); run.expectExit(0); - var run = s.run("search", "bar"); - run.match(/Neither packages nor releases .* could be found/); + run = s.run("show", "bar"); + run.match("1.2.3"); + run.forbidAll("1.2.4"); run.expectExit(0); - var run = s.run("create", "myapp"); + run = s.run("create", "myapp"); run.expectExit(0); s.cd("myapp"); run = s.run("add", "foo"); - run.matchErr("foo: no such package"); + run.matchErr("unknown package: foo"); run.expectExit(1); + run = s.run("add", "bar"); - run.matchErr("bar: no such package"); + // If we get the following error, that means we successfully decided + // to try to add bar@1.2.3, but couldn't because (as expected) there + // is no build for this release in the catalog. + run.matchErr("Package bar has no compatible build for version 1.2.3"); + run.expectExit(1); + + run = s.run("add", "bar@1.2.4"); + run.matchErr("constraints on bar cannot be satisfied"); run.expectExit(1); }); From 64b0ea4f5b7bc42d13229d98ff3b571ab7dc305b Mon Sep 17 00:00:00 2001 From: ekatek Date: Wed, 24 Sep 2014 23:41:17 -0700 Subject: [PATCH 37/82] increment package numbers --- packages/constraint-solver/package.js | 2 +- packages/meteor-tool/package.js | 2 +- packages/meteor/package.js | 2 +- packages/package-version-parser/package.js | 2 +- packages/templating/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 2 +- tools/commands-packages.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/constraint-solver/package.js b/packages/constraint-solver/package.js index 253deae5a5..5d996628ea 100644 --- a/packages/constraint-solver/package.js +++ b/packages/constraint-solver/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Given the set of the constraints, picks a satisfying configuration", - version: "1.0.14-rc0" + version: "1.0.14-rc1" }); Npm.depends({ diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index 201290d9d0..e99fa7accd 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.0.31-rc6' + version: '1.0.31-rc7' }); Package.includeTool(); diff --git a/packages/meteor/package.js b/packages/meteor/package.js index 685d9b5f85..90a241369e 100644 --- a/packages/meteor/package.js +++ b/packages/meteor/package.js @@ -2,7 +2,7 @@ Package.describe({ summary: "Core Meteor environment", - version: '1.1.1-rc0' + version: '1.1.1-rc.1' }); Package._transitional_registerBuildPlugin({ diff --git a/packages/package-version-parser/package.js b/packages/package-version-parser/package.js index d1db356c8f..364fe328a0 100644 --- a/packages/package-version-parser/package.js +++ b/packages/package-version-parser/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Parses Meteor Smart Package version string", - version: "2.0.0-rc1" + version: "2.0.0-rc.2" }); Npm.depends({ diff --git a/packages/templating/package.js b/packages/templating/package.js index 4c07dead4b..5c1511823e 100644 --- a/packages/templating/package.js +++ b/packages/templating/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Allows templates to be defined in .html files", - version: '1.0.7-rc0' + version: '1.0.7-rc.1' }); // Today, this package is closely intertwined with Handlebars, meaning diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index 5876b9643b..68bf591a05 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "0.9.3-rc6", + "version": "0.9.3-rc7", "recommended": false, "official": false, "description": "A release candidate of Meteor 0.9.3." diff --git a/tools/commands-packages.js b/tools/commands-packages.js index 0a5c4f5035..91fe601e0a 100644 --- a/tools/commands-packages.js +++ b/tools/commands-packages.js @@ -1053,7 +1053,7 @@ main.registerCommand({ return _.extend({ buildArchitectures: myStringBuilds }, versionRecord); }; - // XXX should this skip pre-releases? + // XXX should this skip pre-releases? No, it should. var versions = catalog.official.getSortedVersions(name); if (full.length > 1) { versions = [full[1]]; From 7283735d00efcae5b127dd77df7cc8c0333513c6 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Thu, 25 Sep 2014 00:26:08 -0700 Subject: [PATCH 38/82] One more contributor for the History. --- History.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/History.md b/History.md index bcff9707f9..4a20621d8b 100644 --- a/History.md +++ b/History.md @@ -55,7 +55,7 @@ will not be able to use versions of packages that use the new features. enable data peristance during hot code push. -Patches by Github users meonkeys, mitar, mizzao, mquandalle, prapicault, waitingkuo, wulfmeister +Patches by Github users evliu, meonkeys, mitar, mizzao, mquandalle, prapicault, waitingkuo, wulfmeister From 32f6edc624dc9687b3b4e42567e9624b262dee74 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Thu, 25 Sep 2014 11:02:34 -0700 Subject: [PATCH 39/82] Deprecate amplify,backbone,bootstrap,d3 packages/deprecated/README: ``` These packages are no longer actively maintained by MDG. Seek community alternatives instead. Note that these packages still exist in atmosphere, and you can still build a package that depends on one of them by specifying an explicit package version. ``` Nothing technically prevents us from publishing further versions of these packages (like the ones in packages/non-core). --- docs/client/docs.js | 4 ---- docs/client/packages.html | 4 ---- docs/client/packages/amplify.html | 14 -------------- docs/client/packages/backbone.html | 11 ----------- docs/client/packages/bootstrap.html | 13 ------------- docs/client/packages/d3.html | 17 ----------------- packages/deprecated/README | 6 ++++++ packages/{ => deprecated}/amplify/.gitignore | 0 packages/{ => deprecated}/amplify/amplify.js | 0 packages/{ => deprecated}/amplify/package.js | 0 packages/{ => deprecated}/backbone/.gitignore | 0 packages/{ => deprecated}/backbone/backbone.js | 0 packages/{ => deprecated}/backbone/package.js | 0 packages/{ => deprecated}/bootstrap/.gitignore | 0 .../bootstrap/css/bootstrap-override.css | 0 .../bootstrap/css/bootstrap-responsive.css | 0 .../bootstrap/css/bootstrap.css | 0 .../img/glyphicons-halflings-white.png | Bin .../bootstrap/img/glyphicons-halflings.png | Bin .../{ => deprecated}/bootstrap/js/bootstrap.js | 0 packages/{ => deprecated}/bootstrap/package.js | 0 packages/{ => deprecated}/d3/.gitignore | 0 packages/{ => deprecated}/d3/d3.v3.js | 0 packages/{ => deprecated}/d3/package.js | 0 24 files changed, 6 insertions(+), 63 deletions(-) delete mode 100644 docs/client/packages/amplify.html delete mode 100644 docs/client/packages/backbone.html delete mode 100644 docs/client/packages/bootstrap.html delete mode 100644 docs/client/packages/d3.html create mode 100644 packages/deprecated/README rename packages/{ => deprecated}/amplify/.gitignore (100%) rename packages/{ => deprecated}/amplify/amplify.js (100%) rename packages/{ => deprecated}/amplify/package.js (100%) rename packages/{ => deprecated}/backbone/.gitignore (100%) rename packages/{ => deprecated}/backbone/backbone.js (100%) rename packages/{ => deprecated}/backbone/package.js (100%) rename packages/{ => deprecated}/bootstrap/.gitignore (100%) rename packages/{ => deprecated}/bootstrap/css/bootstrap-override.css (100%) rename packages/{ => deprecated}/bootstrap/css/bootstrap-responsive.css (100%) rename packages/{ => deprecated}/bootstrap/css/bootstrap.css (100%) rename packages/{ => deprecated}/bootstrap/img/glyphicons-halflings-white.png (100%) rename packages/{ => deprecated}/bootstrap/img/glyphicons-halflings.png (100%) rename packages/{ => deprecated}/bootstrap/js/bootstrap.js (100%) rename packages/{ => deprecated}/bootstrap/package.js (100%) rename packages/{ => deprecated}/d3/.gitignore (100%) rename packages/{ => deprecated}/d3/d3.v3.js (100%) rename packages/{ => deprecated}/d3/package.js (100%) diff --git a/docs/client/docs.js b/docs/client/docs.js index 9f3008c3bd..7889cb8b48 100644 --- a/docs/client/docs.js +++ b/docs/client/docs.js @@ -391,14 +391,10 @@ var toc = [ "Packages", [ [ "accounts-ui", - "amplify", "appcache", "audit-argument-checks", - "backbone", - "bootstrap", "browser-policy", "coffeescript", - "d3", "fastclick", "force-ssl", "jquery", diff --git a/docs/client/packages.html b/docs/client/packages.html index 71ed5b363b..d79071ccf1 100644 --- a/docs/client/packages.html +++ b/docs/client/packages.html @@ -19,14 +19,10 @@ and removed with: Meteor Development Group maintains the following packages: {{> pkg_accounts_ui}} -{{> pkg_amplify}} {{> pkg_appcache}} {{> pkg_audit_argument_checks}} -{{> pkg_backbone}} -{{> pkg_bootstrap}} {{> pkg_browser_policy}} {{> pkg_coffeescript}} -{{> pkg_d3}} {{> pkg_fastclick}} {{> pkg_force_ssl}} {{> pkg_jquery}} diff --git a/docs/client/packages/amplify.html b/docs/client/packages/amplify.html deleted file mode 100644 index 9e6e414c7c..0000000000 --- a/docs/client/packages/amplify.html +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/docs/client/packages/backbone.html b/docs/client/packages/backbone.html deleted file mode 100644 index 52397a2808..0000000000 --- a/docs/client/packages/backbone.html +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/docs/client/packages/bootstrap.html b/docs/client/packages/bootstrap.html deleted file mode 100644 index 1d813fdbdb..0000000000 --- a/docs/client/packages/bootstrap.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/docs/client/packages/d3.html b/docs/client/packages/d3.html deleted file mode 100644 index ca999a697d..0000000000 --- a/docs/client/packages/d3.html +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/packages/deprecated/README b/packages/deprecated/README new file mode 100644 index 0000000000..92ec8f49b9 --- /dev/null +++ b/packages/deprecated/README @@ -0,0 +1,6 @@ +These packages are no longer actively maintained by MDG. Seek +community alternatives instead. + +Note that these packages still exist in atmosphere, and you can still +build a package that depends on one of them by specifying an explicit +package version. diff --git a/packages/amplify/.gitignore b/packages/deprecated/amplify/.gitignore similarity index 100% rename from packages/amplify/.gitignore rename to packages/deprecated/amplify/.gitignore diff --git a/packages/amplify/amplify.js b/packages/deprecated/amplify/amplify.js similarity index 100% rename from packages/amplify/amplify.js rename to packages/deprecated/amplify/amplify.js diff --git a/packages/amplify/package.js b/packages/deprecated/amplify/package.js similarity index 100% rename from packages/amplify/package.js rename to packages/deprecated/amplify/package.js diff --git a/packages/backbone/.gitignore b/packages/deprecated/backbone/.gitignore similarity index 100% rename from packages/backbone/.gitignore rename to packages/deprecated/backbone/.gitignore diff --git a/packages/backbone/backbone.js b/packages/deprecated/backbone/backbone.js similarity index 100% rename from packages/backbone/backbone.js rename to packages/deprecated/backbone/backbone.js diff --git a/packages/backbone/package.js b/packages/deprecated/backbone/package.js similarity index 100% rename from packages/backbone/package.js rename to packages/deprecated/backbone/package.js diff --git a/packages/bootstrap/.gitignore b/packages/deprecated/bootstrap/.gitignore similarity index 100% rename from packages/bootstrap/.gitignore rename to packages/deprecated/bootstrap/.gitignore diff --git a/packages/bootstrap/css/bootstrap-override.css b/packages/deprecated/bootstrap/css/bootstrap-override.css similarity index 100% rename from packages/bootstrap/css/bootstrap-override.css rename to packages/deprecated/bootstrap/css/bootstrap-override.css diff --git a/packages/bootstrap/css/bootstrap-responsive.css b/packages/deprecated/bootstrap/css/bootstrap-responsive.css similarity index 100% rename from packages/bootstrap/css/bootstrap-responsive.css rename to packages/deprecated/bootstrap/css/bootstrap-responsive.css diff --git a/packages/bootstrap/css/bootstrap.css b/packages/deprecated/bootstrap/css/bootstrap.css similarity index 100% rename from packages/bootstrap/css/bootstrap.css rename to packages/deprecated/bootstrap/css/bootstrap.css diff --git a/packages/bootstrap/img/glyphicons-halflings-white.png b/packages/deprecated/bootstrap/img/glyphicons-halflings-white.png similarity index 100% rename from packages/bootstrap/img/glyphicons-halflings-white.png rename to packages/deprecated/bootstrap/img/glyphicons-halflings-white.png diff --git a/packages/bootstrap/img/glyphicons-halflings.png b/packages/deprecated/bootstrap/img/glyphicons-halflings.png similarity index 100% rename from packages/bootstrap/img/glyphicons-halflings.png rename to packages/deprecated/bootstrap/img/glyphicons-halflings.png diff --git a/packages/bootstrap/js/bootstrap.js b/packages/deprecated/bootstrap/js/bootstrap.js similarity index 100% rename from packages/bootstrap/js/bootstrap.js rename to packages/deprecated/bootstrap/js/bootstrap.js diff --git a/packages/bootstrap/package.js b/packages/deprecated/bootstrap/package.js similarity index 100% rename from packages/bootstrap/package.js rename to packages/deprecated/bootstrap/package.js diff --git a/packages/d3/.gitignore b/packages/deprecated/d3/.gitignore similarity index 100% rename from packages/d3/.gitignore rename to packages/deprecated/d3/.gitignore diff --git a/packages/d3/d3.v3.js b/packages/deprecated/d3/d3.v3.js similarity index 100% rename from packages/d3/d3.v3.js rename to packages/deprecated/d3/d3.v3.js diff --git a/packages/d3/package.js b/packages/deprecated/d3/package.js similarity index 100% rename from packages/d3/package.js rename to packages/deprecated/d3/package.js From 020e1680f72e4d3ac6e73997d1a1a7f0d3719603 Mon Sep 17 00:00:00 2001 From: Emily Stark Date: Thu, 25 Sep 2014 11:30:00 -0700 Subject: [PATCH 40/82] fix History.md typos --- History.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/History.md b/History.md index 4a20621d8b..8996702818 100644 --- a/History.md +++ b/History.md @@ -2,20 +2,20 @@ ## v0.9.3 -### More Package Version Number Flexability +### More Package Version Number Flexibility -* Packages now support for relying on multiple major versions of their - dependancies (eg `blaze@1.0.0 || 2.0.0`). Additionally, you can now +* Packages now support relying on multiple major versions of their + dependencies (eg `blaze@1.0.0 || 2.0.0`). Additionally, you can now call `api.versionsFrom()` multiple times, or with an array (eg `api.versionsFrom([, ])`. Meteor will interpret this to mean that the package will work with packages from all the listed releases. -* Support for "wrapped package" version numbers. There is now `_` field - in version number. The `_` field must be integer, and versions with +* Support for "wrapped package" version numbers. There is now a `_` field + in version numbers. The `_` field must be an integer, and versions with the `_` are sorted after versions without. This allows using the upstream version number as the Meteor package version number and being - able to publish multiple version of the Meteor package (eg + able to publish multiple version of the Meteor package (e.g. `jquery@1.11.1_2`). Note: packages using the `||` operator or the `_` symbol in their @@ -24,19 +24,19 @@ versions 0.9.2 and before do not understand the new version formats and will not be able to use versions of packages that use the new features. -### Other Command-line tool improvments +### Other Command-line Tool Improvements * More detailed constraint solver output. Meteor now tells you which constraints prevent upgrading or adding new packages. This will make it much easier to update your app to new versions. -* Better handling of pre-release versions (eg versions with +* Better handling of pre-release versions (e.g. versions with `-`). Pre-release packages will now be included in an app if and only if there is no way to meet the app's constraints without using a pre-release package. * Add `meteor admin set-unmigrated` to allow maintainers to hide - pre-0.9.0 packages in `meteor search` & `meteor show`. This will not + pre-0.9.0 packages in `meteor search` and `meteor show`. This will not stop users from continuing to use the package, but it helps prevent new users from finding old non-functional packages. @@ -52,10 +52,11 @@ will not be able to use versions of packages that use the new features. https://docs.meteor.com/#meteor_wrapasync. * The `reactive-dict` package now allows an optional name argument to - enable data peristance during hot code push. + enable data persistence during hot code push. -Patches by Github users evliu, meonkeys, mitar, mizzao, mquandalle, prapicault, waitingkuo, wulfmeister +Patches by Github users evliu, meonkeys, mitar, mizzao, mquandalle, +prapicault, waitingkuo, wulfmeister. From 1db094b411c0de5a80d8cf1082dac5fe9ec26273 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Thu, 25 Sep 2014 11:41:56 -0700 Subject: [PATCH 41/82] Revert "Ignore packages with malformed versions or malformed constraints" This reverts commit 8fe23b418b3c3cad690ea3171bb64a8fac711576. --- .../constraint-solver-tests.js | 21 ++++++++++++ .../package-version-parser-tests.js | 11 ------- tools/catalog-base.js | 24 ++------------ tools/package-version-parser.js | 8 ----- tools/tests/package-tests.js | 33 +++++-------------- 5 files changed, 32 insertions(+), 65 deletions(-) diff --git a/packages/constraint-solver/constraint-solver-tests.js b/packages/constraint-solver/constraint-solver-tests.js index f36f118bd7..3acc7097a3 100644 --- a/packages/constraint-solver/constraint-solver-tests.js +++ b/packages/constraint-solver/constraint-solver-tests.js @@ -311,6 +311,27 @@ Tinytest.add("constraint solver - no constraint dependency - anything", function test.isTrue(_.isString(versions.sparkle)); }); +Tinytest.add("constraint solver - ignore malformed version strings", function (test) { + var resolver = makeResolver([ + ["foo", "1.2.3", "1.2.3"], + ["foo", "1.2.3!bang@at#hash%invalid", "1.2.3!bang@at#hash%invalid"], + ["bar", "1.2.3", "1.2.3", {"foo": "1.2.3"}], + ["bar", "1.2.4", "1.2.4", {"foo": "1.2.3!bang@at#hash%invalid"}] + ]); + + testWithResolver(test, resolver, function (t, FAIL) { + FAIL({ "bar": "1.2.4" }, /not satisfied/); + + // Since we can't parse versions or dependencies of + // foo@1.2.3!band@at#hash%invalid or bar@1.2.4, ignore them when + // finding the right versions to use. + t({ "bar": "1.2.3"}, { + "bar": "1.2.3", + "foo": "1.2.3" + }, { _testing: true }); + }); +}); + Tinytest.add("constraint solver - no constraint dependency - transitive dep still picked right", function (test) { var versions = defaultResolver.resolve( ["sparkle", "sparky-forms"], diff --git a/packages/package-version-parser/package-version-parser-tests.js b/packages/package-version-parser/package-version-parser-tests.js index 761a7a6851..b934f88b9c 100644 --- a/packages/package-version-parser/package-version-parser-tests.js +++ b/packages/package-version-parser/package-version-parser-tests.js @@ -14,17 +14,6 @@ var FAIL = function (versionString) { }); }; -Tinytest.add("Smart Package version string parsing - isValidVersion", function (test) { - var validVersions = ["0.1.1", "1.0.0_2", "2.0.0-pre.2", "2.0.1-pre.2_50"]; - var invalidVersions = ["0.1.1!", "1.0.0~2", "3.2.0.0", "=2.0.1"]; - _.each(validVersions, function (v) { - test.isTrue(PackageVersion.isValidVersion(v)); - }); - _.each(invalidVersions, function (v) { - test.isFalse(PackageVersion.isValidVersion(v)); - }); -}); - Tinytest.add("Smart Package version string parsing - old format", function (test) { currentTest = test; diff --git a/tools/catalog-base.js b/tools/catalog-base.js index 7193908948..5f9be61d4a 100644 --- a/tools/catalog-base.js +++ b/tools/catalog-base.js @@ -152,27 +152,9 @@ _.extend(baseCatalog.BaseCatalog.prototype, { if (!_.has(self.versions, name)) { return []; } - - var validVersions = []; - - // filter out any package with a malformed version, or with any - // dependencies that have malformed versions. - _.each(self.versions[name], function (entry, version) { - if (! packageVersionParser.isValidVersion(version)) - return; - - if (! _.all(entry.dependencies, function (dependency, packageName) { - return !dependency.constraint || - packageVersionParser.isValidVersion(dependency.constraint); - })) { - return; - } - - validVersions.push(version); - }); - - - return validVersions.sort(packageVersionParser.compare); + var ret = _.keys(self.versions[name]); + ret.sort(packageVersionParser.compare); + return ret; }, // Return information about a particular version of a package, or diff --git a/tools/package-version-parser.js b/tools/package-version-parser.js index 96ef73ff42..0374c4d9a8 100644 --- a/tools/package-version-parser.js +++ b/tools/package-version-parser.js @@ -82,14 +82,6 @@ PV.versionMagnitude = function (versionString) { prereleaseIdentifierToFraction(v.prerelease) / 100 / 100; }; -PV.isValidVersion = function (versionString) { - try { - return semver.valid(extractSemverPart(versionString).semver); - } catch (e) { - return false; - } -}; - // Accepts an array, eg ["rc", 2, 3]. Returns a number in the range // (-1, 0]. An empty array returns 0. A non-empty string returns a // number that is "as large" as the its precedence. diff --git a/tools/tests/package-tests.js b/tools/tests/package-tests.js index bd339ff6c2..cc67e19448 100644 --- a/tools/tests/package-tests.js +++ b/tools/tests/package-tests.js @@ -778,14 +778,6 @@ selftest.define("malformed package names", [], function () { }); data.collections.versions = data.collections.versions || []; - data.collections.versions.push({ - "packageName": "bar", - "version": "1.2.3", - "earliestCompatibleVersion": "1.2.3", - "containsPlugins": false, - "description": "...", - "dependencies": {} - }); data.collections.versions.push({ "packageName": "bar", "version": "1.2.4", @@ -794,14 +786,14 @@ selftest.define("malformed package names", [], function () { "description": "...", "dependencies": { "foo": { - "constraint": "1.2.3!bang:colon#hash%invalid", + "constraint": "1.2.3!bang@at#hash%invalid", "references": [{"arch": "os"}] } } }); data.collections.versions.push({ "packageName": "foo", - "version": "1.2.3!bang:colon#hash%invalid", + "version": "1.2.3!bang@at#hash%invalid", "earliestCompatibleVersion": "1.2.3", "containsPlugins": false, "description": "...", @@ -811,30 +803,21 @@ selftest.define("malformed package names", [], function () { fs.writeFileSync(dataFile, JSON.stringify(data)); run = s.run("search", "foo"); - run.matchErr(/Neither packages nor releases .* could be found/); + run.match(/Neither packages nor releases .* could be found/); run.expectExit(0); - run = s.run("show", "bar"); - run.match("1.2.3"); - run.forbidAll("1.2.4"); + var run = s.run("search", "bar"); + run.match(/Neither packages nor releases .* could be found/); run.expectExit(0); - run = s.run("create", "myapp"); + var run = s.run("create", "myapp"); run.expectExit(0); s.cd("myapp"); run = s.run("add", "foo"); - run.matchErr("unknown package: foo"); + run.matchErr("foo: no such package"); run.expectExit(1); - run = s.run("add", "bar"); - // If we get the following error, that means we successfully decided - // to try to add bar@1.2.3, but couldn't because (as expected) there - // is no build for this release in the catalog. - run.matchErr("Package bar has no compatible build for version 1.2.3"); - run.expectExit(1); - - run = s.run("add", "bar@1.2.4"); - run.matchErr("constraints on bar cannot be satisfied"); + run.matchErr("bar: no such package"); run.expectExit(1); }); From 3cb6ea87be80910e0d8ba7c3910713b94bbd29be Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Thu, 25 Sep 2014 11:42:07 -0700 Subject: [PATCH 42/82] Revert "Uncomment test for `meteor search` with malformed versions" This reverts commit cb0811a10acab05528c5404b5ccc708bf7cf238b. --- tools/tests/package-tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/tests/package-tests.js b/tools/tests/package-tests.js index cc67e19448..146eb8f607 100644 --- a/tools/tests/package-tests.js +++ b/tools/tests/package-tests.js @@ -801,7 +801,7 @@ selftest.define("malformed package names", [], function () { }); fs.writeFileSync(dataFile, JSON.stringify(data)); - +/* run = s.run("search", "foo"); run.match(/Neither packages nor releases .* could be found/); run.expectExit(0); @@ -809,7 +809,7 @@ selftest.define("malformed package names", [], function () { var run = s.run("search", "bar"); run.match(/Neither packages nor releases .* could be found/); run.expectExit(0); - +*/ var run = s.run("create", "myapp"); run.expectExit(0); From 648a4e2a09eb2bc6a350b058ba1f9d84abb09826 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Thu, 25 Sep 2014 11:42:16 -0700 Subject: [PATCH 43/82] Revert "Correct but failing test for lenient parsing of bad version number" This reverts commit c496bd716bacc24413cb4f948931eb73eb1309a0. --- .../constraint-solver-tests.js | 20 ------ tools/tests/package-tests.js | 63 ------------------- 2 files changed, 83 deletions(-) diff --git a/packages/constraint-solver/constraint-solver-tests.js b/packages/constraint-solver/constraint-solver-tests.js index 3acc7097a3..7b1f667bb9 100644 --- a/packages/constraint-solver/constraint-solver-tests.js +++ b/packages/constraint-solver/constraint-solver-tests.js @@ -311,26 +311,6 @@ Tinytest.add("constraint solver - no constraint dependency - anything", function test.isTrue(_.isString(versions.sparkle)); }); -Tinytest.add("constraint solver - ignore malformed version strings", function (test) { - var resolver = makeResolver([ - ["foo", "1.2.3", "1.2.3"], - ["foo", "1.2.3!bang@at#hash%invalid", "1.2.3!bang@at#hash%invalid"], - ["bar", "1.2.3", "1.2.3", {"foo": "1.2.3"}], - ["bar", "1.2.4", "1.2.4", {"foo": "1.2.3!bang@at#hash%invalid"}] - ]); - - testWithResolver(test, resolver, function (t, FAIL) { - FAIL({ "bar": "1.2.4" }, /not satisfied/); - - // Since we can't parse versions or dependencies of - // foo@1.2.3!band@at#hash%invalid or bar@1.2.4, ignore them when - // finding the right versions to use. - t({ "bar": "1.2.3"}, { - "bar": "1.2.3", - "foo": "1.2.3" - }, { _testing: true }); - }); -}); Tinytest.add("constraint solver - no constraint dependency - transitive dep still picked right", function (test) { var versions = defaultResolver.resolve( diff --git a/tools/tests/package-tests.js b/tools/tests/package-tests.js index 146eb8f607..a8fcfabbdf 100644 --- a/tools/tests/package-tests.js +++ b/tools/tests/package-tests.js @@ -7,7 +7,6 @@ var _= require('underscore'); var fs = require("fs"); var path = require("path"); var packageClient = require("../package-client.js"); -var config = require("../config.js"); var username = "test"; var password = "testtest"; @@ -759,65 +758,3 @@ selftest.define("packages with organizations", ["net", "test-package-server"], f testUtils.login(s, "testtest", "testtest"); changeVersionAndPublish(s, true /* expect authorization failure */); }); - -selftest.define("malformed package names", [], function () { - var s = new Sandbox({warehouse: {v1: {recommended: true}}}); - s.set("METEOR_OFFLINE_CATALOG", "t"); - - var dataFile = config.getPackageStorage({root: s.warehouse}); - var data = JSON.parse(fs.readFileSync(dataFile, 'utf8')); - data.collections = data.collections || {}; - data.collections.packages = data.collections.packages || []; - data.collections.packages.push({ - "name": "bar", - "_id": utils.randomToken() - }); - data.collections.packages.push({ - "name": "foo", - "_id": utils.randomToken() - }); - - data.collections.versions = data.collections.versions || []; - data.collections.versions.push({ - "packageName": "bar", - "version": "1.2.4", - "earliestCompatibleVersion": "1.2.4", - "containsPlugins": false, - "description": "...", - "dependencies": { - "foo": { - "constraint": "1.2.3!bang@at#hash%invalid", - "references": [{"arch": "os"}] - } - } - }); - data.collections.versions.push({ - "packageName": "foo", - "version": "1.2.3!bang@at#hash%invalid", - "earliestCompatibleVersion": "1.2.3", - "containsPlugins": false, - "description": "...", - "dependencies": {} - }); - - fs.writeFileSync(dataFile, JSON.stringify(data)); -/* - run = s.run("search", "foo"); - run.match(/Neither packages nor releases .* could be found/); - run.expectExit(0); - - var run = s.run("search", "bar"); - run.match(/Neither packages nor releases .* could be found/); - run.expectExit(0); -*/ - var run = s.run("create", "myapp"); - run.expectExit(0); - - s.cd("myapp"); - run = s.run("add", "foo"); - run.matchErr("foo: no such package"); - run.expectExit(1); - run = s.run("add", "bar"); - run.matchErr("bar: no such package"); - run.expectExit(1); -}); From 5758bc8a2c2baf21e2cbc3e8339ecb41f9e6191a Mon Sep 17 00:00:00 2001 From: ekatek Date: Thu, 25 Sep 2014 11:41:45 -0700 Subject: [PATCH 44/82] increment the numbers for the next rc --- packages/meteor-tool/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index e99fa7accd..6508f51dab 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.0.31-rc7' + version: '1.0.31-rc8' }); Package.includeTool(); diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index 68bf591a05..ba83955fca 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "0.9.3-rc7", + "version": "0.9.3-rc8", "recommended": false, "official": false, "description": "A release candidate of Meteor 0.9.3." From 90c5fc361986239f553a670b8a94db0e606ed8fa Mon Sep 17 00:00:00 2001 From: ekatek Date: Thu, 25 Sep 2014 11:48:54 -0700 Subject: [PATCH 45/82] increment pvp package as well --- packages/package-version-parser/package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/package-version-parser/package.js b/packages/package-version-parser/package.js index 364fe328a0..9fd232f2b9 100644 --- a/packages/package-version-parser/package.js +++ b/packages/package-version-parser/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Parses Meteor Smart Package version string", - version: "2.0.0-rc.2" + version: "2.0.0-rc.3" }); Npm.depends({ From 0f8ea3597e17cc79969e56d8fff6d6d315743017 Mon Sep 17 00:00:00 2001 From: Emily Stark Date: Thu, 25 Sep 2014 12:21:04 -0700 Subject: [PATCH 46/82] On deploy, record package stats after bundling. My theory is that this prevents long-running bundles that don't yield from interfering with the ServiceConnection to the package stats server. --- tools/deploy.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/deploy.js b/tools/deploy.js index 97ec87c53e..05921356ec 100644 --- a/tools/deploy.js +++ b/tools/deploy.js @@ -400,6 +400,14 @@ var bundleAndDeploy = function (options) { if (! messages.hasMessages()) { var bundler = require('./bundler.js'); + var bundleResult = bundler.bundle({ + outputPath: bundlePath, + buildOptions: options.buildOptions + }); + + if (bundleResult.errors) + messages.merge(bundleResult.errors); + if (options.recordPackageUsage) { var statsMessages = buildmessage.capture({ title: 'Reporting statistics' }, function () { stats.recordPackages("sdk.deploy", site); @@ -411,13 +419,6 @@ var bundleAndDeploy = function (options) { } } - var bundleResult = bundler.bundle({ - outputPath: bundlePath, - buildOptions: options.buildOptions - }); - - if (bundleResult.errors) - messages.merge(bundleResult.errors); } if (messages.hasMessages()) { From 75c473b255bbb61fcd26720a37af516841ed1f05 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Thu, 25 Sep 2014 13:51:03 -0700 Subject: [PATCH 47/82] =?UTF-8?q?Rename=20=E2=80=9Cshowdown=E2=80=9D=20to?= =?UTF-8?q?=20=E2=80=9Cmarkdown=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we want to change markdown implementations in the future, we’ll bump the major version of the package. --- packages/markdown/.gitignore | 1 + packages/{showdown => markdown}/license.txt | 0 packages/markdown/package.js | 20 +++++++++++++++++++ packages/{showdown => markdown}/showdown.js | 0 .../template-integration.js | 0 packages/showdown/package.js | 18 +++-------------- 6 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 packages/markdown/.gitignore rename packages/{showdown => markdown}/license.txt (100%) create mode 100644 packages/markdown/package.js rename packages/{showdown => markdown}/showdown.js (100%) rename packages/{showdown => markdown}/template-integration.js (100%) diff --git a/packages/markdown/.gitignore b/packages/markdown/.gitignore new file mode 100644 index 0000000000..677a6fc263 --- /dev/null +++ b/packages/markdown/.gitignore @@ -0,0 +1 @@ +.build* diff --git a/packages/showdown/license.txt b/packages/markdown/license.txt similarity index 100% rename from packages/showdown/license.txt rename to packages/markdown/license.txt diff --git a/packages/markdown/package.js b/packages/markdown/package.js new file mode 100644 index 0000000000..da96fed532 --- /dev/null +++ b/packages/markdown/package.js @@ -0,0 +1,20 @@ +// Source: https://github.com/coreyti/showdown + +// XXX rename to 'markdown' and credit showdown some other way? + +Package.describe({ + summary: "Markdown-to-HTML processor", + version: "1.0.1" +}); + +Package.on_use(function (api) { + api.add_files("showdown.js"); + api.export('Showdown'); + + api.use("templating", "client", {weak: true}); + api.add_files('template-integration.js', 'client'); +}); + +Package.on_test(function (api) { + api.use("blaze", "client"); +}); diff --git a/packages/showdown/showdown.js b/packages/markdown/showdown.js similarity index 100% rename from packages/showdown/showdown.js rename to packages/markdown/showdown.js diff --git a/packages/showdown/template-integration.js b/packages/markdown/template-integration.js similarity index 100% rename from packages/showdown/template-integration.js rename to packages/markdown/template-integration.js diff --git a/packages/showdown/package.js b/packages/showdown/package.js index da96fed532..e89b0e2e80 100644 --- a/packages/showdown/package.js +++ b/packages/showdown/package.js @@ -1,20 +1,8 @@ -// Source: https://github.com/coreyti/showdown - -// XXX rename to 'markdown' and credit showdown some other way? - Package.describe({ - summary: "Markdown-to-HTML processor", - version: "1.0.1" + summary: "Moved to the 'markdown' package", + version: '1.0.1' }); Package.on_use(function (api) { - api.add_files("showdown.js"); - api.export('Showdown'); - - api.use("templating", "client", {weak: true}); - api.add_files('template-integration.js', 'client'); -}); - -Package.on_test(function (api) { - api.use("blaze", "client"); + api.imply("markdown"); }); From 8f707caad9e8a623d325632e7decb826e97eb2f1 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Thu, 25 Sep 2014 13:51:03 -0700 Subject: [PATCH 48/82] =?UTF-8?q?Rename=20=E2=80=9Cshowdown=E2=80=9D=20to?= =?UTF-8?q?=20=E2=80=9Cmarkdown=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we want to change markdown implementations in the future, we’ll bump the major version of the package. --- docs/.meteor/versions | 1 + packages/markdown/package.js | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/.meteor/versions b/docs/.meteor/versions index 811099bd65..86ce428ee5 100644 --- a/docs/.meteor/versions +++ b/docs/.meteor/versions @@ -28,6 +28,7 @@ json@1.0.0 less@1.0.8 livedata@1.0.9 logging@1.0.3 +markdown@1.0.1 meteor-platform@1.1.0 meteor@1.1.0 minifiers@1.1.0 diff --git a/packages/markdown/package.js b/packages/markdown/package.js index da96fed532..037e5df0d7 100644 --- a/packages/markdown/package.js +++ b/packages/markdown/package.js @@ -1,7 +1,5 @@ // Source: https://github.com/coreyti/showdown -// XXX rename to 'markdown' and credit showdown some other way? - Package.describe({ summary: "Markdown-to-HTML processor", version: "1.0.1" From 48264ccafdcdfe6ff88b59ea8fc5631210d79818 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Thu, 25 Sep 2014 14:56:15 -0700 Subject: [PATCH 49/82] Use preferred helper style in docs,apps,packages --- docs/client/api.html | 24 +- docs/client/concepts.html | 28 +- docs/client/docs.js | 78 ++--- examples/leaderboard/leaderboard.js | 25 +- examples/parties/client/client.js | 142 +++++---- examples/todos/client/todos.js | 154 ++++----- examples/wordplay/client/wordplay.js | 154 ++++----- .../accounts-ui-unstyled/login_buttons.js | 61 ++-- .../login_buttons_dropdown.js | 295 +++++++++--------- .../login_buttons_single.js | 27 +- packages/autoupdate/QA.md | 2 +- packages/facebook/facebook_configure.js | 21 +- packages/facts/facts.js | 24 +- packages/github/github_configure.js | 20 +- packages/google/google_configure.js | 20 +- packages/meetup/meetup_configure.js | 20 +- .../meteor_developer_configure.js | 20 +- packages/twitter/twitter_configure.js | 20 +- packages/weibo/weibo_configure.js | 22 +- 19 files changed, 622 insertions(+), 535 deletions(-) diff --git a/docs/client/api.html b/docs/client/api.html index 71a6c262da..9743eb8151 100644 --- a/docs/client/api.html +++ b/docs/client/api.html @@ -1633,14 +1633,18 @@ Example: {{lt}}/template> ///// in JS file - Template.postsView.posts = function() { - return Posts.find(); - }; + Template.postsView.helpers({ + posts: function() { + return Posts.find(); + } + }); - Template.postItem.postClass = function() { - return Session.equals("selectedPost", this._id) ? - "selected" : ""; - }; + Template.postItem.helpers({ + postClass: function() { + return Session.equals("selectedPost", this._id) ? + "selected" : ""; + } + }); Template.postItem.events({ 'click': function() { @@ -2220,12 +2224,6 @@ Example: Now you can invoke this helper with `{{dstache}}foo}}` in the template defined with `<{{! }}template name="myTemplate">`. -The following syntax is a shorthand for when you only have one helper to define: - - Template.myTemplate.foo = function () { - return Session.get("foo"); - }; - To create a helper that can be used in any template, use [`Template.registerHelper`](#template_registerhelper). diff --git a/docs/client/concepts.html b/docs/client/concepts.html index 0ed6f0e76b..01ef117987 100644 --- a/docs/client/concepts.html +++ b/docs/client/concepts.html @@ -457,9 +457,11 @@ functions in JavaScript. Just add the helper functions directly on the {{lt}}/template> // in client/myapp.js: reactive helper function - Template.forecast.prediction = function () { - return Session.get("weather"); - }; + Template.forecast.helpers({ + prediction: function () { + return Session.get("weather"); + } + }); // in the JavaScript console > Session.set("weather", "cloudy"); @@ -481,9 +483,11 @@ To iterate over an array or database cursor, use `{{dstache}}#each}}`: {{lt}}/template> // in myapp.js - Template.players.topScorers = function () { - return Users.find({score: {$gt: 100}}, {sort: {score: -1}}); - }; + Template.players.helpers({ + topScorers: function () { + return Users.find({score: {$gt: 100}}, {sort: {score: -1}}); + } + }); In this case, the data is coming from a database query. When the database cursor is passed to `{{dstache}}#each}}`, it will wire up all of the @@ -495,9 +499,11 @@ in `this`. Note that some block helpers change the current context (notably `{{dstache}}#each}}` and `{{dstache}}#with}}`): // in a JavaScript file - Template.players.leagueIs = function (league) { - return this.league === league; - }; + Template.players.helpers({ + leagueIs: function (league) { + return this.league === league; + } + });