Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

New version 0.5.0

  • Loading branch information...
commit de6027a224a43b9b265282696e7a82ab2a19c102 1 parent 4fb8635
@KirillTemnov authored
View
11 .strack
@@ -31,7 +31,7 @@
"6e46407f9ece9a7752ab3a687f9d7cf7": {"created":"2011-02-26T09:57:24.519Z","modified":"2011-02-26T10:34:08.979Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done add docs for addTickets +auto +source-parser.coffee\ntodo add docs for addTickets\n\n###\n...","id":"6e46407f9ece9a7752ab3a687f9d7cf7","comments":[],"log":[],"state":"done"},
"ef19a5c99ea8848bc74577de4070c438": {"created":"2011-02-26T09:57:24.521Z","modified":"2011-02-26T10:36:44.631Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Add docs for addUniqueTicket +auto +tickets.coffee\n todo Add docs for addUniqueTicket\n\n ###\n...","id":"ef19a5c99ea8848bc74577de4070c438","comments":[],"log":[],"state":"done"},
"8d5e0596b1785efcf54d31594cddd648": {"created":"2011-02-26T09:57:24.521Z","modified":"2011-02-26T10:38:40.996Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done add docs here! +auto +tickets.coffee\n todo add docs here!\n ###\n changeTicket: (config, id, text) ->\n...","id":"8d5e0596b1785efcf54d31594cddd648","comments":[],"log":[],"state":"done"},
-"46c9d5280a35159e7ad5aa50c872f4fe": {"created":"2011-02-26T09:57:24.523Z","modified":"2011-02-27T19:37:03.109Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@cancel use this +auto +util.coffee\nexports.maxWidth = 100 # todo use this\n\n...","id":"46c9d5280a35159e7ad5aa50c872f4fe","comments":[],"log":[],"state":"todo"},
+"46c9d5280a35159e7ad5aa50c872f4fe": {"created":"2011-02-26T09:57:24.523Z","modified":"2011-02-27T19:37:03.109Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@cancel use this +auto +util.coffee\nexports.maxWidth = 100 # todo use this\n\n...","id":"46c9d5280a35159e7ad5aa50c872f4fe","comments":[],"log":[],"state":"cancel"},
"151d1ec97f0b172dd1f5a19b723e3d1d": {"created":"2011-02-26T12:28:54.449Z","modified":"2011-02-26T14:00:42.793Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done sort results by date, etc +auto +tickets.coffee\n for id, t of @done # todo sort results by date, etc\n state = util.getState t.text, config\n doned = state in @done","id":"151d1ec97f0b172dd1f5a19b723e3d1d","comments":[],"log":[],"state":"done"},
"c8a9da8e527ecc32494e170c9768b003": {"created":"2011-02-26T12:28:54.453Z","modified":"2011-02-26T23:47:19.632Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Add docstrings for Config methods +auto +util.coffee\ntodo Add docstrings for Config methods\n###\nclass Config\n...","id":"c8a9da8e527ecc32494e170c9768b003","comments":[],"log":[],"state":"done"},
"7099723e08be2257c7a0e83aa56557ee": {"created":"2011-02-26T12:28:54.454Z","modified":"2011-02-26T12:33:13.970Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Add docs for getWord +auto +util.coffee\ntodo Add docs for getWord\n\n###\n...","id":"7099723e08be2257c7a0e83aa56557ee","comments":[],"log":[],"state":"done"},
@@ -45,17 +45,18 @@
"a5012f3fd6b7e7bf986dc436a2011156": {"created":"2011-02-26T23:00:51.236Z","modified":"2011-02-26T23:09:26.546Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Add short +alias for command line utility.","id":"a5012f3fd6b7e7bf986dc436a2011156","comments":[],"log":[],"state":"done"},
"9af76cbd5768a2a36227b8d34db9f963": {"created":"2011-02-26T23:04:33.407Z","modified":"2011-02-26T23:34:55.852Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Use wider basis system for ^ aliases +feature","id":"9af76cbd5768a2a36227b8d34db9f963","comments":[],"log":[],"state":"done"},
"248651d3fcac81bb088611cbbfe12c4f": {"created":"2011-02-26T23:13:51.158Z","modified":"2011-02-27T19:10:06.533Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Show only comments on task +feature","id":"248651d3fcac81bb088611cbbfe12c4f","comments":[{"date":"2011-02-26T23:35:43.756Z","author":{"user":"selead","email":"allselead@gmail.com"},"comment":"I need to comment this\ntask for ckeck it out.\n","id":"94a1ca18365425d18e4fa670c630967e"}],"log":[],"state":"done"},
-"fb05871ea81e0cb8e426d46c2b070425": {"created":"2011-02-26T23:46:06.161Z","modified":"2011-02-26T23:52:48.658Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@todo Add python for parsing\n","id":"fb05871ea81e0cb8e426d46c2b070425","comments":[],"log":[],"state":"todo"},
+"fb05871ea81e0cb8e426d46c2b070425": {"created":"2011-02-26T23:46:06.161Z","modified":"2011-02-27T21:39:42.929Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Add python for parsing\n","id":"fb05871ea81e0cb8e426d46c2b070425","comments":[],"log":[],"state":"done"},
"b6ca3422346df4fab096a97fa172abb1": {"created":"2011-02-26T23:46:06.168Z","modified":"2011-02-26T23:52:35.407Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Add docs for getWord +auto +util.js\ntodo Add docs for getWord\n\n*/\n...","id":"b6ca3422346df4fab096a97fa172abb1","comments":[],"log":[],"state":"done"},
-"ecdc50f2f348b20e569f2e890091d9aa": {"created":"2011-02-27T13:02:48.038Z","modified":"2011-02-27T13:02:48.038Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@todo Add ruby for parsing","id":"ecdc50f2f348b20e569f2e890091d9aa","comments":[],"log":[],"state":"todo"},
+"ecdc50f2f348b20e569f2e890091d9aa": {"created":"2011-02-27T13:02:48.038Z","modified":"2011-02-27T21:44:46.845Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Add ruby for parsing","id":"ecdc50f2f348b20e569f2e890091d9aa","comments":[],"log":[],"state":"done"},
"23efea8c339da5892415ed1adbb6535d": {"created":"2011-02-27T13:09:04.369Z","modified":"2011-02-27T13:14:15.873Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Add warning on empty email","id":"23efea8c339da5892415ed1adbb6535d","comments":[],"log":[],"state":"done"},
"86e484c50ddc45a2a98159e8843c01af": {"created":"2011-02-27T13:21:05.251Z","modified":"2011-02-27T13:22:42.447Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@fixed for write short links user 16-radix system, for read - 36-radix","id":"86e484c50ddc45a2a98159e8843c01af","comments":[],"log":[],"state":"fixed"},
"723e47d9090527d1067fe1b5ee4ad44d": {"created":"2011-02-27T14:19:32.262Z","modified":"2011-02-27T19:34:21.117Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Remove config from ticket class params +refactoring","id":"723e47d9090527d1067fe1b5ee4ad44d","comments":[],"log":[],"state":"done"},
-"434969e2c8b5f786a07054ece5394bce": {"created":"2011-02-27T14:34:08.779Z","modified":"2011-02-27T14:34:08.779Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@todo search tracker file in higher directories\n","id":"434969e2c8b5f786a07054ece5394bce","comments":[],"log":[],"state":"todo"},
+"434969e2c8b5f786a07054ece5394bce": {"created":"2011-02-27T14:34:08.779Z","modified":"2011-02-27T20:14:11.268Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done search tracker file in higher directories\n","id":"434969e2c8b5f786a07054ece5394bce","comments":[],"log":[],"state":"done"},
"d771c6613acb93e7d1a96e8fa617aa5d": {"created":"2011-02-27T14:35:08.512Z","modified":"2011-02-27T14:35:08.512Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"+feature edit comment text in limited time","id":"d771c6613acb93e7d1a96e8fa617aa5d","comments":[],"log":[],"state":"todo"},
"34dd12f5b1fa32633a370e51eb819173": {"created":"2011-02-27T18:41:06.441Z","modified":"2011-02-27T18:42:55.461Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"prefix for states, e.g. @cancel @cancel +auto +util.coffee\n# prefix for states, e.g. @cancel @cancel = statePrefix = \"@\"\n# prefix for tags, e.g. +javascript, coffee-script\n...","id":"34dd12f5b1fa32633a370e51eb819173","comments":[],"log":[],"state":"cancel"},
"80d59492531dc0a55bb9dc56ecfcbc07": {"created":"2011-02-27T18:41:06.446Z","modified":"2011-02-27T18:42:38.892Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"source files, when auto search @cancel performs +auto +util.coffee\n # source files, when auto search todo performs\n @cancel ||= \"asc\" # sort order: \"asc\" or \"desc\"\n @cancel ||= \"true\" # show line numbers when edit multiline text\n...","id":"80d59492531dc0a55bb9dc56ecfcbc07","comments":[],"log":[],"state":"cancel"},
-"2bb2326ed295e2cb2fb6dcbc7c8b9a44": {"created":"2011-02-27T19:35:34.918Z","modified":"2011-02-27T19:35:34.918Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"+feature use zebra colors in log to distinct shortlinks","id":"2bb2326ed295e2cb2fb6dcbc7c8b9a44","comments":[],"log":[],"state":"todo"}
+"2bb2326ed295e2cb2fb6dcbc7c8b9a44": {"created":"2011-02-27T19:35:34.918Z","modified":"2011-02-27T19:35:34.918Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"+feature use zebra colors in log to distinct shortlinks","id":"2bb2326ed295e2cb2fb6dcbc7c8b9a44","comments":[],"log":[],"state":"todo"},
+"cc50db931cb7384c19ad848cbc284ee6": {"created":"2011-02-27T20:24:07.303Z","modified":"2011-02-27T21:50:35.473Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done add comments count in tiny view\n","id":"cc50db931cb7384c19ad848cbc284ee6","comments":[{"date":"2011-02-27T21:50:07.367Z","author":{"user":"selead","email":"allselead@gmail.com"},"comment":"Need another comment to check this task\n","id":"a297ca269376e0bf97667630d345bd74"}],"log":[],"state":"todo"}
},
"states":{"initial":["todo","bug","accept"],"final":["done","fixed","closed","cancel"]}
}
View
23 lib/source-parser.coffee
@@ -21,6 +21,18 @@ sourceOptions =
multilineCommentEnd: "###"
escapeStringQuotesRe: [/\\\'/g, /\\\"/g]
stringRe: [new RegExp("'[^']+'", "g"), new RegExp('"[^"]+"', "g")]
+ py:
+ oneLineComment: "#"
+ multilineCommentStart: null
+ multilineCommentEnd: null
+ escapeStringQuotesRe: [/\\\'/g, /\\\"/g]
+ stringRe: [new RegExp("'[^']+'", "g"), new RegExp('"[^"]+"', "g")]
+ rb:
+ oneLineComment: "#"
+ multilineCommentStart: "=begin"
+ multilineCommentEnd: "=end"
+ escapeStringQuotesRe: [/\\\'/g, /\\\"/g]
+ stringRe: [new RegExp("'[^']+'", "g"), new RegExp('"[^"]+"', "g")]
###
Remove strings from line
@@ -57,11 +69,12 @@ extractCommentsText = (line, opts, mlCommentOpen) ->
else
[line, true]
else
+ mlcLength = if opts.multilineCommentStart then opts.multilineCommentStart.length else 0
if 0 <= mlStart
if mlStart < mlEnd # extract one lined multiline comment
- [line.substring(mlStart + opts.multilineCommentStart.length, mlEnd), false]
+ [line.substring(mlStart + mlcLength, mlEnd), false]
else # extract first line of multiline comment
- [line.substring(mlStart + opts.multilineCommentStart.length), true]
+ [line.substring(mlStart + mlcLength), true]
else if 0 <= olComment
[line.substring(olComment + opts.oneLineComment.length), false]
else
@@ -95,18 +108,18 @@ exports.addTickets = (file, tags, tracker, config) ->
for t in tags
if 0 <= comment.toLowerCase().indexOf t
if ticketText
- tracker.addUniqueTicket config, ticketText + "\n..."
+ tracker.addUniqueTicket ticketText + "\n..."
ticketText = ""
else
ticketText = comment.trim().replace(t, util.statePrefix + t) + " +auto +" +
- path.basename(file) + "\n" + line
+ util.extractPartialPath(file) + "\n" + line
curLines = 1
else if ticketText
if curLines < linesMax
ticketText += "\n" + line
curLines++
else
- tracker.addUniqueTicket config, ticketText + "\n..."
+ tracker.addUniqueTicket ticketText + "\n..."
ticketText = ""
curLines = 1
View
54 lib/tracker.coffee
@@ -3,6 +3,7 @@ util = require "./util"
ucs = util.colorizeString
cFL = util.cutFirstLine
sys = require "sys"
+path = require "path"
class Tracker
constructor: (@config) ->
@@ -29,23 +30,27 @@ class Tracker
@api public
###
load: () ->
- try
- filename = "./" + @config.get "trackerFile"
- @_create JSON.parse fs.readFileSync filename
- catch err
- if "EBADF" == err.code
- @_create()
- if "yes" == @config.get "askBeforeCreate"
- @created = no
- self = @
- util.readOneLine "create new tracker in this folder (yes/no)?", (answer) ->
- if answer.toLowerCase() in ["yes", "y"]
- self.save()
- else
- @save()
-# fs.writeFileSync filename, JSON.stringify @
- else
- throw err
+ preWd = ""
+ cwd = process.cwd()
+ trackerFile = @config.get "trackerFile"
+ while cwd != preWd
+ preWd = cwd
+ cwd = path.dirname cwd
+ try
+ @filename = "#{preWd}/#{trackerFile}"
+ @_create JSON.parse fs.readFileSync @filename
+ return
+ catch err
+ cwd = process.cwd()
+ @filename = "#{cwd}/#{trackerFile}"
+ @_create()
+ if "yes" == @config.get "askBeforeCreate"
+ @created = no
+ self = @
+ util.readOneLine "Create new tracker in #{cwd} (yes/no) ? ", (answer) ->
+ if answer.toLowerCase() in ["yes", "y"]
+ self.save()
+
###
Save tracker file
@@ -54,7 +59,6 @@ class Tracker
@api public
###
save: () ->
- filename = "./" + @config.get "trackerFile"
states = '"states":' + JSON.stringify @states
tickStr = '"tickets": {\n'
tickets = []
@@ -62,7 +66,7 @@ class Tracker
tickets.push '"' + k + '": ' + JSON.stringify v
tickStr += tickets.join(", \n") + "\n}"
data = "{\n#{tickStr},\n#{states}\n}\n"
- fs.writeFileSync filename, data
+ fs.writeFileSync @filename, data
###
Show project states
@@ -284,7 +288,7 @@ class Tracker
console.log ucs "Created: #{t.created}\n", done, "grey", ""
console.log ucs "Last modified: #{t.modified}", done, "grey", ""
console.log util.colorizeText t.text, search, done
- _showTicketComments t, done
+ @_showTicketComments t, done
console.log "\n-----------------------------------------"+
"---------------------------------------\n"
@@ -358,16 +362,16 @@ class Tracker
if null == search || 0 <= t.text.indexOf search
num = if 36 > i then ucs " ^#{i.toString(36)} ", done, "grey", "" else " "
+ comments =
+ if 0 < t.comments.length then ucs " [c:#{t.comments.length}]\t", done, "grey", "" else " \t"
+
switch @config.get "log"
when "tiny"
- console.log "#{num}\t#{util.colorizeText cFL(t.text, 60), null, done}"
+ console.log "#{num}\t#{util.colorizeText cFL(t.text, 60), null, done} " +
+ "\t#{comments}".blue
when "long"
@_logOne t, search
else # short of anything else is default
- comments = if 0 < t.comments.length
- ucs " [c:#{t.comments.length}]\t", done, "grey", ""
- else
- " \t"
console.log "#{cFL(t.id, 10).yellow}\t" +
"#{util.colorizeText cFL(t.text, 60), search, done}\t#{num}#{comments}" +
ucs "#{util.formatDateTime t.modified}\t#{t.author.user}",
View
11 lib/util.coffee
@@ -448,7 +448,6 @@ exports.readOneLine = (prompt="->", fn) ->
repl.setPrompt prompt
repl.on 'close', -> stdin.destroy()
repl.on 'line', (buffer) ->
- console.log "buffer = #{buffer}"
fn buffer.toString()
process.exit 0
repl.prompt()
@@ -488,3 +487,13 @@ exports.editTextLines = (text, terminator, fn, lineNum=true) ->
repl.prompt()
+
+###
+Extract from path filename and several directotires above
+
+@param {String} path Full path to file
+@return {String} filename Filename with some parent diractories
+@api public
+###
+exports.extractPartialPath = (path) ->
+ p.basename(p.dirname(path)) + '/' + p.basename path
View
4 package.json
@@ -1,6 +1,6 @@
{ "name": "strack",
- "description": "Track issues/bugs on project.",
- "version": "0.4.9",
+ "description": "Console task tracking and bugtracking system.",
+ "version": "0.5.0",
"bin": { "strack" : "./bin/strack.js", "s": "./bin/strack.js"},
"main": "./lib/strack.js",
"scripts": {"preinstall": "make all"},
Please sign in to comment.
Something went wrong with that request. Please try again.