Permalink
Browse files

Fixed cleaning and clobbering, added benchmark task, removed doc dire…

…ctory.

git-svn-id: http://bcrypt-ruby.rubyforge.org/svn/trunk@17 b1e0f299-433e-4bb3-9895-84128a6cfb6a
  • Loading branch information...
1 parent 64fa202 commit 51520c435c078a121e03cd54a3fa088136fe3644 codahale committed Mar 8, 2007
Showing with 23 additions and 3 deletions.
  1. +23 −3 Rakefile
View
@@ -4,6 +4,7 @@ require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher'
require 'rake/clean'
require 'rake/rdoctask'
+require "benchmark"
PKG_NAME = "bcrypt-ruby"
PKG_VERSION = "2.0.0"
@@ -16,6 +17,14 @@ PKG_FILES = FileList[
'ext/*.h',
'ext/*.rb'
]
+CLEAN.include(
+ "ext/*.o",
+ "ext/*.bundle",
+ "ext/*.so"
+)
+CLOBBER.include(
+ "doc"
+)
task :default => [:spec]
@@ -39,7 +48,7 @@ rd = Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'doc/output/rdoc'
rdoc.options << '--title' << 'bcrypt-ruby' << '--line-numbers' << '--inline-source' << '--main' << 'README'
rdoc.template = ENV['TEMPLATE'] if ENV['TEMPLATE']
- rdoc.rdoc_files.include('README', 'COPYING', 'lib/**/*.rb')
+ rdoc.rdoc_files.include('README', 'COPYING', 'CHANGELOG', 'lib/**/*.rb')
end
spec = Gem::Specification.new do |s|
@@ -73,8 +82,19 @@ Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_tar = true
end
-task :compile do
+task :compile => [:clean] do
Dir.chdir('./ext')
system "ruby extconf.rb"
system "make"
-end
+end
+
+task :benchmark do
+ TESTS = 100
+ TEST_PWD = "this is a test"
+ require "lib/bcrypt"
+ Benchmark.bmbm do |results|
+ 4.upto(10) do |n|
+ results.report("cost #{n}:") { TESTS.times { BCrypt::Password.create(TEST_PWD, :cost => n) } }
+ end
+ end
+end

0 comments on commit 51520c4

Please sign in to comment.