diff --git a/acl/index.js b/acl/index.js index cad6d79..dd28032 100644 --- a/acl/index.js +++ b/acl/index.js @@ -125,7 +125,7 @@ module.exports = yeoman.generators.Base.extend({ this.aclDef = { property: answers.property, accessType: answers.accessType, - principalType: 'ROLE', // TODO support all principal types + principalType: 'ROLE', // TODO(bajtos) support all principal types principalId: answers.role, permission: answers.permission }; diff --git a/app/index.js b/app/index.js index 8809fa5..c171b17 100644 --- a/app/index.js +++ b/app/index.js @@ -21,20 +21,17 @@ module.exports = yeoman.generators.Base.extend({ }); }, - injectProjectWriteFile: function() { - /* TODO inject `this.directory` to replace `ncp` in workspace - // Modify Project.writeFile use yeoman's write - var _projectWriteFile = Project.writeFile; - Project.writeFile = function(filepath, content, encoding, cb) { - this.write(filepath, content, { encoding: encoding }); - cb(); + injectWorkspaceCopyRecursive: function() { + var originalMethod = Workspace.copyRecursive; + Workspace.copyRecursive = function(src, dest, cb) { + this.directory(src, dest); + process.nextTick(cb); }.bind(this); - // Restore Project.writeFile when done + // Restore the original method when done this.on('end', function() { - Project.writeFile = _projectWriteFile; + Workspace.copyRecursive = originalMethod; }); - */ }, initWorkspace: function() { @@ -48,7 +45,7 @@ module.exports = yeoman.generators.Base.extend({ if (err) return done(err); this.templates = list.map(function(t) { return { - // TODO - workspace does not provide template details yet + // TODO(bajtos) - workspace does not provide template details yet // name: util.format('%s (%s)', t.name, t.description), // value: t.name name: t, @@ -73,7 +70,7 @@ module.exports = yeoman.generators.Base.extend({ default: name }, /* - TODO: not all templates are projects, some of them are mere components + TODO(bajtos) not all templates are projects, some of them are components The only functional project template is 'api-server' at the moment { name: 'template', @@ -87,6 +84,7 @@ module.exports = yeoman.generators.Base.extend({ this.prompt(prompts, function(props) { this.appname = props.appname; + // TODO(bajtos) see the TODO comment above //this.template = props.template; this.template = 'api-server'; diff --git a/lib/actions.js b/lib/actions.js index 9f36575..f12f95e 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -1,5 +1,6 @@ 'use strict'; var workspace = require('loopback-workspace'); +var Workspace = workspace.models.Workspace; var actions = exports; @@ -22,22 +23,8 @@ actions.loadProject = function() { this.projectDir = this.destinationRoot(); process.env.WORKSPACE_DIR = this.projectDir; - /* TODO - validate the project var done = this.async(); - Project.isValidProjectDir(this.projectDir, function(err, isValid, message) { - if (err) { - return done(err); - } - - if (!isValid) { - var msg = util.format( - 'The directory %s is not a valid LoopBack project. %s', - this.projectDir, - message); - return done(new Error(msg)); - } - }.bind(this)); - */ + Workspace.isValidDir(done); }; /** diff --git a/test/acl.test.js b/test/acl.test.js index 558de5c..8c5370e 100644 --- a/test/acl.test.js +++ b/test/acl.test.js @@ -47,7 +47,7 @@ describe('loopback:acl generator', function() { var carAcls = def.acls; expect(carAcls).to.eql([{ - id: 1, // TODO fix workspace to not add this extra property + id: 1, // TODO(bajtos) fix workspace to not add this extra property accessType: '*', permission: 'AUDIT', principalType: 'ROLE', diff --git a/test/app.test.js b/test/app.test.js index 3aca181..f0f793c 100644 --- a/test/app.test.js +++ b/test/app.test.js @@ -20,10 +20,10 @@ describe('loopback:app generator', function() { 'rest/datasources.json', 'rest/models.json', - // TODO rest/rest.js + 'rest/rest.js', 'server/config.json', - // TODO server/server.js + 'server/server.js', ]; var gen = givenAppGenerator();