Last active
August 29, 2015 14:07
-
-
Save pcon/f488995408372b7fecab to your computer and use it in GitHub Desktop.
Screen configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/usr/bin/node /home/$USER/bin/test_status.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backtick 1 60 60 /home/$USER/bin/backtick_test_status.sh | |
hardstatus "... %1` ..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jslint browser: true, regexp: true */ | |
/*global require, console */ | |
function pad(num, size) { | |
'use strict'; | |
var s = num.toString(); | |
while (s.length < size) { | |
s = "0" + s; | |
} | |
return s; | |
} | |
var jsforce = require('jsforce'); | |
var conn = new jsforce.Connection({ | |
loginUrl: 'https://test.salesforce.com' | |
}); | |
var data = {}; | |
conn.login('USERNAME', 'PASSWORD').then(function (res) { | |
'use strict'; | |
return conn.tooling.sobject('ApexTestQueueItem').find({Status: 'Queued'}); | |
}).then(function (queued_tests) { | |
'use strict'; | |
data.queued_tests = queued_tests.length; | |
return conn.tooling.sobject('ApexTestQueueItem').find({Status: 'Processing'}); | |
}, function (err) { | |
'use strict'; | |
console.log(err); | |
}).then(function (processing_tests) { | |
'use strict'; | |
data.processing_tests = processing_tests.length; | |
return conn.tooling.sobject('ApexTestResult').find({Outcome: 'Fail'}); | |
}, function (err) { | |
'use strict'; | |
console.log(err); | |
}).then(function (failed_tests) { | |
//Strict was removed because we need the octal codes below to change colors | |
var output = ""; | |
data.failed_tests = failed_tests.length; | |
output = pad(data.queued_tests, 2) + " " + pad(data.processing_tests, 2) + " "; | |
if (data.failed_tests !== 0) { | |
output += '\005{= R}' + data.failed_tests + '\005{= Y}'; | |
} else { | |
output += "00"; | |
} | |
console.log(output); | |
}, function (err) { | |
'use strict'; | |
console.log(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment