<commit_before>var express = require('express');
var gpio = require('pi-gpio');
var colors = require('./node_modules/colors');
var app = express();

app.use(express.bodyParser());

var jobs = [];

var currentJobs = {};
function setJobLog(jobList){
	console.log('setting joblist');
	console.log(jobList);
	currentJobs = jobList;
}

function getJobLog(){
	console.log(currentJobs);
	return currentJobs;
}


function trackAllJobs(buildStatus){
 console.log('job finished building ..logging now');	
 jobs[buildStatus.name] = buildStatus;

 setJobLog(jobs);

 //console.log(jobs[buildStatus.name]);

 //checks if current build passed
 if(jobs[buildStatus.name].build.status != 'SUCCESS'){
   console.log(buildStatus.name+ ' failed'.red);
 }else{
    console.log(String(buildStatus.name) +' built Successfully'.green);
 	var allBuildsStable = true;

 	//checks if there is still a job that has failed
 	for(n in jobs){
 		if(jobs[n].build.status != 'SUCCESS'){
 			allBuildsStable = false;
 			console.log(String(jobs[n].name) + ' is still broken'.red);
 		}
 	}

 	//all builds in array are 
 	if(allBuildsStable){
 		console.log('All Builds Stable'.green);
 	}
 }
}


app.post('/buildstatus', function(req, res){
 console.log('Received Jenkins build notification');

  var job = req.body;
  if(job.build.phase == 'STARTED'){
	  console.log('STARTING JOB '.yellow + job.name);

 
  }else if(job.build.phase == 'COMPLETED'){
  	console.log('JOB COMPLETE '.cyan + job.name);
  }else if(job.build.phase == 'FINISHED'){
  	 trackAllJobs(job);
  }
   

  res.send('Build notification processed.');
});

var server = app.listen(3000, function(){
	console.log('listening on port %d', server.address().port);
});


app.get('/jobStatus', function(req, res){
	var jbs = getJobLog();
	console.log('jobStatus was called');
	console.log(jbs);
	res.json(jbs);
});

app.get('/red/on', function(req,res){
	gpio.open(7, "output", function(err){
		console.log(err);
		gpio.write(7,1, function(){ //set pin to high
			gpio.close(7);
		    res.write('Pin 7 is set to HIGH');
		    res.end();
		});

	});
});

app.get('/red/off', function(req,res){
	gpio.open(7, "output", function(err){
		console.log(err);
		gpio.write(7,0, function(){ //set pin to low
			gpio.close(7);
		    res.write('Pin 7 is set to LOW');
		    res.end();
		});
	});
});


app.get('/green/on', function(req,res){
	gpio.open(11, "output", function(err){
		console.log(err);
		gpio.write(11,1, function(){ 
			gpio.close(11);
			res.write('Pin 11 is set to HIGH');
			res.end();
		});
	});

});

app.get('/green/off', function(req,res){
	gpio.open(11, "output", function(err){
		console.log(err);
		gpio.write(11,0, function(){ 
			gpio.close(11);
			res.write('Pin 11 is set to LOW');
			res.end();
		});
	});

});

app.get('/yellow/on', function(req,res){
	gpio.open(12, "output", function(err){
		console.log(err);
		gpio.write(12,1, function(){ 
			gpio.close(12);
			res.write('Pin 12 is set to HIGH');
		    res.end();
		});
	});
});

app.get('/yello/off', function(req,res){
	gpio.open(12, "output", function(err){
		console.log(err);
		gpio.write(12,0, function(){ 
			gpio.close(12);
			res.write('Pin 12 is set to LOW');
			res.end();
		});
	});
});
<commit_msg>bug fixes<commit_after>var express = require('express');
var gpio = require('pi-gpio');
var colors = require('./node_modules/colors');
var app = express();

app.use(express.bodyParser());

var jobs = [];

var currentJobs = {};
function setJobLog(jobList){
	console.log('setting joblist');
	console.log(jobList);
	currentJobs = jobList;
}

function getJobLog(){
	console.log(currentJobs);
	return currentJobs;
}


function trackAllJobs(buildStatus){
 console.log('job finished building ..logging now');	
 jobs[buildStatus.name] = buildStatus;

 setJobLog(jobs);

 //console.log(jobs[buildStatus.name]);

 //checks if current build passed
 if(jobs[buildStatus.name].build.status != 'SUCCESS'){
   console.log(buildStatus.name+ ' failed'.red);
 }else{
    console.log(String(buildStatus.name) +' built Successfully'.green);
 	var allBuildsStable = true;

 	//checks if there is still a job that has failed
 	for(n in jobs){
 		if(jobs[n].build.status != 'SUCCESS'){
 			allBuildsStable = false;
 			console.log(String(jobs[n].name) + ' is still broken'.red);
 		}
 	}

 	//all builds in array are 
 	if(allBuildsStable){
 		console.log('All Builds Stable'.green);
 	}
 }
}


app.post('/buildstatus', function(req, res){
 console.log('Received Jenkins build notification');

  var job = req.body;
  if(job.build.phase == 'STARTED'){
	  console.log('STARTING JOB '.yellow + job.name);

 
  }else if(job.build.phase == 'COMPLETED'){
  	console.log('JOB COMPLETE '.cyan + job.name);
  }else if(job.build.phase == 'FINISHED'){
  	 trackAllJobs(job);
  }
   

  res.send('Build notification processed.');
});

var server = app.listen(3000, function(){
	console.log('listening on port %d', server.address().port);
});


app.get('/jobStatus', function(req, res){
	var jbs = getJobLog();
	console.log('jobStatus was called');
	console.log(jbs);
	res.json(jbs);
});

app.get('/red/off', function(req,res){
	gpio.open(7, "output", function(err){
		console.log(err);
		gpio.write(7,1, function(){ //set pin to high
			gpio.close(7);
		    res.write('Pin 7 is set to HIGH');
		    res.end();
		});

	});
});

app.get('/red/on', function(req,res){
	gpio.open(7, "output", function(err){
		console.log(err);
		gpio.write(7,0, function(){ //set pin to low
			gpio.close(7);
		    res.write('Pin 7 is set to LOW');
		    res.end();
		});
	});
});


app.get('/green/off', function(req,res){
	gpio.open(11, "output", function(err){
		console.log(err);
		gpio.write(11,1, function(){ 
			gpio.close(11);
			res.write('Pin 11 is set to HIGH');
			res.end();
		});
	});

});

app.get('/green/on', function(req,res){
	gpio.open(11, "output", function(err){
		console.log(err);
		gpio.write(11,0, function(){ 
			gpio.close(11);
			res.write('Pin 11 is set to LOW');
			res.end();
		});
	});

});

app.get('/yellow/off', function(req,res){
	gpio.open(12, "output", function(err){
		console.log(err);
		gpio.write(12,1, function(){ 
			gpio.close(12);
			res.write('Pin 12 is set to HIGH');
		    res.end();
		});
	});
});

app.get('/yellow/on', function(req,res){
	gpio.open(12, "output", function(err){
		console.log(err);
		gpio.write(12,0, function(){ 
			gpio.close(12);
			res.write('Pin 12 is set to LOW');
			res.end();
		});
	});
});

{'fraction_non_alphanumeric': 0.20021762785636563, 'fraction_numerical': 0.0155448468832582, 'mean_word_length': 3.896499238964992, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2292982', 'n_tokens_mistral': 2571, 'n_tokens_neox': 2332, 'n_words': 481}