diff --git a/tools/commands.js b/tools/commands.js index edaf02c0ad..3a8ddf27ec 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -592,8 +592,6 @@ main.registerCommand({ var upgraders = require('./upgraders.js'); projectContext.finishedUpgraders.appendUpgraders(upgraders.allUpgraders()); - // XXX #3006 ensure that this ALWAYS writes .meteor/versions, even with - // '--release'. projectContext.prepareProjectForBuild(); }); if (messages.hasMessages()) { diff --git a/tools/main.js b/tools/main.js index 5f12924322..26440cbc51 100644 --- a/tools/main.js +++ b/tools/main.js @@ -768,7 +768,7 @@ Fiber(function () { releaseName = releaseOverride; } else if (appDir) { // Running from an app directory. Use release specified by app. - if (appReleaseFile.unnormalizedReleaseName === 'none') { + if (appReleaseFile.isCheckout()) { // Looks like we don't have a release. Leave release.current === null. } else { // Use the project's desired release @@ -1214,7 +1214,7 @@ commandName + ": You're not in a Meteor project directory.\n" + } if (command.requiresApp && release.current.isCheckout() && - appReleaseFile && appReleaseFile.unnormalizedReleaseName !== "none") { + appReleaseFile && ! appReleaseFile.isCheckout()) { // For commands that work with apps, if we have overridden the // app's usual release by using a checkout, print a reminder banner. Console.warn( diff --git a/tools/project-context.js b/tools/project-context.js index 3cf97e7e32..a262d7e28d 100644 --- a/tools/project-context.js +++ b/tools/project-context.js @@ -337,16 +337,21 @@ _.extend(exports.ProjectContext.prototype, { _savePackageMap: function () { var self = this; - // XXX #3006 support the alwaysRecord case (used for create and update with - // --release) + // XXX #3006 make sure that this conditional is correct for update too - // If the user forced us to an explicit release, then maybe we shouldn't - // record versions (because they are based on a different release than the - // recorded .meteor/release), unless we are updating or creating, in which - // case, we should. - if (!release.explicit) { - self.packageMapFile.write(self.packageMap); + // If we're running from a release but the app is unpinned, or vice versa, + // don't save the package map. + if (release.current.isCheckout() !== self.releaseFile.isCheckout()) + return; + + // If we're running from a release but it's not the same release as the app, + // don't save the package map. + if (! release.current.isCheckout() && + release.current.name !== self.releaseFile.fullReleaseName) { + return; } + + self.packageMapFile.write(self.packageMap); } }); @@ -360,7 +365,8 @@ exports.ProjectConstraintsFile = function (options) { self.watchSet = new watch.WatchSet; // XXX #3006 Use a better data structure so that we can rewrite the file // later. But for now this maps from package name to parsed constraint. - self._constraints = {}; + self._constraints = null; + self._readFile(); }; _.extend(exports.ProjectConstraintsFile.prototype, { @@ -368,7 +374,9 @@ _.extend(exports.ProjectConstraintsFile.prototype, { var self = this; buildmessage.assertInCapture(); + self._constraints = {}; var contents = watch.readAndWatchFile(self.watchSet, self.filename); + // No .meteor/packages? That's OK, you just get no packages. if (contents === null) return; @@ -604,6 +612,10 @@ _.extend(exports.ReleaseFile.prototype, { var self = this; return self.unnormalizedReleaseName === ''; }, + isCheckout: function () { + var self = this; + return self.unnormalizedReleaseName === 'none'; + }, _readFile: function () { var self = this;