Skip to content

Commit

Permalink
Remove index of classes, add a code listing
Browse files Browse the repository at this point in the history
  • Loading branch information
jonleighton committed Feb 28, 2010
1 parent 053ea1a commit fa2669d
Show file tree
Hide file tree
Showing 8 changed files with 3,844 additions and 178 deletions.
35 changes: 31 additions & 4 deletions Rakefile
Expand Up @@ -16,9 +16,36 @@ end

task :default => :spec

code_files = Rake::FileList['lib/**/*.rb', 'lib/**/*.treetop', 'lib/**/*.carat'].
exclude('lib/parser/language.rb',
'lib/parser/comment.rb').to_a.sort!

task :sloccount do
files = Rake::FileList['lib/**/*.rb', 'lib/**/*.treetop'].
exclude('lib/parser/language.rb',
'lib/parser/comment.rb')
system "sloccount", *files
count = 0
code_files.each do |file_name|
File.open(file_name) do |file|
file.each_line do |line|
count += 1 unless line =~ /^\s*$/
end
end
end
puts count
end

task :generate_code_listing do
listing = ""
listing << File.read("report/code_listing_header.tex")
code_files.each do |file|
title = file.gsub("_", '\_').sub("lib/", "")
language = (file =~ /\.treetop/) ? "treetop" : "Ruby"
listing << <<-TEX
\\begin{lstlisting}[title={\\small\\Helvetica #{title}},language=#{language}]
#{File.read(file)}
\\end{lstlisting}
TEX
end

File.open("report/code_listing.tex", "w+") do |file|
file.write(listing)
end
end
2 changes: 1 addition & 1 deletion lib/ast/scopes.rb
Expand Up @@ -128,7 +128,7 @@ def minimum_arity
def maximum_arity
case type
when :splat
Infinity
(1.0/0) # Infinity
when :block_pass
0 # Block pass is not considered party of the arity
else
Expand Down
2 changes: 0 additions & 2 deletions lib/carat.rb
@@ -1,7 +1,5 @@
require "forwardable"

Infinity = 1.0 / 0

module Carat
ROOT_PATH = File.expand_path(File.dirname(__FILE__))
RUNTIME_PATH = ROOT_PATH + "/runtime"
Expand Down
167 changes: 0 additions & 167 deletions report/classes_index.tex

This file was deleted.

0 comments on commit fa2669d

Please sign in to comment.