Patches to make livedata load from non-server nodejs

This commit is contained in:
Geoff Schmidt
2013-04-16 22:07:51 -07:00
committed by David Glasser
parent 302d625cba
commit 9931898d22
4 changed files with 36 additions and 20 deletions

View File

@@ -1,13 +1,24 @@
if (process.env.DDP_DEFAULT_CONNECTION_URL) {
__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL =
process.env.DDP_DEFAULT_CONNECTION_URL;
}
_.extend(Meteor, {
default_server: new Meteor._LivedataServer,
default_server: null,
refresh: function (notification) {
}
});
if (typeof __meteor_bootstrap__ == 'undefined' ||
!__meteor_bootstrap__.app) {
// We haven't been loaded in an environment with a HTTP server (for
// example, we might be being loaded from a command-line tool.)
// Don't create a server.. don't even map publish, methods, call,
// etc onto Meteor.
} else {
if (process.env.DDP_DEFAULT_CONNECTION_URL) {
__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL =
process.env.DDP_DEFAULT_CONNECTION_URL;
}
Meteor.default_server = new Meteor._LivedataServer;
Meteor.refresh = function (notification) {
var fence = Meteor._CurrentWriteFence.get();
if (fence) {
// Block the write fence until all of the invalidations have
@@ -18,13 +29,13 @@ _.extend(Meteor, {
if (proxy_write)
proxy_write.committed();
});
}
});
};
// Proxy the public methods of Meteor.default_server so they can
// be called directly on Meteor.
_.each(['publish', 'methods', 'call', 'apply'],
function (name) {
Meteor[name] = _.bind(Meteor.default_server[name],
Meteor.default_server);
});
// Proxy the public methods of Meteor.default_server so they can
// be called directly on Meteor.
_.each(['publish', 'methods', 'call', 'apply'],
function (name) {
Meteor[name] = _.bind(Meteor.default_server[name],
Meteor.default_server);
});
}

View File

@@ -62,6 +62,13 @@ _.extend(Meteor.__RoutePolicyConstructor.prototype, {
var self = this;
if (type === 'static-online')
return null;
if (typeof __meteor_bootstrap__ === "undefined" ||
!__meteor_bootstrap__.bundle || !__meteor_bootstrap__.bundle.manifest)
// Hack: If we don't have a manifest, deal with it
// gracefully. This lets us load livedata into a nodejs
// environment that doesn't have a HTTP server (eg, a
// command-line tool).
return null;
var manifest = _testManifest || __meteor_bootstrap__.bundle.manifest;
var conflict = _.find(manifest, function (resource) {
return (resource.type === 'static' &&

View File

@@ -1 +0,0 @@
.build*

View File

@@ -1033,9 +1033,8 @@ Fiber(function () {
// Load any needed unipackages
require('./unipackage.js').load({
library: context.library,
packages: ['random'], // add any unipackages here
packages: [], // add any unipackages here
release: context.releaseVersion
,
});
if (argv['get-ready']) {