Skip to content
Browse files

Merge branch 'josh' into weo

  • Loading branch information...
2 parents 4afe1aa + d791380 commit a7a0e6206f9ab2d341a40c837f8b521d85305b96 @joshrtay joshrtay committed Aug 28, 2012
View
6 app/meteor/meteor.js
@@ -790,8 +790,8 @@ Commands.push({
// to match what was sent, in order to pass IOS security check.
// Hopefully they will update to a more recent websocket standard
// soon
- var _write = socket.write;
- socket.write = function(data){
+ /*var _write = socket.write;
+ socket.write = function(data) {
socket.write = _write;
var sdata = data.toString();
@@ -807,7 +807,7 @@ Commands.push({
}
return _write.apply(this, arguments);
- };
+ };*/
// app.proxy.proxyWebSocketRequest(req, socket, head);
p.proxy.proxyWebSocketRequest(req, socket, head,
View
16 app/meteor/run.js
@@ -170,6 +170,7 @@ var log_to_clients = function (msg) {
var start_server = function (bundle_path, port, mongo_url,
on_exit_callback, on_listen_callback) {
+ console.log('start server');
// environment
var env = {};
for (var k in process.env)
@@ -353,7 +354,7 @@ _.extend(DependencyWatcher.prototype, {
self.watches[filepath] = function() { fs.unwatchFile(filepath); };
} else {
// fs.watchFile doesn't work for directories (as tested on ubuntu)
- var watch = fs.watch(filepath, {interval: 500}, // poll a lot!
+ var watch = fs.watch(filepath, {}, // poll a lot!
_.bind(self._scan, self, false, filepath));
self.watches[filepath] = function() { watch.close(); };
}
@@ -451,6 +452,7 @@ var start_update_checks = function () {
// can't continue. If you change this, remember to call
// watcher.destroy() as appropriate.
exports.run = function (app_dir, bundle_opts, port) {
+ console.log('run');
var outer_port = port || 3000;
var inner_port = outer_port + 1;
var mongo_port = outer_port + 2;
@@ -523,7 +525,9 @@ exports.run = function (app_dir, bundle_opts, port) {
bundle_opts.subapp = 'root';
errors.concat(bundler.bundle(app_dir, bundle_path, bundle_opts));*/
+ console.log('start bundle', +new Date());
errors = bundler.bundle(app_dir, bundle_path, bundle_opts);
+ console.log('end bundle', +new Date());
@@ -563,7 +567,9 @@ exports.run = function (app_dir, bundle_opts, port) {
return;
}
+
start_watching();
+ console.log('finished start watching')
Status.running = true;
server_handle = start_server(bundle_path, inner_port, mongo_url, function () {
// on server exit
@@ -579,7 +585,7 @@ exports.run = function (app_dir, bundle_opts, port) {
request_queue = [];
});
-
+ console.log('finished start server');
// launch test bundle and server if needed.
if (test_bundle_opts) {
var errors =
@@ -612,6 +618,7 @@ exports.run = function (app_dir, bundle_opts, port) {
mongo_port,
function () { // On Mongo startup complete
// don't print mongo startup is slow warning.
+ console.log('mongo complete');
if (mongo_startup_print_timer) {
clearTimeout(mongo_startup_print_timer);
mongo_startup_print_timer = null;
@@ -621,9 +628,11 @@ exports.run = function (app_dir, bundle_opts, port) {
process_startup_printer();
process_startup_printer = null;
}
+ console.log('restart server from mongo');
restart_server();
},
function (code, signal) { // On Mongo dead
+ console.log('mongo code');
console.log("Unexpected mongo exit code " + code + ". Restarting.");
// if mongo dies 3 times with less than 5 seconds between each,
@@ -643,9 +652,11 @@ exports.run = function (app_dir, bundle_opts, port) {
// Wait a sec to restart.
setTimeout(launch, 1000);
});
+
};
start_proxy(outer_port, inner_port, function () {
+ console.log('proxy');
process.stdout.write("[[[[[ " + files.pretty_path(app_dir) + " ]]]]]\n\n");
mongo_startup_print_timer = setTimeout(function () {
@@ -656,6 +667,7 @@ exports.run = function (app_dir, bundle_opts, port) {
};
start_update_checks();
+ console.log('finish start update check');
launch();
});
};
View
5 app/server/server.js
@@ -64,6 +64,7 @@ var runtime_config = function (app_html) {
};
var run = function () {
+ console.log('run');
var bundle_dir = path.join(__dirname, '..');
// check environment
@@ -90,7 +91,9 @@ var run = function () {
io = require('socket.io');
io = io.listen(app);
- io.set('log level', 1);
+ io.set('log level', 1);
+ io.set('transports', [
+ 'websocket']);
// read bundle config file
var info_raw =
View
3 dev_bundle/lib/node_modules/http-proxy/node_modules/colors/package.json
@@ -21,8 +21,5 @@
"_npmVersion": "1.1.21",
"_nodeVersion": "v0.6.17",
"_defaultsLoaded": true,
- "dist": {
- "shasum": "745a58923ea91476ff0c34ea9ff63a1982d98366"
- },
"_from": "colors@0.x.x"
}
View
3 dev_bundle/lib/node_modules/http-proxy/node_modules/optimist/package.json
@@ -49,8 +49,5 @@
"_npmVersion": "1.1.21",
"_nodeVersion": "v0.6.17",
"_defaultsLoaded": true,
- "dist": {
- "shasum": "b8e7f9d4314d812f4cce5935e96bb2f79b1f1dcc"
- },
"_from": "optimist@0.2.x"
}
View
3 dev_bundle/lib/node_modules/http-proxy/node_modules/pkginfo/package.json
@@ -32,8 +32,5 @@
"_npmVersion": "1.1.21",
"_nodeVersion": "v0.6.17",
"_defaultsLoaded": true,
- "dist": {
- "shasum": "86695c46ad8bb31d673a80d7ddca0bd024dc223e"
- },
"_from": "pkginfo@0.2.x"
}
View
2 dev_bundle/lib/node_modules/http-proxy/package.json
@@ -64,7 +64,7 @@
"_nodeVersion": "v0.6.17",
"_defaultsLoaded": true,
"dist": {
- "shasum": "29fa5acca826a9b1deae35422befc1cdeeeac3c9"
+ "shasum": "42a6f44657b502227cc049c660a7858056750028"
},
"_from": "http-proxy@0.8.0"
}
View
22 examples/other/template-demo/client/template-demo.js
@@ -14,9 +14,7 @@ if (! Session.get("z")) {
Session.set("z", 1);
}
-<<<<<<< HEAD:examples/landmark-demo/client/landmark-demo.js
-Template.redrawButtons.events = {
-=======
+
Template.preserveDemo.x =
Template.constantDemo.x =
Template.stateDemo.x =
@@ -34,11 +32,16 @@ function () {
};
<<<<<<< HEAD
+
+Template.page.events({
+=======
+<<<<<<< HEAD
Template.page.events = {
>>>>>>> 87bebaa50dc16e9b2df4fb78237421b9b44e4a32:examples/other/template-demo/client/template-demo.js
=======
Template.page.events({
>>>>>>> 9005cf34a0efeedfb339bbb7fd6ef7de6cb37def
+>>>>>>> d6b9f4960f57f2e43e76bce760253958d48c289e
'click input.x': function () {
Session.set("x", Session.get("x") + 1);
},
@@ -75,6 +78,12 @@ Template.preserveDemo.spinAnim = function () {
};
<<<<<<< HEAD
+
+Template.preserveDemo.events({
+ 'change .spinforward' : function (event) {
+ Session.set('spinForward', event.currentTarget.checked);
+=======
+<<<<<<< HEAD
Template.preserveDemo.events = {
'change .spinforward' : function (event,template) {
template.set('spinForward', event.currentTarget.checked);
@@ -83,6 +92,7 @@ Template.preserveDemo.events({
'change .spinforward' : function (event) {
Session.set('spinForward', event.currentTarget.checked);
>>>>>>> 9005cf34a0efeedfb339bbb7fd6ef7de6cb37def
+>>>>>>> d6b9f4960f57f2e43e76bce760253958d48c289e
}
});
@@ -192,6 +202,10 @@ Template.d3Demo.right = function () {
};
<<<<<<< HEAD
+
+Template.circles.events({
+=======
+<<<<<<< HEAD
Template.circles.events = {
<<<<<<< HEAD:examples/landmark-demo/client/landmark-demo.js
'click circle': function (evt, template) {
@@ -204,9 +218,9 @@ Template.circles.events = {
=======
Template.circles.events({
>>>>>>> 9005cf34a0efeedfb339bbb7fd6ef7de6cb37def
+>>>>>>> d6b9f4960f57f2e43e76bce760253958d48c289e
'mousedown circle': function (evt, template) {
Session.set("selectedCircle:" + this.group, evt.currentTarget.id);
->>>>>>> 87bebaa50dc16e9b2df4fb78237421b9b44e4a32:examples/other/template-demo/client/template-demo.js
},
'click .add': function () {
Circles.insert({x: Meteor.random(), y: Meteor.random(),
View
1 examples/todos/.meteor/packages
@@ -12,3 +12,4 @@ accounts-weibo
accounts-google
accounts-facebook
accounts-passwords
+streamio
View
4 examples/todos/client/todos.js
@@ -241,7 +241,11 @@ Template.todo_item.events[ okcancel_events('#todo-input') ] =
Template.todo_item.events(okCancelEvents(
'#todo-input',
{
+<<<<<<< HEAD
+>>>>>>> 1ca5357b28fa2a433a9eeb45144747c6a5c449b5
+=======
>>>>>>> 9005cf34a0efeedfb339bbb7fd6ef7de6cb37def
+>>>>>>> d6b9f4960f57f2e43e76bce760253958d48c289e
ok: function (value) {
Todos.update(this._id, {$set: {text: value}});
Session.set('editing_itemname', null);
View
27 packages/deps/tools.js
@@ -21,8 +21,11 @@ var ReactiveVar = function(initialValue) {
initialValue);
this._deps = {};
this._equals_deps = {};
+
};
+
+
ReactiveVar.prototype.get = function() {
var self = this;
@@ -48,6 +51,7 @@ ReactiveVar.prototype.set = function(newValue, notReactive) {
self._value = newValue;
if (notReactive) return;
+ console.log('invalidate');
for(var id in self._deps)
self._deps[id].invalidate();
@@ -98,6 +102,20 @@ var ReactiveDict = function(initialValues) {
for (key in initialValues)
this._vars[key] = ReactiveVar(initialValues[key]);
+ this._key_deps = {};
+}
+
+// make this reactive
+ReactiveDict.prototype.keys = function() {
+ var self = this;
+ var context = Meteor.deps.Context.current;
+ if (context && !(context.id in self._key_deps)) {
+ self._key_deps[context.id] = context;
+ context.on_invalidate(function() {
+ delete self._key_deps[context.id];
+ });
+ }
+ return _.keys(this._vars);
}
ReactiveDict.prototype.get = function(key) {
@@ -127,8 +145,13 @@ ReactiveDict.prototype.equals = function(key, value) {
}
ReactiveDict.prototype._ensureKey = function(key) {
- if (!(key in this._vars))
- this._vars[key] = ReactiveVar();
+ var self = this;
+ if (!(key in self._vars)) {
+ self._vars[key] = ReactiveVar();
+ for(var id in self._key_deps)
+ self._key_deps[id].invalidate();
+ }
+
}
ReactiveDict.prototype.all = function() {
View
15 packages/livedata/livedata_connection.js
@@ -152,6 +152,7 @@ Meteor._LivedataConnection = function (url, restart_on_update) {
if (restart_on_update) {
self.stream.on('update_available', function () {
+ console.log('update_available');
// Start trying to migrate to a new version. Until all packages
// signal that they're ready for a migration, the app will
// continue running normally.
@@ -203,6 +204,7 @@ _.extend(Meteor._LivedataConnection.prototype, {
subscribe: function (name /* .. [arguments] .. callback */) {
var self = this;
var id;
+ var complete = false;
var args = Array.prototype.slice.call(arguments, 1);
if (args.length && typeof args[args.length - 1] === "function")
@@ -228,6 +230,9 @@ _.extend(Meteor._LivedataConnection.prototype, {
self.subs.insert({_id: id, name: name, args: args, count: 1});
self.sub_ready_callbacks[id] = [];
+ self.sub_ready_callbacks[id].push(function() {
+ complete = true;
+ })
if (callback)
self.sub_ready_callbacks[id].push(callback);
@@ -238,7 +243,15 @@ _.extend(Meteor._LivedataConnection.prototype, {
if (!id) return; // must have an id (local from above).
// just update the database. observe takes care of the rest.
self.subs.update({_id: id}, {$inc: {count: -1}});
- }};
+ },
+ complete: function() {
+ return complete || existing && existing[0];
+ },
+ completed: function(cb) {
+ self.sub_ready_callbacks[id].push(cb);
+ }
+
+ };
if (Meteor._capture_subs)
Meteor._capture_subs.push(token);
View
4 packages/mongo-livedata/local_collection_driver.js
@@ -27,7 +27,7 @@ Meteor._LocalCollectionDriver = new Meteor._LocalCollectionDriver;
//speed up reload and ensure that first render after reload
//has same state as the last render before reload
//XXX this is geting errors
-/*if (Meteor._reload) {
+if (Meteor._reload) {
Meteor._reload.on_migrate('Collections',function() {
var collections = {};
_.each(Meteor._LocalCollectionDriver.collections,function(collection,name) {
@@ -38,4 +38,4 @@ Meteor._LocalCollectionDriver = new Meteor._LocalCollectionDriver;
(function() {
Meteor._LocalCollectionDriver.migrationData = Meteor._reload.migration_data('Collections') || {};
})();
-}*/
+}
View
14 packages/mongo-livedata/mongo_driver.js
@@ -17,6 +17,7 @@ _Mongo = function (url) {
var self = this;
self.collection_queue = [];
+ self.db_callbacks = [];
MongoDB.connect(url, function(err, db) {
if (err)
@@ -30,9 +31,21 @@ _Mongo = function (url) {
db.collection(c.name, c.callback);
}).run();
}
+
+ while((c = self.db_callbacks.pop())) {
+ c(db);
+ }
});
};
+_Mongo.prototype.withDB = function(cb) {
+ var self = this;
+ if (self.db)
+ cb(self.db);
+ else
+ self.db_callbacks.push(cb);
+}
+
// protect against dangerous selectors. falsey and {_id: falsey}
// are both likely programmer error, and not what you want,
// particularly for destructive operations.
@@ -95,6 +108,7 @@ _Mongo.prototype._maybeBeginWrite = function () {
_Mongo.prototype.insert = function (collection_name, document) {
var self = this;
+ console.log('insert',collection_name,document);
if (collection_name === "___meteor_failure_test_collection" &&
document.fail) {
View
17 packages/spark/spark.js
@@ -516,6 +516,18 @@ Spark.renderToRange = function (range, htmlFunc) {
});
};
+ // Find landmarks enclosing range, from inner to outer
+ var enclosingLandmarks = [];
+ var walk = range;
+ while ((walk = findParentOfType(Spark._ANNOTATION_LANDMARK, walk)))
+ enclosingLandmarks.push(walk);
+
+ // Render the new contents. Must call 'enter' and 'exit' on
+ // enclosing landmarks as appropriate.
+ _.each(_.clone(enclosingLandmarks).reverse(), function (containingRange) {
+ containingRange.enterCallback.call(containingRange.landmark);
+ });
+
// Find all of the landmarks in the old contents of the range
visitLandmarksInRange(range, function (landmarkRange, notes) {
notes.originalRange = landmarkRange;
@@ -1079,12 +1091,17 @@ Spark.createLandmark = function (options, htmlFunc) {
}
notes.landmark = landmark;
+ options.enter = options.enter || function () {};
+
+ options.enter.call(landmark);
+
var html = htmlFunc(landmark);
return renderer.annotate(
html, Spark._ANNOTATION_LANDMARK, function (range) {
_.extend(range, {
preserve: preserve,
constant: !! options.constant,
+ enterCallback: options.enter,
rendered: options.rendered || function () {},
destroyed: options.destroyed || function () {},
landmark: landmark,
View
1 packages/templating/deftemplate.js
@@ -142,6 +142,7 @@
};
Meteor.templateFromLandmark = templateObjFromLandmark;
+ Meteor.templatesById = {};
// XXX forms hooks into this to add "bind"?
Meteor._template_decl_methods = {

0 comments on commit a7a0e62

Please sign in to comment.
Something went wrong with that request. Please try again.