Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
Merge dda6a91 into cce4e8f
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinsmith1024 committed Jan 8, 2016
2 parents cce4e8f + dda6a91 commit f87d769
Show file tree
Hide file tree
Showing 76 changed files with 3,700 additions and 3,579 deletions.
12 changes: 11 additions & 1 deletion .travis.yml
@@ -1,5 +1,13 @@
env:
- CXX=g++-4.8

addons:
postgresql: "9.3"
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8

before_script:
- npm install -g grunt-cli
Expand All @@ -15,4 +23,6 @@ after_script:

language: node_js
node_js:
- 0.10
- "4"
- "5"
- "stable"
24 changes: 22 additions & 2 deletions Gruntfile.js
Expand Up @@ -2,12 +2,33 @@
module.exports = function (grunt) {
// Project configuration.

// Automatic module definition loading. Significantly speeds up build cycles
require('jit-grunt')(grunt);

// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);

// Project configuration.
var DEFAULT_COVERAGE_ARGS = ["cover", "-x", "Gruntfile.js", "--report", "none", "--print", "none", "--include-pid", "grunt", "--", "it"];

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

patio: {
paths: {
root: './',
lib: './lib',
test: './test'
}
},

jshint: {
src: ["./index.js", "lib/**/*.js", "Gruntfile.js"],
src: [
"./index.js",
"<%= patio.paths.lib %>/**/*.js",
"<%= patio.paths.test %>/**/*.js",
"Gruntfile.js"
],
options: {
jshintrc: '.jshintrc'
}
Expand Down Expand Up @@ -101,4 +122,3 @@ module.exports = function (grunt) {


};

6 changes: 5 additions & 1 deletion History.md
@@ -1,3 +1,7 @@
# 1.0.0

* Adding Node 4 and 5 support.

# 0.9.5

* Remove `id` key from being created in a JsonArray
Expand Down Expand Up @@ -339,4 +343,4 @@
# 0.0.1 / 2012-01-31


* Initial release
* Initial release
4 changes: 4 additions & 0 deletions docs/History.html
Expand Up @@ -362,6 +362,10 @@



<h1 id="1-0-0">1.0.0</h1>
<ul>
<li>Adding Node 4 and 5 support.</li>
</ul>
<h1 id="0-9-5">0.9.5</h1>
<ul>
<li>Remove <code>id</code> key from being created in a JsonArray</li>
Expand Down
1 change: 0 additions & 1 deletion docs/patio_Model.html
Expand Up @@ -837,7 +837,6 @@
</td><tr><tr><td><em>isRestrictedPrimaryKey</em></td><td>property</td><td><code>false
</code></td><td><p>Set to false to allow the setting of primary keys.</p>
</td><tr><tr><td><em>patio</em></td><td>function</td><td></td><td><p>A reference to the global <a href='./patio.html#'> patio</a>.</p>
</td><tr><tr><td><em>patio</em></td><td>patio</td><td><code>null</code></td><td><p>patio - read only</p>
</td><tr><tr><td><em>primaryKey</em></td><td>function</td><td></td><td><p>The primaryKey column/s of this <a href='./patio_Model.html#'> patio.Model</a></p>
</td><tr><tr><td><em>raiseOnTypecastError</em></td><td>property</td><td><code>true
</code></td><td><p>Set to false to prevent errors thrown while type casting a value from being propogated.</p>
Expand Down
3 changes: 2 additions & 1 deletion example/application/helpers.js
Expand Up @@ -3,6 +3,7 @@ var patio = require("../../index"),
helper = require("./schemas"),
comb = require("comb"),
models = require("./models");

exports.loadData = function () {
patio.camelize = true;
return helper.createTables().chain(function () {
Expand All @@ -17,4 +18,4 @@ exports.loadData = function () {

exports.dropModels = function () {
return helper.dropTableAndDisconnect();
};
};
7 changes: 3 additions & 4 deletions example/application/schemas.js
Expand Up @@ -71,8 +71,7 @@ exports.createTables = function () {


exports.dropTableAndDisconnect = function () {
return comb.executeInOrder(patio, DB, function (patio, db) {
db.forceDropTable(["leg_instance", "flight_leg", "flight", "airplane", "can_land", "airplane_type", "airport"]);
patio.disconnect();
return db.forceDropTable(["leg_instance", "flight_leg", "flight", "airplane", "can_land", "airplane_type", "airport"]).chain(function(){
return patio.disconnect();
});
};
};
2 changes: 1 addition & 1 deletion lib/adapters/postgres.js
Expand Up @@ -1053,4 +1053,4 @@ var DB = define(Database, {
}

}
}).as(exports, "PostgresDatabase");
}).as(exports, "PostgresDatabase");
2 changes: 1 addition & 1 deletion lib/adapters/redshift.js
Expand Up @@ -54,4 +54,4 @@ PostgresDatabase.extend({
}

}
}).as("RedshiftDatabase");
}).as(exports, "RedshiftDatabase");
2 changes: 1 addition & 1 deletion lib/associations/manyToMany.js
Expand Up @@ -197,9 +197,9 @@ module.exports = define(OneToMany, {
if (!isUndefinedOrNull(items) && (index = items.indexOf(item)) !== -1) {
items.splice(index, 1);
}
return when(model);
}
}
return when(model);
},

removeAllItems: function (model, remove) {
Expand Down
3 changes: 1 addition & 2 deletions lib/dataset/index.js
Expand Up @@ -27,6 +27,7 @@ var comb = require("comb"),


var LOGGER = comb.logger("patio.Dataset");

define([actions, graph, features, query, sql], {
instance: {

Expand Down Expand Up @@ -457,5 +458,3 @@ define([actions, graph, features, query, sql], {
COLUMN_REF_RE3: /^(\w+)__(\w+)$/
}
}).as(module);


38 changes: 0 additions & 38 deletions lib/index.js
Expand Up @@ -172,44 +172,6 @@ var Patio = singleton([EventEmitter, Time], {
return this.createConnection.apply(this, arguments);
},

/**
* This method allows one to connect to a database and immediately execute code.
* For connection options @see patio#createConnection
*
* @example
*
*
* var DB;
* var CONNECT_STRING = "dummyDB://test:testpass@localhost/dummySchema";
* var connectPromise = patio.connectAndExecute(CONNECT_STRING, function (db) {
* db.dropTable("test");
* db.createTable("test", function () {
* this.primaryKey("id");
* this.name(String);
* this.age(Number);
* });
* });
*
* connectPromise.chain(function (db) {
* //do more stuff!
* });
*
* @param {String|Object} options @see patio#createConnection
* @param {Function} cb the function to callback once connected.
*
* @returns {comb.Promise} a promise that is resolved once the database execution has finished.
*/
connectAndExecute: function (options, cb) {
if (!isFunction(cb)) {
throw new PatioError("callback must be a function");
}
var db = this.createConnection.apply(this, arguments);
return executeInOrder(db, patio, function (db, patio) {
cb(db, patio);
return db;
});
},

/**
* Disconnects all databases in use.
*
Expand Down
10 changes: 1 addition & 9 deletions lib/model.js
Expand Up @@ -591,13 +591,6 @@ var Model = define([QueryPlugin, Middleware], {
*/
table: null,

/**
* patio - read only
*
* @type patio
*/
patio: null,

init: function () {
var emitter = new EventEmitter();
["addListener", "on", "once", "removeListener",
Expand Down Expand Up @@ -1068,6 +1061,7 @@ exports.create = function (name, supers, modelOptions) {
};

exports.syncModels = function (cb) {
// is this syncing correctly?
return asyncArray(allModels).forEach(function (model) {
return model.sync();
}, 1).classic(cb).promise();
Expand Down Expand Up @@ -1115,5 +1109,3 @@ exports.getModel = function (name, db) {
}
return ret;
};


17 changes: 1 addition & 16 deletions lib/sql.js
Expand Up @@ -48,7 +48,7 @@ var virtualRow = function (name) {
}, function () {
return SQLFunction.fromArgs(arguments);
});
ret["__proto__"] = ident;
Object.setPrototypeOf(ret, ident);
return ret;
};

Expand Down Expand Up @@ -2806,18 +2806,3 @@ JsonArray.prototype.valueOf = function () {
};
//require("util").inherits(JsonArray, Array);
sql.JsonArray = JsonArray;















24 changes: 13 additions & 11 deletions package.json 100755 → 100644
@@ -1,7 +1,7 @@
{
"name": "patio",
"description": "Patio query engine and ORM",
"version": "0.9.5",
"version": "1.0.0",
"keywords": [
"ORM",
"object relation mapper",
Expand Down Expand Up @@ -29,14 +29,14 @@
"author": "Doug Martin (http://c2fo.github.com)",
"main": "index.js",
"dependencies": {
"comb": "~0.4.0",
"comb-proxy": ">=0.0.3",
"commander": "0.5.1",
"comb": "~1.0.0",
"comb-proxy": "~1.0.0",
"commander": ">=0.5.1",
"hive-cache": "0.0.3",
"mysql": "2.5.3",
"pg": "4.0.0",
"pg-query-stream": "0.7.0",
"pg-types": "1.6.0",
"mysql": "2.10.0",
"pg": "4.4.3",
"pg-query-stream": "1.0.0",
"pg-types": "1.10.0",
"validator": "~1.5.1"
},
"scripts": {
Expand All @@ -48,9 +48,11 @@
"grunt-contrib-jshint": "^0.10.0",
"grunt-coveralls": "^1.0.0",
"grunt-exec": "^0.4.6",
"grunt-it": "^0.3.1",
"grunt-it": "^1.0.0",
"istanbul": "^0.3.14",
"it": "0.2.7"
"it": "^1.0.1",
"jit-grunt": "^0.9.1",
"time-grunt": "^1.2.2"
},
"directories": {
"lib": "lib"
Expand All @@ -59,6 +61,6 @@
"patio": "./bin/patio"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4.0.0"
}
}

0 comments on commit f87d769

Please sign in to comment.