Skip to content

Commit

Permalink
Fixed a couple of bugs. Fixed tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Scanferla committed Sep 15, 2014
1 parent fc18e6f commit b7ba297
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 111 deletions.
43 changes: 22 additions & 21 deletions dist/asteroid.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@

"use strict";

//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};

if (!Asteroid.utils) {
Asteroid.utils = {};
}
Expand Down Expand Up @@ -231,27 +253,6 @@ Asteroid.utils.must = {

};

//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};
// Asteroid instances are EventEmitter-s
Asteroid.prototype = Object.create(Asteroid.utils.EventEmitter.prototype);
Asteroid.prototype.constructor = Asteroid;
Expand Down
43 changes: 22 additions & 21 deletions dist/asteroid.chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@

"use strict";

//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};

if (!Asteroid.utils) {
Asteroid.utils = {};
}
Expand Down Expand Up @@ -231,27 +253,6 @@ Asteroid.utils.must = {

};

//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};
// Asteroid instances are EventEmitter-s
Asteroid.prototype = Object.create(Asteroid.utils.EventEmitter.prototype);
Asteroid.prototype.constructor = Asteroid;
Expand Down
43 changes: 22 additions & 21 deletions dist/asteroid.cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@

"use strict";

//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};

if (!Asteroid.utils) {
Asteroid.utils = {};
}
Expand Down Expand Up @@ -231,27 +253,6 @@ Asteroid.utils.must = {

};

//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};
// Asteroid instances are EventEmitter-s
Asteroid.prototype = Object.create(Asteroid.utils.EventEmitter.prototype);
Asteroid.prototype.constructor = Asteroid;
Expand Down
43 changes: 22 additions & 21 deletions dist/asteroid.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ var DDP = require("ddp.js");
var Q = require("q");
var WebSocket = require("faye-websocket");

//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};

if (!Asteroid.utils) {
Asteroid.utils = {};
}
Expand Down Expand Up @@ -225,27 +247,6 @@ Asteroid.utils.must = {

};

//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};
// Asteroid instances are EventEmitter-s
Asteroid.prototype = Object.create(Asteroid.utils.EventEmitter.prototype);
Asteroid.prototype.constructor = Asteroid;
Expand Down
28 changes: 24 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ var buildBrowser = function () {
var deferred = Q.defer();
gulp.src([
"src/platforms/browser/wrapper/head.js",
"src/core/asteroid-constructor.js",
"src/core/lib/*.js",
"src/core/*.js",
"src/core/asteroid-methods.js",
"src/core/collection.js",
"src/core/login.js",
"src/core/set.js",
"src/core/subscription.js",
"src/platforms/browser/*.js",
"src/platforms/browser/wrapper/tail.js"
])
Expand All @@ -44,8 +49,13 @@ var buildChrome = function () {
var deferred = Q.defer();
gulp.src([
"src/platforms/chrome/wrapper/head.js",
"src/core/asteroid-constructor.js",
"src/core/lib/*.js",
"src/core/*.js",
"src/core/asteroid-methods.js",
"src/core/collection.js",
"src/core/login.js",
"src/core/set.js",
"src/core/subscription.js",
"src/platforms/chrome/*.js",
"src/platforms/chrome/wrapper/tail.js"
])
Expand All @@ -62,8 +72,13 @@ var buildCordova = function () {
var deferred = Q.defer();
gulp.src([
"src/platforms/cordova/wrapper/head.js",
"src/core/asteroid-constructor.js",
"src/core/lib/*.js",
"src/core/*.js",
"src/core/asteroid-methods.js",
"src/core/collection.js",
"src/core/login.js",
"src/core/set.js",
"src/core/subscription.js",
"src/platforms/cordova/*.js",
"src/platforms/cordova/wrapper/tail.js"
])
Expand All @@ -80,8 +95,13 @@ var buildNode = function () {
var deferred = Q.defer();
gulp.src([
"src/platforms/node/wrapper/head.js",
"src/core/asteroid-constructor.js",
"src/core/lib/*.js",
"src/core/*.js",
"src/core/asteroid-methods.js",
"src/core/collection.js",
"src/core/login.js",
"src/core/set.js",
"src/core/subscription.js",
"src/platforms/node/*.js",
"src/platforms/node/wrapper/tail.js"
])
Expand Down
21 changes: 21 additions & 0 deletions src/core/asteroid-constructor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};
21 changes: 0 additions & 21 deletions src/core/asteroid.js → src/core/asteroid-methods.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
//////////////////////////
// Asteroid constructor //
//////////////////////////

var Asteroid = function (host, ssl, socketInterceptFunction, instanceId) {
// Assert arguments type
Asteroid.utils.must.beString(host);
// An id may be assigned to the instance. This is to support
// resuming login of multiple connections to the same host.
this._instanceId = instanceId || "0";
// Configure the instance
this._host = (ssl ? "https://" : "http://") + host;
// Reference containers
this.collections = {};
this.subscriptions = {};
this._subscriptionsCache = {};
// Set __ddpOptions
this._setDdpOptions(host, ssl, socketInterceptFunction);
// Init the instance
this._init();
};
// Asteroid instances are EventEmitter-s
Asteroid.prototype = Object.create(Asteroid.utils.EventEmitter.prototype);
Asteroid.prototype.constructor = Asteroid;
Expand Down
2 changes: 1 addition & 1 deletion test/asteroid.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ describe("A reactive query", function () {
if (ENV === "node") {

describe("The getFilterFromSelector function should return a function which filters objetcs", function () {
var getFilterFromSelector = Asteroid.__get__("getFilterFromSelector");
var getFilterFromSelector = Asteroid.utils.getFilterFromSelector;
var item0 = {
_id: "postOne",
title: "TitleOne",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/filter.unit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if (ENV === "node") {

describe("The getFilterFromSelector function should return a function which filters objetcs", function () {
var getFilterFromSelector = Asteroid.__get__("getFilterFromSelector");
var getFilterFromSelector = Asteroid.utils.getFilterFromSelector;
var item0 = {
_id: "postOne",
title: "TitleOne",
Expand Down

0 comments on commit b7ba297

Please sign in to comment.