Skip to content
This repository
Newer
Older
100644 106 lines (92 sloc) 2.696 kb
a548e49b »
2007-02-27 Initial checkin.
1 gem "rspec"
2 require "spec/rake/spectask"
3 require 'rake/gempackagetask'
4 require 'rake/contrib/rubyforgepublisher'
5 require 'rake/clean'
6 require 'rake/rdoctask'
51520c43 »
2007-03-08 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
7 require "benchmark"
a548e49b »
2007-02-27 Initial checkin.
8
9 PKG_NAME = "bcrypt-ruby"
74ca7141 »
2007-06-07 Preparing for release.
10 PKG_VERSION = "2.0.2"
a548e49b »
2007-02-27 Initial checkin.
11 PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12 PKG_FILES = FileList[
13 '[A-Z]*',
14 'lib/**/*.rb',
15 'spec/**/*.rb',
16 'ext/*.c',
17 'ext/*.h',
18 'ext/*.rb'
19 ]
51520c43 »
2007-03-08 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
20 CLEAN.include(
21 "ext/*.o",
22 "ext/*.bundle",
23 "ext/*.so"
24 )
25 CLOBBER.include(
46003605 »
2007-03-08 Updated changelog with full details of what's been changed.
26 "doc/coverage"
51520c43 »
2007-03-08 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
27 )
a548e49b »
2007-02-27 Initial checkin.
28
20201141 »
2008-05-07 Make rake compile behave better, make the default task a full recompi…
29 task :default => [:compile, :spec]
a548e49b »
2007-02-27 Initial checkin.
30
31 desc "Run all specs"
32 Spec::Rake::SpecTask.new do |t|
33 t.spec_files = FileList['spec/**/*_spec.rb']
34 t.spec_opts = ['--color','--backtrace','--diff']
35 t.rcov = true
46003605 »
2007-03-08 Updated changelog with full details of what's been changed.
36 t.rcov_dir = 'doc/coverage'
a548e49b »
2007-02-27 Initial checkin.
37 t.rcov_opts = ['--exclude', 'spec\/spec,spec\/.*_spec.rb']
38 end
39
46003605 »
2007-03-08 Updated changelog with full details of what's been changed.
40 namespace :spec do
41 desc "Run all specs and store html output in doc/specs.html"
42 Spec::Rake::SpecTask.new('html') do |t|
43 t.spec_files = FileList['spec/**/*_spec.rb']
44 t.spec_opts = ['--diff','--format html','--backtrace','--out doc/specs.html']
45 end
a548e49b »
2007-02-27 Initial checkin.
46 end
47
48 desc 'Generate RDoc'
49 rd = Rake::RDocTask.new do |rdoc|
46003605 »
2007-03-08 Updated changelog with full details of what's been changed.
50 rdoc.rdoc_dir = 'doc/rdoc'
a548e49b »
2007-02-27 Initial checkin.
51 rdoc.options << '--title' << 'bcrypt-ruby' << '--line-numbers' << '--inline-source' << '--main' << 'README'
52 rdoc.template = ENV['TEMPLATE'] if ENV['TEMPLATE']
51520c43 »
2007-03-08 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
53 rdoc.rdoc_files.include('README', 'COPYING', 'CHANGELOG', 'lib/**/*.rb')
a548e49b »
2007-02-27 Initial checkin.
54 end
55
56 spec = Gem::Specification.new do |s|
57 s.name = PKG_NAME
58 s.version = PKG_VERSION
b53ba3be »
2007-02-28 Actually write a gem description and summary. "Blah" and "Woot" don't…
59 s.summary = "OpenBSD's bcrypt() password hashing algorithm."
a548e49b »
2007-02-27 Initial checkin.
60 s.description = <<-EOF
b53ba3be »
2007-02-28 Actually write a gem description and summary. "Blah" and "Woot" don't…
61 bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project
62 for hashing passwords. bcrypt-ruby provides a simple, humane wrapper for safely handling
63 passwords.
a548e49b »
2007-02-27 Initial checkin.
64 EOF
65
66 s.files = PKG_FILES.to_a
67 s.require_path = 'lib'
68
69 s.has_rdoc = true
70 s.rdoc_options = rd.options
71 s.extra_rdoc_files = rd.rdoc_files.to_a
72
73 s.extensions = FileList["ext/extconf.rb"].to_a
74
75 s.autorequire = 'bcrypt'
76 s.author = ["Coda Hale"]
77 s.email = "coda.hale@gmail.com"
78 s.homepage = "http://bcrypt-ruby.rubyforge.org"
79 s.rubyforge_project = "bcrypt-ruby"
80 end
81
82 Rake::GemPackageTask.new(spec) do |pkg|
83 pkg.need_zip = true
84 pkg.need_tar = true
85 end
86
90cd2066 »
2007-06-07 Added descriptions to compile and benchmark so's I can find them agai…
87 desc "Clean, then compile the extension."
51520c43 »
2007-03-08 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
88 task :compile => [:clean] do
a548e49b »
2007-02-27 Initial checkin.
89 Dir.chdir('./ext')
90 system "ruby extconf.rb"
91 system "make"
20201141 »
2008-05-07 Make rake compile behave better, make the default task a full recompi…
92 Dir.chdir('..')
51520c43 »
2007-03-08 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
93 end
94
90cd2066 »
2007-06-07 Added descriptions to compile and benchmark so's I can find them agai…
95 desc "Run a set of benchmarks on the compiled extension."
51520c43 »
2007-03-08 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
96 task :benchmark do
97 TESTS = 100
98 TEST_PWD = "this is a test"
99 require "lib/bcrypt"
100 Benchmark.bmbm do |results|
101 4.upto(10) do |n|
102 results.report("cost #{n}:") { TESTS.times { BCrypt::Password.create(TEST_PWD, :cost => n) } }
103 end
104 end
105 end
Something went wrong with that request. Please try again.