From 53b1a73a0d5cc1837a8ac95cdc1c7882e7f75f3a Mon Sep 17 00:00:00 2001 From: Jonas Pfenniger Date: Sun, 23 Sep 2007 19:28:02 +0000 Subject: [PATCH] Rakefile : "size" task added : print and check sizes, exit if camping.rb is greater than 4096 bytes. The default task now execute :size first. Easy check to prevent sizes overgrow. --- Rakefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 436f533..64d5352 100644 --- a/Rakefile +++ b/Rakefile @@ -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] @@ -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