Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API to fetch repository status via uhub (#21)
* Add API to fetch repository status via uhub * Dont run localFile tests for github * Document test scripts * Rename into LocalUtils, move test into ./api * Fix LocalFile properties getters * Implement LocalUtils.track() * Update comments based on coding review * Remove unused FILETYPE variable * Add status and expected behaviour to comment
- Loading branch information
Showing
9 changed files
with
319 additions
and
23 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
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,66 @@ | ||
var Immutable = require('immutable'); | ||
var path = require('path'); | ||
var mime = require('mime-types'); | ||
|
||
var FILETYPE = require('../constants/filetype'); | ||
|
||
var LocalFile = Immutable.Record({ | ||
// Sha1 of the modified blob, | ||
sha: null, | ||
|
||
// Path of the file | ||
filename: '', | ||
|
||
// File status | ||
status: '', | ||
|
||
// Number of additions | ||
additions: 0, | ||
|
||
// Number of deletions | ||
deletions: 0, | ||
|
||
// Number of changes | ||
changes: 0, | ||
|
||
// Git patch to apply | ||
patch: '' | ||
}, 'LocalFile'); | ||
|
||
// ---- Properties Getter ---- | ||
LocalFile.prototype.getSha = function() { | ||
return this.get('sha'); | ||
}; | ||
|
||
LocalFile.prototype.getFilename = function() { | ||
return this.get('filename'); | ||
}; | ||
|
||
LocalFile.prototype.getStatus = function() { | ||
return this.get('status'); | ||
}; | ||
|
||
LocalFile.prototype.getAdditions = function() { | ||
return this.get('additions'); | ||
}; | ||
|
||
LocalFile.prototype.getDeletions = function() { | ||
return this.get('deletions'); | ||
}; | ||
|
||
LocalFile.prototype.getChanges = function() { | ||
return this.get('changes'); | ||
}; | ||
|
||
LocalFile.prototype.getPatch = function() { | ||
return this.get('patch'); | ||
}; | ||
|
||
/** | ||
* Create a LocalFile representing a status result at the given path (filename etc.) | ||
*/ | ||
LocalFile.create = function (file) { | ||
return new LocalFile(file); | ||
}; | ||
|
||
module.exports = LocalFile; |
Oops, something went wrong.