Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start converting the bundled plugins, starting with the pivotal track…
…er one
- Loading branch information
1 parent
61dfbe7
commit 15e6d6a
Showing
7 changed files
with
105 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var upordown = {}; | ||
|
||
var count = 0; | ||
|
||
upordown.reset = function() { | ||
count = 0; | ||
}; | ||
|
||
upordown.getStatus = function(current) { | ||
if(!current) { | ||
return "nochange"; | ||
} | ||
|
||
if(current === count) { | ||
return "nochange"; | ||
} | ||
|
||
var status = "down"; | ||
if(current > count) { | ||
status = "up"; | ||
} | ||
|
||
count = current; | ||
return status; | ||
}; | ||
|
||
module.exports = upordown; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var pivotalTracker = require("../lib/pivotaltracker.js"), | ||
upordown = require('../lib/upordown.js'); | ||
// TODO allow plugins to include other modules somehow | ||
|
||
var pivotalTrackerBugs = {}; | ||
|
||
pivotalTrackerBugs.interval = 300; | ||
|
||
pivotalTrackerBugs.execute = function(callback) { | ||
var options = {}; // TODO | ||
pivotalTracker.getOpenBugs(options, function(err, result) { | ||
callback(null, upordown.getStatus(result)); | ||
}); | ||
}; | ||
|
||
module.exports = pivotalTrackerBugs; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var pivotalTracker = require('../lib/pivotaltracker.js'), | ||
upordown = require('../lib/upordown.js'); | ||
// TODO allow plugins to include other modules somehow | ||
|
||
var pivotalTrackerFeatures = {}; | ||
|
||
pivotalTrackerFeatures.interval = 300; | ||
|
||
pivotalTrackerFeatures.execute = function(callback) { | ||
var options = {}; // TODO | ||
pivotalTracker.getOpenFeatures(options, function(err, result) { | ||
callback(null, upordown.getStatus(result)); | ||
}); | ||
}; | ||
|
||
module.exports = pivotalTrackerFeatures; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var mocha = require('mocha'), | ||
assert = require('assert'), | ||
upordown = require('../lib/upordown.js'); | ||
|
||
describe('upordown', function() { | ||
beforeEach(function() { | ||
upordown.reset(); | ||
}); | ||
|
||
it('should return up when result is greater than current', function() { | ||
assert.equal(upordown.getStatus(1), "up"); | ||
}); | ||
|
||
it('should return down when result is less than current', function() { | ||
assert.equal(upordown.getStatus(-1), "down"); | ||
}); | ||
|
||
it('should return nochange when result is the same as current', function() { | ||
assert.equal(upordown.getStatus(0), "nochange"); | ||
}); | ||
|
||
it('should return nochange when result is null', function() { | ||
assert.equal(upordown.getStatus(null), "nochange"); | ||
}); | ||
|
||
it('should return nochange when result is undefined', function() { | ||
assert.equal(upordown.getStatus(undefined), "nochange"); | ||
}); | ||
}); |