correct update semantics with release --explicit

This commit is contained in:
ekatek
2014-06-11 22:40:07 -07:00
parent a4ee2a841f
commit a710408b1c
3 changed files with 20 additions and 8 deletions

View File

@@ -1050,11 +1050,10 @@ main.registerCommand({
}
// Update the packages to the latest version. We don't do this for patch
// releases.
//
// XXX: Can we figure out if we got here with update --release foo,
// or just with update?
if (!options['patch']) {
// releases, or if you specified the release with a --release flag. (Why?
// Because it sure seems like you probably care about the release at that
// point, that's what --release would look like anyway)
if (!options['patch'] && !release.explicit) {
// We can't update packages when we are not in a release.
if (!options.appDir) return 0;

View File

@@ -659,6 +659,7 @@ Fiber(function () {
var releaseOverride = null;
var releaseForced = false;
var releaseExplicit = false;
if (_.has(rawOptions, '--release')) {
if (rawOptions['--release'].length > 1) {
process.stderr.write(
@@ -676,6 +677,13 @@ Fiber(function () {
}
delete rawOptions['--release'];
}
// Let's keep track of whether this is an explicit release, due to different
// update behavior.
if (releaseOverride) {
releaseExplicit = true;
}
if (_.has(process.env, 'METEOR_SPRINGBOARD_RELEASE')) {
// See #SpringboardEnvironmentVar
// Note that this does *NOT* cause release.forced to be true.
@@ -788,7 +796,7 @@ Fiber(function () {
throw e;
}
release.setCurrent(rel, releaseForced);
release.setCurrent(rel, releaseForced, releaseExplicit);
}
// If we're not running the correct version of the tools for this

View File

@@ -163,6 +163,10 @@ release.current = null;
// a checkin.) null if release.current is null.
release.forced = null;
// True if the release was explicitly specified by the user with the --release
// flag. Useful for update semantics.
release.explicit = null;
// True if release.current is the release we'd use if we wanted to run the app
// in the current project. (taking into account release.forced and whether we're
// currently running from a checkout).
@@ -259,12 +263,14 @@ release.load = function (name, options) {
// - releaseObject: a Release as returned from release.load()
// - forced: true if the chosen release was forced from the command
// line (by the user or by the update springboard).
release.setCurrent = function (releaseObject, forced) {
// - explicit: true if the release was specifically requested by the user.
release.setCurrent = function (releaseObject, forced, explicit) {
if (release.current)
throw new Error("release set twice?");
release.current = releaseObject;
release.forced = !! forced;
release.explicit = !! explicit;
};
// XXX hack
@@ -281,4 +287,3 @@ release._setCurrentForOldTest = function () {
// new packaging world. (It may still exist in the pre-0.9.0 packaging world.)
release.NoSuchReleaseError = function () {
};