Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow buildLight to unblink first prior to blinking red or showing ot…

…her colour.
  • Loading branch information...
commit ca557927e4618315896f0e0cea0473787c38dabb 1 parent fca8a65
@cliffano authored
View
20 lib/notifiers/buildlight.js
@@ -29,15 +29,19 @@ BuildLight.prototype.notify = function (status) {
var buildLight = new _BuildLight(this.opts),
colour = COLOURS[status];
- if (status === 'FAIL') {
- buildLight.blink(colour, function (err) {
- if (err) {
- console.error(err.message);
- }
- });
- } else {
- buildLight[colour || UNKNOWN]();
+ function _colourise() {
+ if (status === 'FAIL') {
+ buildLight.blink(colour, function (err) {
+ if (err) {
+ console.error(err.message);
+ }
+ });
+ } else {
+ buildLight[colour || UNKNOWN]();
+ }
}
+
+ buildLight.unblink(_colourise);
};
module.exports = BuildLight;
View
2  package.json
@@ -34,7 +34,7 @@
"bagofcli": "~0.0.5",
"bagofrequest": "~0.0.5",
"bagoftext": "~0.0.2",
- "buildlight": "~0.0.3",
+ "buildlight": "~0.0.4",
"colors": "~0.6.2",
"commander": "~2.0.0",
"cron": "~1.0.1",
View
3  test/notifiers/buildlight.js
@@ -19,6 +19,9 @@ buster.testCase('buildlight - notify', {
setUp: function () {
this.mockFs = this.mock(fs);
this.stub(process, 'platform', 'linux');
+ this.stub(_BuildLight.prototype, 'unblink', function (cb) {
+ cb();
+ });
},
'should switch all colours off then switch one colour on on build light device based on notification status': function () {
this.mockFs.expects('writeFileSync').once().withExactArgs('/some/usbled/path/red', 0);
Please sign in to comment.
Something went wrong with that request. Please try again.