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