Cloak 8.0 review
DownloadCloak (Kind of short for comment locator) is a programming tool written in Ruby that I started as a project to familiarize myself wit
|
|
Cloak (Kind of short for comment locator) is a programming tool written in Ruby that I started as a project to familiarize myself with the Ruby programming language. Now it's grown into a full-blown tool that I think many programmers can benefit from. Cloak reads in your source code and extracts the comments. It then stores them in a SQLite database so you can list all the comments for a particular file, or search all the comments in the database. If you happen to update a file and then want to list its comments, Cloak will automatically synchronize it for you and then perform the desired operation.
You might be thinking, "Why would I want to keep track of all my comments, of all things?" Well, I don't know about you, but I love to leave notes to myself in source code comments. And if you were thinking that Cloak would still make you wade through your comments after it spits them out, think again; Cloak allows you to provide a Ruby method to filter what comments are and are not included in the database, as well as a method to modify the comments before they are put in the database. So if you're a C programmer and you write notes to yourself in the form of all upper case comments, but you want to prefix all such comments with an exclamation point before they go in the database, you'd put something like this in your .cloak_conf.rb:
def keep_comment?(comment)
return comment !~ /[a-z];
end
def modify_comment(comment)
return "!" + comment
end
That way the comment
/* URGENT MESSAGE */
becomes
!/* URGENT MESSAGE */
and all comments not matching your criteria are not included in the database.
Although only a few languages are supported right now (see the list below), Cloak is easily extensible: just write a Ruby script to extract the comments from a source file, and drop it into the extractors/ subdirectory; Cloak will take care of the rest.
Currently supported languages:
C
C++
Java
C#
Cloak 8.0 keywords