Skip to content

Commit

Permalink
Include engine in auth:init, auth:init will now use the give engines
Browse files Browse the repository at this point in the history
views.
  • Loading branch information
larzconwell committed Jan 15, 2013
1 parent a9d96ec commit c189922
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
8 changes: 4 additions & 4 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,15 @@ if (cmds.length) {
jakeArgs = cmds.slice(1);
break;
case 'console':
// Create DBs
// Start console
cmd += 'console:start[' + (cmds[1] || 'development') + ']';
break;
case 'auth':
// Create DBs
cmd += 'auth:init';
// Create authentication
cmd += 'auth:init[' + engineCmd.substr(1) + ']';
break;
case 'auth:update':
// Create DBs
// Update authentication
cmd += 'auth:update';
break;
case 'db:init':
Expand Down
25 changes: 20 additions & 5 deletions templates/Jakefile
Original file line number Diff line number Diff line change
Expand Up @@ -862,12 +862,16 @@ namespace('auth', function () {
}, {printStdout: true});
});

task('init', {async: true}, function () {
task('init', {async: true}, function (engine) {
var readline = require('readline')
, fromBase = path.join(cwd, 'node_modules', 'geddy-passport')
, install = false
, rl, installPackages, passportCopy;

if (!engine || engine == 'default') {
engine = 'ejs';
}

// Create and start the prompt
rl = readline.createInterface({
input: process.stdin
Expand All @@ -892,7 +896,7 @@ namespace('auth', function () {

console.log('Installing', geddyPassport);
jake.exec('npm uninstall ' + geddyPassport +
' && npm install ' + geddyPassport, installPackages, {printStdout: true})
' && npm install ' + geddyPassport, installPackages, {printStdout: true});
});

// Gets the package versions from geddy-passport's package.json
Expand All @@ -917,17 +921,28 @@ namespace('auth', function () {
, routerPath = getRouterPath()
, newRoute
, from
, to;
, to
, i;

// Copy files to the application
list.forEach(function (item) {
for (i = 0; i < list.length; i++) {
item = list[i];
from = path.join(fromBase, item);
to = path.dirname(path.join(cwd, item));

if (item.match('/app/views')) {
// If the view is not for the given engine, skip it
if (!item.match(engine)) {
continue;
}

to = to.replace(engine, "");
}

jake.mkdirP(to);
console.log('Creating file:', item);
jake.cpR(from, to, {silent: true});
});
}

// Add new routes to router
if (routerPath) {
Expand Down

0 comments on commit c189922

Please sign in to comment.