basecamp-guide
Version:
Task automator for the Basecamp Framework.
94 lines (88 loc) • 2.89 kB
JavaScript
// Dependecies
var Colors = require('colors');
/**
*
* Logs information about a
* given action to the console
*
*/
var Feedback = (function() {
// private vars
var codes = {
AFTER_TEXT_NOT_EXIST : function(data) {
console.log('Can not find AFTER-Text.'.yellow);
console.log(data.grey);
},
CONTENT_ADDED : function(data) {
console.log(data + ' added.'.green);
},
CONTENT_EXIST : function(data) {
console.log(data + ' already exist.'.yellow);
},
CONTENT_REPLACED : function(data) {
console.log('Content' + ' replaced.'.green);
console.log(data.grey)
},
CONTENT_TO_REPLACE_NOT_EXIST : function(data) {
console.log('Can not find content to replace.'.yellow);
console.log(data.grey);
},
DIRECTORY_DELETED : function(data) {
console.log(data, ' deleted.'.green);
},
DIRECTORY_NOT_EXIST : function(data) {
console.log(data + ' do not exist.'.red);
},
DIRECTORY_HAS_FILES : function(data) {
console.log(data + ' has files.'.yellow);
},
END_TEXT_NOT_EXIST : function(data) {
console.log('Can not find END-Text.'.yellow);
console.log(data.grey);
},
FILE_CREATED : function(data) {
console.log(data, ' created.'.green);
},
FILE_DELETED : function(data) {
console.log(data, ' deleted.'.green);
},
FILE_EXIST : function(data) {
console.log(data, ' already exist.'.yellow);
},
FILE_MODIFIED : function(data) {
console.log(data + ' modified.'.green);
},
FILE_NO_UPDATE : function(data) {
console.log(data + ' not updated.'.yellow);
},
FILE_NOT_CREATED : function(data) {
console.log(data, ' is not created.'.yellow);
},
FILE_NOT_MODIFIED : function(data) {
console.log(data + ' not modified.'.yellow);
},
FILE_NOT_EXIST : function(data) {
console.log(data + ' do not exist.'.red);
},
START_TEXT_NOT_EXIST : function(data) {
console.log('Can not find START-Text.'.yellow);
console.log(data.grey);
},
};
return {
// public methods
tell : function(action, data) {
try {
codes[action](data);
} catch (error) {
console.log('');
console.log('--- FILECONTENT-ERROR: ---'.red);
console.log('Action: ' + action.grey);
console.log('Data: ' + data.grey );
console.log(Colors.red(error));
console.log('');
}
}
};
})();
module.exports = Feedback;