Contents
-
Overview
-
Download
-
Installation
-
Usage
-
Release Notes
Overview
CountLOC is a utility program, implemented in Ruby that provides support for generating LOC metrics for source code.
Initial releases will support counting lines of code in Ruby source code. Subsequent releases will add support for other programming languages such as Python, C, C++, C#, Java, Perl, etc. …
Download
The latest release can be downloaded from: rubyforge.org/projects/countloc/
The latest release can also be installed from the Gem Cutter repository at: gemcutter.org/gems/countloc
Installation
CountLOC is packaged as a Ruby gem and as a .zip file.
.gem: % gem install countloc-x.y.z.gem
.zip: % unzip countloc-x.y.z.zip % cd countloc-x.y.z % ruby setup.rb install
.tgz: % tar zxf countloc-x.y.z.tgz % cd countloc-x.y.z % ruby setup.rb install
Usage
For full listing of options and usage: % countloc.rb –help To get the LOC metrics for a single Ruby file: % countloc.rb some_file.rb
To get the LOC metrics for multiple Ruby files: % countloc.rb some_file.rb some_other_file.rb
To get the LOC metrics for all Ruby files in the current directory: % countloc.rb *.rb or % countloc.rb .
To get the LOC metrics for all Ruby files in a directory tree with recursion into subdirectories: % countloc.rb -r . To export the results to a html file: % countloc.rb -r –html countloc.html .
To export the results to a csv file: % countloc.rb -r –csv countloc.csv .
To get LOC metrics for a C file: % countloc.rb hello.c To get LOC metrics for all C files in a directory tree: % countloc.rb -r -m c .
Release Notes
Release 0.4.0:
Features
-
Added VB support via patch posted on Rubyforge
-
Added mode option to simplify the selection of source code language.
-
By default all known file types will be processed with language selected based on file type.
-
Installers now install an executable - countloc
Bugfixes:
- 27526
-
Added workaround for Ruby 1.9.1 bug which caused a stack trace to be dumped during exception processing when a bad filename or directory name was encountered.
- 27527
-
Improved help text.
- 27528
-
Improved handling of non-ruby source files.
- 27565
-
Fixed error where files are duplicated when a directory is specified as an argument.
Release 0.3.1:
Features
-
No new features - bugfix release only.
Bugfixes:
- 27525
-
Fixed compilation errors when using ruby 1.9
Release 0.3.0:
Features
-
Added support for generating LOC metrics for languages other than Ruby. Supported languages: Ruby, Python, C, C++, C#, Java and any language that shares the same commenting style as either of these languages.
Bugfixes:
-
Added documentation on supported options for CountLOC.countloc()
Release 0.2.1:
Features
-
None
Bugfixes:
-
#23479 - Column headers not displayed on console view of results
Release 0.2.0:
Features
-
Added support for exporting results in csv and html format.
-
Improved error handling - e.g. incorrect/missing command line options, file errors, etc.
-
Added setup.rb for ease of installation from the .zip/.tgz release formats.
-
Added CountLOC module to encapsulate methods and classes.
Bugfixes:
-
None
Release 0.1.0:
Features
-
Added support for processing multiple files at once.
-
Added support for processing all .rb files in a directory.
-
Added support for recursing into directory trees.
-
Improved formatting of output.
Bugfixes:
-
#23380 - Not suppressing path information in the program name in the usage string.
-
#23379 - Incorrectly counting a # inside a single quoted string as a comment.
Release 0.0.1:
Features
-
Initial release.
-
Supports generating LOC metrics for Ruby source code for a single file at a time.
-
Handles multi-line and single line comments.
-
Handles mixed lines of both code and comments.