Skip to content

Commit

Permalink
Rakefile : "size" task added : print and check sizes, exit if camping…
Browse files Browse the repository at this point in the history
….rb is

 greater than 4096 bytes. The default task now execute :size first. 
 Easy check to prevent sizes overgrow.
  • Loading branch information
Jonas Pfenniger committed Sep 23, 2007
1 parent ea45075 commit 53b1a73
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RDOC_OPTS = ['--quiet', '--title', "Camping, the Documentation",
"--inline-source"]

desc "Packages up Camping."
task :default => [:package]
task :default => [:size, :package]
task :package => [:clean]

task :doc => [:before_doc, :rdoc, :after_doc]
Expand Down Expand Up @@ -128,3 +128,16 @@ task :diff do
sh "diff -u .camping-unabridged.pt .camping.pt | less"
end

SIZE_LIMIT = 4096
desc "Compare camping sizes to unabridged"
task :size do
size = File.size("lib/camping-unabridged.rb")
FileList["lib/camping*.rb"].each do |path|
s = File.size(path)
puts "%21s : % 6d % 4d%" % [File.basename(path), s, (100 * s / size)]
end
if File.size("lib/camping.rb") > SIZE_LIMIT
STDERR.puts "ERROR: camping.rb is too big (> #{SIZE_LIMIT})"
exit 1
end
end

0 comments on commit 53b1a73

Please sign in to comment.