Write versions when app release matches current

This should take care of the special-casing that used to be in create
and update. (Will still need to confirm that it works properly for
update.)
This commit is contained in:
David Glasser
2014-11-13 11:28:33 -08:00
parent 7b952d50e9
commit 9f8b533fcc
3 changed files with 23 additions and 13 deletions

View File

@@ -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()) {

View File

@@ -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(

View File

@@ -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;