diamond.js
Advanced tools
Comparing version 0.1.2 to 0.2.0
// Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
var Diamond, express; | ||
var Diamond, express, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
express = require('express'); | ||
Diamond = (function() { | ||
Diamond = (function(_super) { | ||
__extends(Diamond, _super); | ||
function Diamond(callback) { | ||
Diamond.__super__.constructor.apply(this, arguments); | ||
this.server = express(); | ||
@@ -25,4 +30,2 @@ this.port = process.env.PORT || 3000; | ||
Diamond.Model = require('./model'); | ||
Diamond.Controller = require('./controller'); | ||
@@ -32,3 +35,3 @@ | ||
})(); | ||
})(require('./singleton')); | ||
@@ -35,0 +38,0 @@ module.exports = Diamond; |
// Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
var Model, Property, Validation, | ||
var Diamond, Model, Property, Validation, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -11,7 +11,7 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
Diamond = require('./application'); | ||
Model = (function(_super) { | ||
__extends(Model, _super); | ||
Model.MongoDB = require('./model/storage/mongodb'); | ||
Model.properties = {}; | ||
@@ -38,3 +38,3 @@ | ||
this.properties = new Object; | ||
this.name = this.constructor.name.toLowerCase(); | ||
this.name = this.constructor.name; | ||
_ref = this.constructor.properties; | ||
@@ -84,2 +84,38 @@ for (k in _ref) { | ||
Model.all = function(callback) { | ||
return Diamond.getInstance().db.all(this, callback); | ||
}; | ||
Model.count = function(callback) { | ||
return Diamond.getInstance().db.count(this, callback); | ||
}; | ||
Model.find = function(options, callback) { | ||
return Diamond.getInstance().db.find(this, options, callback); | ||
}; | ||
Model.findById = function(id, callback) { | ||
return Diamond.getInstance().db.findById(this, id, callback); | ||
}; | ||
Model.prototype.save = function(callback) { | ||
return Diamond.getInstance().db.save(this, callback); | ||
}; | ||
Model.prototype.update = function(options, callback) { | ||
return Diamond.getInstance().db.update(this, options, this.oroperties, callback); | ||
}; | ||
Model.update = function(options, set, callback) { | ||
return Diamond.getInstance().db.update(this, options, set, callback); | ||
}; | ||
Model.prototype.remove = function(callback) { | ||
return Diamond.getInstance().db.remove(this, this.properties, callback); | ||
}; | ||
Model.remove = function(options, callback) { | ||
return Diamond.getInstance().db.remove(this, options, callback); | ||
}; | ||
return Model; | ||
@@ -86,0 +122,0 @@ |
@@ -29,6 +29,6 @@ // Generated by CoffeeScript 1.7.1 | ||
} else { | ||
value = this.type.prototype != null ? new this.type : this.type(); | ||
value = this.type(); | ||
} | ||
} else { | ||
value = this.type.prototype != null ? new this.type(value) : this.type(value); | ||
value = this.type(value); | ||
} | ||
@@ -35,0 +35,0 @@ return value; |
// Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
var Model, MongoDB, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
var MongoDB; | ||
Model = require('../../model'); | ||
MongoDB = (function(_super) { | ||
__extends(MongoDB, _super); | ||
MongoDB = (function() { | ||
function MongoDB() { | ||
MongoDB.__super__.constructor.apply(this, arguments); | ||
this.db = Diamond.getInstance().db; | ||
this.collection = this.db.collection(this.name); | ||
} | ||
@@ -30,3 +25,3 @@ | ||
})(Model); | ||
})(); | ||
@@ -33,0 +28,0 @@ module.exports = MongoDB; |
{ | ||
"name": "diamond.js", | ||
"description": "MVC web framework", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"author": { | ||
@@ -13,3 +13,2 @@ "name": "Arthur Xavier", | ||
}, | ||
"scripts": { | ||
@@ -19,13 +18,11 @@ "test": "./node_modules/.bin/mocha test/test.coffee --compilers coffee:coffee-script/register", | ||
}, | ||
"main": "index.js", | ||
"license": "MIT", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "^1.7.1", | ||
"mocha": "^1.21.3", | ||
"mongojs": "^0.13.1", | ||
"request": "^2.39.0", | ||
@@ -32,0 +29,0 @@ "should": "^4.0.4" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26398
27
469
5