mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
future.wrap on get_manifest didn't work (bad callback type).
just make it sync instead.
This commit is contained in:
@@ -370,7 +370,8 @@ Fiber(function () {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
require(path.join(__dirname, 'update.js'));
|
||||
var update = require(path.join(__dirname, 'update.js'));
|
||||
update.updateMeteor();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
33
lib/run.js
33
lib/run.js
@@ -497,20 +497,25 @@ _.extend(DependencyWatcher.prototype, {
|
||||
// XXX this should move to main meteor command-line, probably?
|
||||
var start_update_checks = function () {
|
||||
var update_check = function () {
|
||||
updater.get_manifest(function (manifest) {
|
||||
if (!files.in_checkout() && manifest &&
|
||||
updater.needs_upgrade(manifest)) {
|
||||
console.log("////////////////////////////////////////");
|
||||
console.log("////////////////////////////////////////");
|
||||
console.log();
|
||||
console.log("meteor is out of date. Please run:");
|
||||
console.log();
|
||||
console.log(" meteor update");
|
||||
console.log();
|
||||
console.log("////////////////////////////////////////");
|
||||
console.log("////////////////////////////////////////");
|
||||
}
|
||||
});
|
||||
// XXX update for engine
|
||||
try {
|
||||
var manifest = updater.getManifest();
|
||||
} catch (e) {
|
||||
// Ignore errors (eg, offline)
|
||||
return;
|
||||
}
|
||||
if (!files.in_checkout() && manifest &&
|
||||
updater.needs_upgrade(manifest)) {
|
||||
console.log("////////////////////////////////////////");
|
||||
console.log("////////////////////////////////////////");
|
||||
console.log();
|
||||
console.log("meteor is out of date. Please run:");
|
||||
console.log();
|
||||
console.log(" meteor update");
|
||||
console.log();
|
||||
console.log("////////////////////////////////////////");
|
||||
console.log("////////////////////////////////////////");
|
||||
}
|
||||
};
|
||||
setInterval(update_check, 12*60*60*1000); // twice a day
|
||||
update_check(); // and now.
|
||||
|
||||
@@ -19,8 +19,11 @@ if (files.in_checkout()) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Immediately kick off manifest check.
|
||||
updater.get_manifest(function (manifest) {
|
||||
// XXX update for engine
|
||||
var updateMeteor = function () {
|
||||
// Immediately kick off manifest check.
|
||||
// XXX error check
|
||||
var manifest = updater.getManifest();
|
||||
|
||||
//// Examine manifest and see if we need to upgrade.
|
||||
|
||||
@@ -248,4 +251,4 @@ updater.get_manifest(function (manifest) {
|
||||
});
|
||||
req.end();
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
@@ -9,52 +9,21 @@ var http = require("http");
|
||||
var https = require("https");
|
||||
var path = require("path");
|
||||
var semver = require("semver");
|
||||
var Future = require('fibers/future');
|
||||
|
||||
var files = require(path.join(__dirname, 'files.js'));
|
||||
|
||||
var manifest_options = testingUpdater ? {
|
||||
host: 's3.amazonaws.com',
|
||||
path: '/com.meteor.static/test/update/manifest.json'
|
||||
} : {
|
||||
host: 'update.meteor.com',
|
||||
path: '/manifest.json'
|
||||
};
|
||||
var manifestUrl = testingUpdater
|
||||
? 'https://s3.amazonaws.com/com.meteor.static/test/update/manifest.json'
|
||||
: 'https://update.meteor.com/manifest.json';
|
||||
|
||||
|
||||
/**
|
||||
* Downloads the current manifest file and returns it via a callback (or
|
||||
* null on error)
|
||||
*/
|
||||
// XXX make this synchronous
|
||||
exports.get_manifest = function (callback) {
|
||||
// XXX this is gross. use files.getUrl instead.
|
||||
var req = https.request(manifest_options, function(res) {
|
||||
if (res.statusCode !== 200) {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
res.setEncoding('utf8');
|
||||
var manifest = '';
|
||||
res.on('data', function (chunk) {
|
||||
manifest = manifest + chunk;
|
||||
});
|
||||
res.on('end', function () {
|
||||
var parsed;
|
||||
try {
|
||||
parsed = JSON.parse(manifest);
|
||||
} catch (err) {
|
||||
parsed = null;
|
||||
};
|
||||
callback(parsed);
|
||||
});
|
||||
});
|
||||
req.addListener('error', function (err) {
|
||||
// Need to register an error handler or node will crash:
|
||||
// http://rentzsch.tumblr.com/post/664884799/node-js-handling-refused-http-client-connections
|
||||
|
||||
callback(null);
|
||||
});
|
||||
req.end();
|
||||
exports.getManifest = function () {
|
||||
return Future.wrap(files.getUrl)({url: manifestUrl, json: true});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -95,7 +95,7 @@ var warehouse = module.exports = {
|
||||
|
||||
// XXX make errors prettier
|
||||
fetchLatestRelease: function () {
|
||||
var manifest = Future.wrap(updater.get_manifest)().wait();
|
||||
var manifest = updater.getManifest();
|
||||
// XXX in the future support release channels other than stable
|
||||
var releaseName = manifest.releases.stable;
|
||||
if (!releaseName) {
|
||||
|
||||
Reference in New Issue
Block a user