imdone-core
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -6,2 +6,12 @@ { | ||
"watcher": true, | ||
"code": { | ||
"include_lists": [ | ||
"TODO", | ||
"DOING", | ||
"DONE", | ||
"PLANNING", | ||
"FIXME", | ||
"ARCHIVE" | ||
] | ||
}, | ||
"lists": [ | ||
@@ -8,0 +18,0 @@ { |
@@ -28,2 +28,9 @@ var _ = require('lodash'); | ||
Config.prototype.includeList = function(list) { | ||
if (this.code && this.code.include_lists && this.code.include_lists.slice) { | ||
return _.indexOf(this.code.include_lists, list) > -1; | ||
} | ||
return true; | ||
}; | ||
module.exports = Config; |
@@ -302,5 +302,6 @@ var _ = require("lodash"), | ||
File.prototype.getTasksInCode = function(content, id) { | ||
File.prototype.getTasksInCode = function(content, id, config) { | ||
var self = this; | ||
var extractor = function(match, start, list, order, text, pos) { | ||
if (config && !config.includeList(list)) return; | ||
log("Found a CODE_STYLE_PATTERN task: list:%s, order:%d, text:%s", list, order, text); | ||
@@ -332,6 +333,2 @@ if ((text.toUpperCase() == text) || (text.replace(" ", "") === "")) return; | ||
// DONE:10 Now we need to look for multi-line comments | ||
/* | ||
* DONE:0 This will show up when we're done | ||
*/ | ||
/* DONE:20 This will also show up when we're done */ | ||
if (this.getLang().block) { | ||
@@ -356,4 +353,4 @@ var lang = this.getLang(); | ||
// DONE:30 Implement #listname style tasks in any text file | ||
// TODO:0 Allow code style tasks to be included and excluded with regex on List name | ||
// DONE:20 Implement #listname style tasks in any text file | ||
// DONE:0 Allow code style tasks to be included on list name | ||
/** | ||
@@ -364,3 +361,3 @@ * Description | ||
*/ | ||
File.prototype.extractTasks = function() { | ||
File.prototype.extractTasks = function(config) { | ||
var self = this; | ||
@@ -372,3 +369,3 @@ var id = 0; | ||
// Check for codestyle tasks | ||
this.getTasksInCode(clone, id); | ||
this.getTasksInCode(clone, id, config); | ||
@@ -431,3 +428,3 @@ clone.replace(new RegExp(LINK_STYLE_REGEX), function(md, text, list, order, pos) { | ||
*/ | ||
File.prototype.modifyTask = function(task) { | ||
File.prototype.modifyTask = function(task, config) { | ||
self = this; | ||
@@ -438,2 +435,3 @@ var n = 0, modified = false; | ||
var codeCommentReplacer = function(match, start, list, order, text, pos) { | ||
if (config && !config.includeList(list)) return match; | ||
var newText = match; | ||
@@ -440,0 +438,0 @@ if (n === task.id) { |
@@ -25,2 +25,5 @@ var _ = require('lodash'), | ||
watcher: true, | ||
code: { | ||
include_lists:["TODO", "DOING", "DONE", "PLANNING", "FIXME", "ARCHIVE"] | ||
}, | ||
lists: [], | ||
@@ -546,3 +549,3 @@ marked : { | ||
if (file.content === null) this.readFileContentSync(file); | ||
file.extractTasks(); | ||
file.extractTasks(this.getConfig()); | ||
file.content = null; | ||
@@ -857,3 +860,3 @@ file.removeListener('task.found', this.taskFoundListener); | ||
task.list = newName; | ||
file.modifyTask(task); | ||
file.modifyTask(task, self.getConfig()); | ||
}); | ||
@@ -885,3 +888,3 @@ | ||
log("content:%s", file.content); | ||
return file.modifyTask(task); | ||
return file.modifyTask(task, this.getConfig()); | ||
}; | ||
@@ -888,0 +891,0 @@ |
{ | ||
"name": "imdone-core", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "imdone-core", | ||
@@ -25,9 +25,9 @@ "main": "index.js", | ||
"dependencies": { | ||
"async": "~0.9.0", | ||
"chokidar": "~0.8.2", | ||
"debug": "~0.8.0", | ||
"isbinaryfile": "~2.0.1", | ||
"lodash": "~2.4.1", | ||
"marked": "~0.3.2", | ||
"isbinaryfile": "~2.0.1", | ||
"wrench": "~1.5.8", | ||
"async": "~0.9.0", | ||
"chokidar": "~0.8.2", | ||
"debug": "~0.8.0" | ||
"wrench": "~1.5.8" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
@@ -106,3 +106,3 @@ var should = require('should'), | ||
(project.getTasksInList("TODO").length).should.be.exactly(0); | ||
(project.getTasksInList("TODOS").length).should.be.exactly(tasksExpected); | ||
(project.getTasksInList("TODOS").length).should.be.exactly(tasksExpected-2); | ||
done(); | ||
@@ -109,0 +109,0 @@ }); |
91859
3118