Skip to content

Commit d9072f5

Browse files
committed
Move all adapter libs into dev dependencies
1 parent b7fedce commit d9072f5

File tree

7 files changed

+31
-19
lines changed

7 files changed

+31
-19
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ services:
77
- mongodb
88
- postgresql
99
- riak
10+
- mysql
1011

1112
before_script:
1213
- sudo /etc/init.d/postgresql stop
@@ -26,4 +27,4 @@ before_script:
2627
- mysql -u root -e "CREATE DATABASE model_test COLLATE latin1_general_cs;"
2728
- sudo apt-get install sqlite3 libsqlite3-dev
2829

29-
script: jake test
30+
script: jake test --trace

lib/adapters/level/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
var model = require('../../index')
22
, utils = require('utilities')
3+
, level
34
, mr = require('../transformers/mr')
45
, operation = require('../../query/operation')
56
, comparison = require('../../query/comparison')
67
, datatypes = require('../../datatypes')
78
, request = utils.request
89
, BaseAdapter = require('../base_adapter').BaseAdapter
9-
, level = require('level')
1010
, _baseConfig
1111
, _data = {}
1212
, delimiter = '!';
1313

14+
// DB lib should be locally installed in the consuming app
15+
level = utils.file.requireLocal('level');
16+
1417
_baseConfig = {
1518
db: '/data/level'
1619
};

lib/adapters/mongo/index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var model = require('../../index')
2-
, file = require('utilities').file
3-
, driver = require('mongodb-wrapper')
2+
, mongo
43
, utils = require('utilities')
54
, operation = require('../../query/operation')
65
, comparison = require('../../query/comparison')
@@ -12,6 +11,9 @@ var model = require('../../index')
1211
, _comparisonTypeMap
1312
, _collectionizeModelName;
1413

14+
// DB lib should be locally installed in the consuming app
15+
mongo = utils.file.requireLocal('mongodb-wrapper')
16+
1517
_baseConfig = {
1618
username: null
1719
, dbname: null
@@ -177,7 +179,7 @@ utils.mixin(Adapter.prototype, new (function () {
177179
'password'].forEach(function (c) {
178180
args.push(config[c]);
179181
});
180-
this.client = driver.db.apply(driver, args);
182+
this.client = mongo.db.apply(mongo, args);
181183
};
182184

183185
this.load = function (query, callback) {

lib/adapters/sql/mysql.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
var file = require('utilities').file
2-
, mysql = file.requireLocal('mysql')
1+
var utils = require('utilities')
2+
, mysql
33
, generator = require('../../../lib/generators/sql')
4-
, utils = require('utilities')
54
, model = require('../../../lib')
65
, Query = require('../../../lib/query/query').Query
76
, BaseAdapter = require('./base').Adapter
87
, Adapter
98
, _baseConfig;
109

10+
// DB lib should be locally installed in the consuming app
11+
mysql = utils.file.requireLocal('mysql');
12+
1113
_baseConfig = {
1214
host: 'localhost'
1315
, user: process.env.USER

lib/adapters/sql/postgres.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
var file = require('utilities').file
2-
, pg = require('pg')
1+
var utils = require('utilities')
2+
, pg
33
, generator = require('../../generators/sql')
4-
, utils = require('utilities')
54
, model = require('../../index')
65
, Query = require('../../query/query').Query
76
, BaseAdapter = require('./base').Adapter
87
, Adapter
98
, _baseConfig;
109

10+
// DB lib should be locally installed in the consuming app
11+
pg = utils.file.requireLocal('pg');
12+
1113
_baseConfig = {
1214
user: process.env.USER
1315
, database: process.env.USER

lib/adapters/sql/sqlite.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
var file = require('utilities').file
2-
, sqlite3 = file.requireLocal('sqlite3')
1+
var utils = require('utilities')
2+
, sqlite3
33
, generator = require('../../../lib/generators/sql')
4-
, utils = require('utilities')
54
, model = require('../../../lib')
65
, Query = require('../../../lib/query/query').Query
76
, BaseAdapter = require('./base').Adapter
87
, Adapter
98
, _baseConfig;
109

10+
// DB lib should be locally installed in the consuming app
11+
sqlite3 = utils.file.requireLocal('sqlite3');
12+
1113
_baseConfig = {
1214
database: process.env.USER + '.db'
1315
};

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
"url": "git://github.com/mde/model.git"
2929
},
3030
"dependencies": {
31-
"utilities": "0.0.x",
31+
"utilities": "0.0.x"
32+
},
33+
"devDependencies": {
34+
"jake": "0.7.x",
3235
"mongodb-wrapper": "0.4.x",
3336
"pg": "2.5.x",
34-
"level": "0.17.x",
3537
"mysql": "2.0.x",
38+
"level": "0.17.x",
3639
"sqlite3": "2.1.x"
3740
},
38-
"devDependencies": {
39-
"jake": "0.7.x"
40-
},
4141
"engines": {
4242
"node": "*"
4343
}

0 commit comments

Comments
 (0)