ajgenesisnode-entity
Advanced tools
Comparing version 0.0.9 to 0.0.10
32
index.js
var path = require('path'); | ||
var async = require('simpleasync'); | ||
function install(ajgenesis, cb) { | ||
ajgenesis.createDirectory('ajgenesis'); | ||
ajgenesis.createDirectory(path.join('ajgenesis', 'modules')); | ||
ajgenesis.createDirectory(path.join('ajgenesis', 'modules', 'entity')); | ||
async() | ||
.then(function (data, next) { | ||
ajgenesis.copyFile(path.join(__dirname, 'add.js'), path.join('ajgenesis', 'modules', 'entity', 'add.js'), next); | ||
}) | ||
.then(function (data, next) { | ||
ajgenesis.copyFile(path.join(__dirname, 'addproperty.js'), path.join('ajgenesis', 'modules', 'entity', 'addproperty.js'), next); | ||
}) | ||
.then(function (data, next) { | ||
ajgenesis.copyFile(path.join(__dirname, 'import.js'), path.join('ajgenesis', 'modules', 'entity', 'import.js'), next); | ||
}) | ||
.then(function (data, next) { | ||
ajgenesis.copyDirectory(path.join(__dirname, 'templates'), path.join('ajgenesis', 'modules', 'entity', 'templates'), next); | ||
}) | ||
.then(function (data, next) { | ||
ajgenesis.copyDirectory(path.join(__dirname, 'lib'), path.join('ajgenesis', 'modules', 'entity', 'lib'), cb); | ||
}) | ||
.fail(function (err) { | ||
cb(err, null); | ||
}) | ||
.run(); | ||
module.exports = { | ||
require: require | ||
} | ||
module.exports = { | ||
install: install | ||
} |
@@ -1,18 +0,28 @@ | ||
{ "name": "ajgenesisnode-entity" | ||
, "description": "AjGenesis for Node, Entity tasks and templates" | ||
, "keywords": [ "codegeneration", "nodejs", "ajgenesis" ] | ||
, "version": "0.0.9" | ||
, "author": "Angel 'Java' Lopez <webmaster@ajlopez.com> (http://www.ajlopez.com)" | ||
, "repository": { "type": "git", "url": "git://github.com/ajlopez/AjGenesisNode-Entity.git" } | ||
, "main": "./index.js" | ||
, "engines": { "node": ">= 0.10.0" } | ||
, "scripts": { | ||
{ | ||
"name": "ajgenesisnode-entity", | ||
"description": "AjGenesis for Node, Entity tasks and templates", | ||
"keywords": [ | ||
"codegeneration", | ||
"nodejs", | ||
"ajgenesis" | ||
], | ||
"version": "0.0.10", | ||
"author": "Angel 'Java' Lopez <webmaster@ajlopez.com> (http://www.ajlopez.com)", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/ajlopez/AjGenesisNode-Entity.git" | ||
}, | ||
"main": "./index.js", | ||
"engines": { | ||
"node": ">= 0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "simpleunit ./test" | ||
}, | ||
"dependencies": { | ||
"simpleasync": "0.0.7" | ||
}, | ||
"devDependencies": { | ||
"simpleunit": "0.0.7" | ||
} | ||
, "dependencies": { | ||
"simpleasync": "0.0.5" | ||
} | ||
, "devDependencies": { | ||
"simpleunit": "0.0.6" | ||
} | ||
} | ||
} |
@@ -53,2 +53,3 @@ # AjGenesisNode Entity | ||
- 0.0.9: Published. Using entities folder in model | ||
- 0.0.10: Published, new directory struct, pre-installed in [AjGenesisNode-Express](https://github.com/ajlopez/AjGenesisNode-Express) | ||
@@ -55,0 +56,0 @@ ## Contribution |
var addtask = require('../add'), | ||
var addtask = require('../ajgenesis/modules/entity/add'), | ||
path = require('path'), | ||
@@ -11,2 +11,4 @@ fs = require('fs'), | ||
fsutils.removeDirSync(path.join(__dirname, 'ajgenesis')); | ||
var cwd = process.cwd(); | ||
@@ -41,2 +43,36 @@ | ||
exports['add customer entity using builddir'] = function (test) { | ||
test.async(); | ||
fsutils.removeDirSync(path.join(__dirname, 'ajgenesis')); | ||
var cwd = process.cwd(); | ||
addtask({ builddir: 'test' }, ['customer'], ajgenesis, function (err) { | ||
process.chdir('test'); | ||
if (err) | ||
throw err; | ||
var model = ajgenesis.loadModel(); | ||
test.ok(model); | ||
test.ok(model.entities); | ||
test.ok(model.entities.customer); | ||
var entity = model.entities.customer; | ||
test.equal(entity.name, "customer"); | ||
test.equal(entity.setname, "customers"); | ||
test.equal(entity.descriptor, "Customer"); | ||
test.equal(entity.setdescriptor, "Customers"); | ||
fsutils.removeDirSync(path.join(__dirname, 'ajgenesis')); | ||
test.done(); | ||
}); | ||
process.chdir(cwd); | ||
} | ||
exports['add company entity'] = function (test) { | ||
@@ -46,2 +82,4 @@ test.async(); | ||
var cwd = process.cwd(); | ||
fsutils.removeDirSync(path.join(__dirname, 'ajgenesis')); | ||
@@ -48,0 +86,0 @@ process.chdir('test'); |
@@ -1,3 +0,3 @@ | ||
var addpropertytask = require('../addproperty'), | ||
addtask = require('../add'), | ||
var addpropertytask = require('../ajgenesis/modules/entity/addproperty'), | ||
addtask = require('../ajgenesis/modules/entity/add'), | ||
path = require('path'), | ||
@@ -11,6 +11,7 @@ fs = require('fs'), | ||
fsutils.removeDirSync(path.join(__dirname, 'ajgenesis')); | ||
var cwd = process.cwd(); | ||
process.chdir('test'); | ||
fsutils.removeDirSync('ajgenesis'); | ||
@@ -52,2 +53,46 @@ addtask(null, ['customer'], ajgenesis, function (err) { | ||
exports['add property customer name using builddir'] = function (test) { | ||
test.async(); | ||
fsutils.removeDirSync(path.join(__dirname, 'ajgenesis')); | ||
var cwd = process.cwd(); | ||
var model = { builddir: 'test' }; | ||
addtask(model, ['employee'], ajgenesis, function (err) { | ||
if (err) | ||
throw err; | ||
addpropertytask(model, ['employee', 'name'], ajgenesis, function (err) { | ||
var model = ajgenesis.loadModel(path.join(__dirname, 'ajgenesis', 'models')); | ||
test.ok(model); | ||
test.ok(model.entities); | ||
test.ok(model.entities.employee); | ||
var entity = model.entities.employee; | ||
test.equal(entity.name, "employee"); | ||
test.equal(entity.setname, "employees"); | ||
test.equal(entity.descriptor, "Employee"); | ||
test.equal(entity.setdescriptor, "Employees"); | ||
test.ok(entity.properties); | ||
test.ok(Array.isArray(entity.properties)); | ||
test.equal(entity.properties.length, 1); | ||
var property = entity.properties[0]; | ||
test.equal(property.name, "name"); | ||
test.equal(property.descriptor, "Name"); | ||
fsutils.removeDirSync(path.join(__dirname, 'ajgenesis')); | ||
test.done(); | ||
}); | ||
}); | ||
process.chdir(cwd); | ||
} | ||
exports['add properties supplier name and address'] = function (test) { | ||
@@ -58,2 +103,4 @@ test.async(); | ||
fsutils.removeDirSync(path.join(__dirname, 'ajgenesis')); | ||
process.chdir('test'); | ||
@@ -60,0 +107,0 @@ |
var importtask = require('../import'), | ||
var importtask = require('../ajgenesis/modules/entity/import'), | ||
path = require('path'), | ||
@@ -4,0 +4,0 @@ fs = require('fs'), |
var names = require('../lib/names'); | ||
var names = require('../ajgenesis/modules/entity/lib/names'); | ||
@@ -4,0 +4,0 @@ exports['Get name'] = function (test) { |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
22563
476
63
18
+ Addedsimpleasync@0.0.7(transitive)
- Removedsimpleasync@0.0.5(transitive)
Updatedsimpleasync@0.0.7