Gum-Joe / jakhu

Manage all your web-apps with ease :closed_lock_with_key: :computer: :fireworks:
Other
1 stars 2 forks source link

Checking out files prints undefined even though the file is checked out #14

Closed Gum-Joe closed 8 years ago

Gum-Joe commented 9 years ago

File: boot/libs/checks/checkFile.js Code:

var fs = require('fs')
var path = require('path')
var clicolour = require('cli-color')
var error = require('../../../libs/error/bsod.js')

var files = ["app.js", "node_modules", "libs"];

var i;

exports.checkFiles = function checkFiles(x){
  // TODO: Fix issue where files[i] is undefined
  console.log(clicolour.yellowBright("ALPHA:")+"Checking out files need fixing, does in fact check out files correctly");
  for (var i = 0; i < files.length; i++) {
    fs.stat(files[i], function(err, stat){
      if(err === null){
          return console.log('Checked out file '+files[i]+"..."+clicolour.greenBright("OK"));
          console.log(i);
        }
        else if( err.code == 'ENOENT'){
          console.log('Checked out file '+files[i]+"..."+clicolour.redBright("ERROR!"));
          throw error.throwError("BOOT_"+err.code+"_CHECKS_NOT_FOUND:"+files[i], err, err.code);
        }
        else{
          console.log('Checked out file '+files[i]+"..."+clicolour.redBright("ERROR!"));
          throw error.throwError("BOOT_CHECKS_FILES_"+err.code+":"+files[i], err, err.code);
            }
          });
  }
});
};

Output:

Checked out file undefined...OK
Checked out file undefined...OK
Checked out file undefined...OK
Gum-Joe commented 8 years ago

Feature disabled.

Gum-Joe commented 8 years ago

Probably not needing this.