Skip to content

Commit

Permalink
fixed directory issue with writing files
Browse files Browse the repository at this point in the history
  • Loading branch information
bill209 committed May 22, 2015
1 parent a829206 commit 07f7fb2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
5 changes: 0 additions & 5 deletions includes/TEST.html

This file was deleted.

5 changes: 0 additions & 5 deletions includes/TEST2.html

This file was deleted.

7 changes: 3 additions & 4 deletions includes/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ exports.buildManyFiles = function(values){
name of the template file: ie index.jade...,
and the user input values from prompt
*/
builds.push(this.buildFile( { 'filename' : values.appFolder + '/' + filesToBuild[i].fname, 'tplName' : tplDir + filesToBuild[i].tplName, 'values' : values } ));
builds.push(this.buildFile( { 'filename' : values.rootFolder + '/' + filesToBuild[i].fname, 'tplName' : tplDir + filesToBuild[i].tplName, 'values' : values } ));
};

var bunchOPromises = Q.all(builds);

bunchOPromises
Expand Down Expand Up @@ -92,7 +91,7 @@ exports.writeManyFiles = function(data){
var builds = [];
var dir = 'views/';
for (var i = 0; i < data.length; i++) {
var fn = __dirname + '/' + data[i].filename;
var fn = data[i].filename;
builds.push(this.writeFile({ 'filename' : fn, 'html' : data[i].html }));
};

Expand All @@ -102,7 +101,7 @@ exports.writeManyFiles = function(data){
.then(function (results) {
deferred.resolve(results);
}).fail(function(e){
deferred.reject('buildManyFiles error: ', e);
deferred.reject('buildManyFiles error: ' + e);
});
return deferred.promise;
};
Expand Down
5 changes: 2 additions & 3 deletions includes/input.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var Q = require('q');
var exports = module.exports = {};
var readline = require('readline'),
CURDIR = __dirname;

rl = readline.createInterface(process.stdin, process.stdout);
var answers = {};
Expand All @@ -13,8 +12,8 @@ exports.getUserInput = function(){
var deferred = Q.defer();

rl.question("name of your app (appology): ", function(answer) {
answers.appname = answer == "" ? 'appology' : answer;
var folderName = answers.appname.replace(" ", "_");
answers.appName = answer == "" ? 'appology' : answer;
var folderName = answers.appName.replace(" ", "_");
rl.question("your name (billbobb): ", function(answer) {
answers.author = answer == "" ? 'billbobb' : answer;
rl.question("app folder (" + folderName + "): ", function(answer) {
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CURDIR = __dirname;

var input = require('./includes/input.js');
var func = require('./includes/functions.js');
var sbox = require('./includes/sandbox.js');
CURDIR = __dirname;

var schemaFile = 'schema.prompt';
var tplDataUrl = 'http://localhost/repos/buildIt/tpl_data.json';
results = {};
Expand Down

0 comments on commit 07f7fb2

Please sign in to comment.