mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
--get-ready on built meteor now fails on error
Generally reorganize some silent/quiet/background flags to be more explicit about what is being show/hidden. The main point here is that the 'background updater' wants to show banners but ignore errors, whereas --get-ready wants to show errors but not banners.
This commit is contained in:
@@ -126,7 +126,7 @@ main.registerCommand({
|
|||||||
}, function (options) {
|
}, function (options) {
|
||||||
if (files.usesWarehouse()) {
|
if (files.usesWarehouse()) {
|
||||||
var updater = require('./updater.js');
|
var updater = require('./updater.js');
|
||||||
updater.tryToDownloadUpdate(true /* silent */);
|
updater.tryToDownloadUpdate();
|
||||||
} else {
|
} else {
|
||||||
// dev bundle is downloaded by the wrapper script. We just need
|
// dev bundle is downloaded by the wrapper script. We just need
|
||||||
// to install NPM dependencies.
|
// to install NPM dependencies.
|
||||||
@@ -326,7 +326,7 @@ main.registerCommand({
|
|||||||
// #UpdateSpringboard), go get the latest release and switch to it.
|
// #UpdateSpringboard), go get the latest release and switch to it.
|
||||||
if (! release.forced) {
|
if (! release.forced) {
|
||||||
try {
|
try {
|
||||||
warehouse.fetchLatestRelease();
|
warehouse.fetchLatestRelease({showInstalling: true});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (! (e instanceof files.OfflineError)) {
|
if (! (e instanceof files.OfflineError)) {
|
||||||
console.error("Failed to update Meteor.");
|
console.error("Failed to update Meteor.");
|
||||||
|
|||||||
@@ -13,22 +13,32 @@ var Updater = function () {
|
|||||||
_.extend(Updater.prototype, {
|
_.extend(Updater.prototype, {
|
||||||
start: function () {
|
start: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
var updater = require('./updater.js');
|
|
||||||
|
|
||||||
if (self.timer)
|
if (self.timer)
|
||||||
throw new Error("already running?");
|
throw new Error("already running?");
|
||||||
|
|
||||||
// Check twice a day.
|
// Check twice a day.
|
||||||
self.timer = setInterval(inFiber(function () {
|
self.timer = setInterval(inFiber(function () {
|
||||||
updater.tryToDownloadUpdate(/* silent */ false);
|
self._check();
|
||||||
}), 12*60*60*1000);
|
}), 12*60*60*1000);
|
||||||
|
|
||||||
// Also start a check now, but don't block on it.
|
// Also start a check now, but don't block on it.
|
||||||
new Fiber(function () {
|
new Fiber(function () {
|
||||||
updater.tryToDownloadUpdate(/* silent */ false);
|
self._check();
|
||||||
}).run();
|
}).run();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_check: function () {
|
||||||
|
var self = this;
|
||||||
|
var updater = require('./updater.js');
|
||||||
|
try {
|
||||||
|
updater.tryToDownloadUpdate({showBanner: true});
|
||||||
|
} catch (e) {
|
||||||
|
// oh well, this was the background. no need to show any errors.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Returns immediately. However if an update check is currently
|
// Returns immediately. However if an update check is currently
|
||||||
// running it will complete in the background. Idempotent.
|
// running it will complete in the background. Idempotent.
|
||||||
stop: function () {
|
stop: function () {
|
||||||
|
|||||||
@@ -30,21 +30,22 @@ exports.getManifest = function () {
|
|||||||
* Check to see if an update is available. If so, download and install
|
* Check to see if an update is available. If so, download and install
|
||||||
* it before returning.
|
* it before returning.
|
||||||
*
|
*
|
||||||
* If 'silent' is true, suppress chatter.
|
* options: showBanner
|
||||||
*/
|
*/
|
||||||
var checkInProgress = false;
|
var checkInProgress = false;
|
||||||
exports.tryToDownloadUpdate = function (silent) {
|
exports.tryToDownloadUpdate = function (options) {
|
||||||
|
options = options || {};
|
||||||
// Don't run more than one check simultaneously. It should be
|
// Don't run more than one check simultaneously. It should be
|
||||||
// harmless but having two downloads happening simultaneously (and
|
// harmless but having two downloads happening simultaneously (and
|
||||||
// two sets of messages being printed) would be confusing.
|
// two sets of messages being printed) would be confusing.
|
||||||
if (checkInProgress)
|
if (checkInProgress)
|
||||||
return;
|
return;
|
||||||
checkInProgress = true;
|
checkInProgress = true;
|
||||||
check(silent);
|
check(!!options.showBanner);
|
||||||
checkInProgress = false;
|
checkInProgress = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
var check = function (silent) {
|
var check = function (showBanner) {
|
||||||
var manifest = null;
|
var manifest = null;
|
||||||
try {
|
try {
|
||||||
manifest = exports.getManifest();
|
manifest = exports.getManifest();
|
||||||
@@ -68,7 +69,7 @@ var check = function (silent) {
|
|||||||
// the last release which has had a banner printed.)
|
// the last release which has had a banner printed.)
|
||||||
if (manifest.releases.stable.banner &&
|
if (manifest.releases.stable.banner &&
|
||||||
warehouse.lastPrintedBannerRelease() !== manifestLatestRelease) {
|
warehouse.lastPrintedBannerRelease() !== manifestLatestRelease) {
|
||||||
if (! silent) {
|
if (showBanner) {
|
||||||
console.log();
|
console.log();
|
||||||
console.log(manifest.releases.stable.banner);
|
console.log(manifest.releases.stable.banner);
|
||||||
console.log();
|
console.log();
|
||||||
@@ -76,22 +77,17 @@ var check = function (silent) {
|
|||||||
warehouse.writeLastPrintedBannerRelease(manifestLatestRelease);
|
warehouse.writeLastPrintedBannerRelease(manifestLatestRelease);
|
||||||
} else {
|
} else {
|
||||||
// Already printed this banner, or maybe there is no banner.
|
// Already printed this banner, or maybe there is no banner.
|
||||||
if (! silent) {
|
if (showBanner) {
|
||||||
console.log("=> Meteor %s is being downloaded in the background.",
|
console.log("=> Meteor %s is being downloaded in the background.",
|
||||||
manifestLatestRelease);
|
manifestLatestRelease);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
warehouse.fetchLatestRelease({showInstalling: showBanner});
|
||||||
warehouse.fetchLatestRelease(true /* background */);
|
|
||||||
} catch (e) {
|
|
||||||
// oh well, this was the background. no need to show any errors.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// We should now have fetched the latest release, which *probably* is
|
// We should now have fetched the latest release, which *probably* is
|
||||||
// manifestLatestRelease. As long as it's changed from the one it was
|
// manifestLatestRelease. As long as it's changed from the one it was
|
||||||
// before we tried to fetch it, print that out.
|
// before we tried to fetch it, print that out.
|
||||||
var newLatestRelease = warehouse.latestRelease();
|
var newLatestRelease = warehouse.latestRelease();
|
||||||
if (newLatestRelease !== localLatestRelease && ! silent) {
|
if (showBanner && newLatestRelease !== localLatestRelease) {
|
||||||
console.log(
|
console.log(
|
||||||
"=> Meteor %s is available. Update this project with 'meteor update'.",
|
"=> Meteor %s is available. Update this project with 'meteor update'.",
|
||||||
newLatestRelease);
|
newLatestRelease);
|
||||||
@@ -103,9 +99,9 @@ var check = function (silent) {
|
|||||||
// update this app? Specifically: is our local latest release something
|
// update this app? Specifically: is our local latest release something
|
||||||
// other than this app's release, and the user didn't specify a specific
|
// other than this app's release, and the user didn't specify a specific
|
||||||
// release at the command line with --release?
|
// release at the command line with --release?
|
||||||
if (localLatestRelease !== release.current.name &&
|
if (showBanner &&
|
||||||
! release.forced &&
|
localLatestRelease !== release.current.name &&
|
||||||
! silent) {
|
! release.forced) {
|
||||||
console.log(
|
console.log(
|
||||||
"=> Meteor %s is available. Update this project with 'meteor update'.",
|
"=> Meteor %s is available. Update this project with 'meteor update'.",
|
||||||
localLatestRelease);
|
localLatestRelease);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ _.extend(warehouse, {
|
|||||||
var manifestPath = path.join(
|
var manifestPath = path.join(
|
||||||
warehouse.getWarehouseDir(), 'releases', release + '.release.json');
|
warehouse.getWarehouseDir(), 'releases', release + '.release.json');
|
||||||
|
|
||||||
return warehouse._populateWarehouseForRelease(release, quiet);
|
return warehouse._populateWarehouseForRelease(release, !quiet);
|
||||||
},
|
},
|
||||||
|
|
||||||
_latestReleaseSymlinkPath: function () {
|
_latestReleaseSymlinkPath: function () {
|
||||||
@@ -127,7 +127,8 @@ _.extend(warehouse, {
|
|||||||
|
|
||||||
// returns true if we updated the latest symlink
|
// returns true if we updated the latest symlink
|
||||||
// XXX make errors prettier
|
// XXX make errors prettier
|
||||||
fetchLatestRelease: function (background) {
|
fetchLatestRelease: function (options) {
|
||||||
|
options = options || {};
|
||||||
var manifest = updater.getManifest();
|
var manifest = updater.getManifest();
|
||||||
|
|
||||||
// XXX in the future support release channels other than stable
|
// XXX in the future support release channels other than stable
|
||||||
@@ -136,8 +137,8 @@ _.extend(warehouse, {
|
|||||||
if (! releaseName)
|
if (! releaseName)
|
||||||
throw new Error("no stable release found?");
|
throw new Error("no stable release found?");
|
||||||
|
|
||||||
var latestReleaseManifest =
|
var latestReleaseManifest = warehouse._populateWarehouseForRelease(
|
||||||
warehouse._populateWarehouseForRelease(releaseName, background);
|
releaseName, !!options.showInstalling);
|
||||||
|
|
||||||
// First, make sure the latest tools symlink reflects the latest installed
|
// First, make sure the latest tools symlink reflects the latest installed
|
||||||
// release.
|
// release.
|
||||||
@@ -221,7 +222,7 @@ _.extend(warehouse, {
|
|||||||
// fetches the manifest file for the given release version. also fetches
|
// fetches the manifest file for the given release version. also fetches
|
||||||
// all of the missing versioned packages referenced from the release manifest
|
// all of the missing versioned packages referenced from the release manifest
|
||||||
// @param releaseVersion {String} eg "0.1"
|
// @param releaseVersion {String} eg "0.1"
|
||||||
_populateWarehouseForRelease: function (releaseVersion, background) {
|
_populateWarehouseForRelease: function (releaseVersion, showInstalling) {
|
||||||
var future = new Future;
|
var future = new Future;
|
||||||
var releasesDir = path.join(warehouse.getWarehouseDir(), 'releases');
|
var releasesDir = path.join(warehouse.getWarehouseDir(), 'releases');
|
||||||
files.mkdir_p(releasesDir, 0755);
|
files.mkdir_p(releasesDir, 0755);
|
||||||
@@ -271,7 +272,7 @@ _.extend(warehouse, {
|
|||||||
if (releaseAlreadyExists && !newPieces)
|
if (releaseAlreadyExists && !newPieces)
|
||||||
return releaseManifest;
|
return releaseManifest;
|
||||||
|
|
||||||
if (newPieces && !background) {
|
if (newPieces && showInstalling) {
|
||||||
console.log("Installing Meteor %s:", releaseVersion);
|
console.log("Installing Meteor %s:", releaseVersion);
|
||||||
if (newPieces.tools) {
|
if (newPieces.tools) {
|
||||||
console.log(" * 'meteor' build tool (version %s)",
|
console.log(" * 'meteor' build tool (version %s)",
|
||||||
@@ -292,7 +293,7 @@ _.extend(warehouse, {
|
|||||||
warehouse._platform(),
|
warehouse._platform(),
|
||||||
warehouse.getWarehouseDir());
|
warehouse.getWarehouseDir());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!background)
|
if (showInstalling)
|
||||||
console.error("Failed to load tools for release " + releaseVersion);
|
console.error("Failed to load tools for release " + releaseVersion);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@@ -309,7 +310,7 @@ _.extend(warehouse, {
|
|||||||
warehouse._platform(),
|
warehouse._platform(),
|
||||||
warehouse.getWarehouseDir());
|
warehouse.getWarehouseDir());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!background)
|
if (showInstalling)
|
||||||
console.error("Failed to load packages for release " +
|
console.error("Failed to load packages for release " +
|
||||||
releaseVersion);
|
releaseVersion);
|
||||||
throw e;
|
throw e;
|
||||||
@@ -337,9 +338,9 @@ _.extend(warehouse, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finally, clear the "fresh" files for all the things we just printed
|
// Finally, clear the "fresh" files for all the things we just printed
|
||||||
// (whether or not we just downloaded them), unless we were in the
|
// (whether or not we just downloaded them). (Don't do this if we didn't
|
||||||
// background and printed nothing.
|
// print the installing message!)
|
||||||
if (newPieces && !background) {
|
if (newPieces && showInstalling) {
|
||||||
if (newPieces.tools) {
|
if (newPieces.tools) {
|
||||||
fs.unlinkSync(warehouse.getToolsFreshFile(newPieces.tools.version));
|
fs.unlinkSync(warehouse.getToolsFreshFile(newPieces.tools.version));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user