Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Aug 24, 2015
2 parents e7bb6cd + 99cc6cd commit b5ccea3
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 32 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
@@ -1,11 +1,18 @@
## [v5.10.0](https://github.com/sierrasoftworks/iridium/tree/v5.10.0)
- [375494a](https://github.com/sierrasoftworks/iridium/commit/375494a) Version 5.10.0
- [09bfb53](https://github.com/sierrasoftworks/iridium/commit/09bfb53) (origin/master, origin/HEAD) Make use of arrow functions in Core (Closes [#16](https://github.com/sierrasoftworks/iridium/issues/16))
- [d565312](https://github.com/sierrasoftworks/iridium/commit/d565312) Include compiled fix from 5.9.2
- [f7f9db1](https://github.com/sierrasoftworks/iridium/commit/f7f9db1) Make core.connect async-safe (Fixes #15)
- [0697117](https://github.com/sierrasoftworks/iridium/commit/0697117) Updated CHANGELOG

## [v5.9.2](https://github.com/sierrasoftworks/iridium/tree/v5.9.2)
- [2438155](https://github.com/sierrasoftworks/iridium/commit/2438155) Version 5.9.2
- [b2cb440](https://github.com/sierrasoftworks/iridium/commit/b2cb440) Fix for a strange set of behaviour with the last release
- [b9c13fb](https://github.com/sierrasoftworks/iridium/commit/b9c13fb) Updated changelog generation
- [f656174](https://github.com/sierrasoftworks/iridium/commit/f656174) Revert "Switch to Travis-CI container infrastucture"
- [5261ea0](https://github.com/sierrasoftworks/iridium/commit/5261ea0) Revert "Updated travis config to use MongoDB precise (3.x)"
- [cefc0f4](https://github.com/sierrasoftworks/iridium/commit/cefc0f4) (origin/master, origin/HEAD, infrastructure/travisci-containers) Updated travis config to use MongoDB precise (3.x)
- [cefc0f4](https://github.com/sierrasoftworks/iridium/commit/cefc0f4) (infrastructure/travisci-containers) Updated travis config to use MongoDB precise (3.x)
- [d11c8f3](https://github.com/sierrasoftworks/iridium/commit/d11c8f3) Switch to Travis-CI container infrastucture
- [5a2dc37](https://github.com/sierrasoftworks/iridium/commit/5a2dc37) Updated CHANGELOG

Expand Down Expand Up @@ -74,7 +81,7 @@
## [v5.5.5](https://github.com/sierrasoftworks/iridium/tree/5.5.5)
- [0a71f20](https://github.com/sierrasoftworks/iridium/commit/0a71f20) Version 5.5.5
- [6de8a3f](https://github.com/sierrasoftworks/iridium/commit/6de8a3f) Merge branch 'master' into release
- [a98752e](https://github.com/sierrasoftworks/iridium/commit/a98752e) Automatically prep _references.d.ts during publish (Fixes [#11](https://github.com/sierrasoftworks/iridium/issues/11))
- [a98752e](https://github.com/sierrasoftworks/iridium/commit/a98752e) Automatically prep _references.d.ts during publish (Fixes #11)

## [v5.6.0](https://github.com/sierrasoftworks/iridium/tree/5.6.0)
- [95dec95](https://github.com/sierrasoftworks/iridium/commit/95dec95) Version 5.6.0
Expand Down
30 changes: 18 additions & 12 deletions dist/lib/Core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lib/Core.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lib/Instance.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lib/Instance.js.map

Large diffs are not rendered by default.

33 changes: 19 additions & 14 deletions lib/Core.ts
Expand Up @@ -50,13 +50,15 @@ export default class Core {
this._url = <string>uri;
this._config = config;
}

private _plugins: Plugin[] = [];
private _url: string;
private _config: Configuration;
private _connection: MongoDB.Db;
private _cache: Cache = new NoOpCache();


private _connectPromise: Bluebird<MongoDB.Db>;

/**
* Gets the plugins registered with this Iridium Core
* @returns {[Iridium.Plugin]}
Expand Down Expand Up @@ -156,13 +158,17 @@ export default class Core {
* @returns {Promise}
*/
connect(callback?: (err: Error, core: Core) => any): Bluebird<Core> {
var self = this;
return Bluebird.bind(this).then(function() {
if (self._connection) return self._connection;
return mongoConnectAsyc(self.url);
}).then(function(db: MongoDB.Db) {
self._connection = db;
return self;
return Bluebird.bind(this).then(() => {
if (this._connection) return this._connection;
if (this._connectPromise) return this._connectPromise;
return this._connectPromise = mongoConnectAsyc(this.url);
}).then((db: MongoDB.Db) => {
this._connection = db;
this._connectPromise = null;
return this;
}, (err) => {
this._connectPromise = null;
return Bluebird.reject(err);
}).nodeify(callback);
}

Expand All @@ -171,11 +177,10 @@ export default class Core {
* @type {Promise}
*/
close(): Bluebird<Core> {
var self = this;
return Bluebird.bind(this).then(function() {
if (!self._connection) return this;
var conn: MongoDB.Db = self._connection;
self._connection = null;
return Bluebird.bind(this).then(() => {
if (!this._connection) return this;
var conn: MongoDB.Db = this._connection;
this._connection = null;
conn.close();
return this;
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "iridium",
"version": "5.9.2",
"version": "5.10.0",
"author": "Benjamin Pannell <admin@sierrasoftworks.com>",
"description": "A custom lightweight ORM for MongoDB designed for power-users",
"license": "MIT",
Expand Down

0 comments on commit b5ccea3

Please sign in to comment.