Skip to content

Commit

Permalink
[master] leading ";" was causing an undefined problem
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandro committed Mar 25, 2012
1 parent fa4c49b commit f54e8b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ var setup_unionfs_chroot = function (chroot_base, git_home, rw_folder, final_chr
exports.node_versions = node_versions;

var watcher_code = function(user,pass){
return "(new (require('node-watcher'))({host:'http://nodester.com',user:'"+user + "',password:'"+ pass+"',path:'/app/audit'})).emitter({maxMemory:25,sizeSpace:25,checkSpace:true})"
return ";(new (require('node-watcher'))({host:'http://nodester.com',user:'"+user + "',password:'"+ pass+"',path:'/app/audit'})).emitter({maxMemory:25,sizeSpace:25,checkSpace:true});"
}

exports.watcher_code = watcher_code;

var insert_code = function(location,file,code, cb){
Expand All @@ -369,8 +370,12 @@ var insert_code = function(location,file,code, cb){
if (!err){
var old = fs.readFileSync(target, 'utf8');
var newfile ='';
var oldcode = code.split('');
oldcode[0]==';'?oldcode[0]='';oldcode[0]
oldcode[oldcode.length-1]==';'?oldcode[oldcode.length-1]='';oldcode[oldcode.length-1]
oldcode = olcode.join('');
old = old.split('\n').filter(function(line){
return line !== code;
return line !== code && line !== oldcode;
}).join('\n');
var lines = old.split('\n');
if (/\#!\//gi.test(lines[0])){
Expand Down

0 comments on commit f54e8b7

Please sign in to comment.