Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 124 lines (107 sloc) 3.184 kB
a548e49 Initial checkin.
codahale authored
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'
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
7 require "benchmark"
a548e49 Initial checkin.
codahale authored
8
9 PKG_NAME = "bcrypt-ruby"
3137ad6 @codahale Prepare for the 2.0.5 release.
authored
10 PKG_VERSION = "2.0.5"
a548e49 Initial checkin.
codahale authored
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',
8f7acf4 @FooBarWidget Finish JRuby support.
FooBarWidget authored
18 'ext/*.rb',
19 'ext/jruby/bcrypt_jruby/BCrypt.java',
20 'ext/jruby/bcrypt_jruby/BCrypt.class'
a548e49 Initial checkin.
codahale authored
21 ]
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
22 CLEAN.include(
23 "ext/*.o",
24 "ext/*.bundle",
25 "ext/*.so"
26 )
27 CLOBBER.include(
4600360 Updated changelog with full details of what's been changed.
codahale authored
28 "doc/coverage"
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
29 )
a548e49 Initial checkin.
codahale authored
30
2020114 @codahale Make rake compile behave better, make the default task a full recompi…
authored
31 task :default => [:compile, :spec]
a548e49 Initial checkin.
codahale authored
32
33 desc "Run all specs"
34 Spec::Rake::SpecTask.new do |t|
35 t.spec_files = FileList['spec/**/*_spec.rb']
36 t.spec_opts = ['--color','--backtrace','--diff']
fb7906c @FooBarWidget Fix the unit tests.
FooBarWidget authored
37 end
38
39 desc "Run all specs, with coverage testing"
40 Spec::Rake::SpecTask.new(:rcov) do |t|
41 t.spec_files = FileList['spec/**/*_spec.rb']
42 t.spec_opts = ['--color','--backtrace','--diff']
a548e49 Initial checkin.
codahale authored
43 t.rcov = true
4600360 Updated changelog with full details of what's been changed.
codahale authored
44 t.rcov_dir = 'doc/coverage'
79bcfae @FooBarWidget When running the coverage test, correctly ignore non-bcrypt-ruby sour…
FooBarWidget authored
45 t.rcov_opts = ['--exclude', 'rspec,diff-lcs,rcov,_spec,_helper']
a548e49 Initial checkin.
codahale authored
46 end
47
48 desc 'Generate RDoc'
49 rd = Rake::RDocTask.new do |rdoc|
4600360 Updated changelog with full details of what's been changed.
codahale authored
50 rdoc.rdoc_dir = 'doc/rdoc'
a548e49 Initial checkin.
codahale authored
51 rdoc.options << '--title' << 'bcrypt-ruby' << '--line-numbers' << '--inline-source' << '--main' << 'README'
52 rdoc.template = ENV['TEMPLATE'] if ENV['TEMPLATE']
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
53 rdoc.rdoc_files.include('README', 'COPYING', 'CHANGELOG', 'lib/**/*.rb')
a548e49 Initial checkin.
codahale authored
54 end
55
56 spec = Gem::Specification.new do |s|
57 s.name = PKG_NAME
58 s.version = PKG_VERSION
b53ba3b Actually write a gem description and summary. "Blah" and "Woot" don't…
codahale authored
59 s.summary = "OpenBSD's bcrypt() password hashing algorithm."
a548e49 Initial checkin.
codahale authored
60 s.description = <<-EOF
b53ba3b Actually write a gem description and summary. "Blah" and "Woot" don't…
codahale authored
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.
a548e49 Initial checkin.
codahale authored
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
e66116d @codahale Prepare for the 2.0.3 release.
authored
75 s.authors = ["Coda Hale"]
a548e49 Initial checkin.
codahale authored
76 s.email = "coda.hale@gmail.com"
77 s.homepage = "http://bcrypt-ruby.rubyforge.org"
78 s.rubyforge_project = "bcrypt-ruby"
79 end
80
81 Rake::GemPackageTask.new(spec) do |pkg|
82 pkg.need_zip = true
83 pkg.need_tar = true
84 end
85
8f7acf4 @FooBarWidget Finish JRuby support.
FooBarWidget authored
86 desc "Clean, then compile the extension that's native to the current Ruby compiler."
87 if RUBY_PLATFORM == "java"
88 task :compile => 'compile:jruby'
89 else
90 task :compile => 'compile:mri'
91 end
92
93 namespace :compile do
94 desc "CLean, then compile all extensions"
95 task :all => [:mri, :jruby]
96
97 desc "Clean, then compile the MRI extension"
98 task :mri => :clean do
99 Dir.chdir('ext') do
100 ruby "extconf.rb"
101 sh "make"
102 end
103 end
104
105 desc "Clean, then compile the JRuby extension"
106 task :jruby => :clean do
107 Dir.chdir('ext/jruby/bcrypt_jruby') do
108 sh "javac BCrypt.java"
109 end
f01304a @FooBarWidget Improve 'compile' Rake task.
FooBarWidget authored
110 end
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
111 end
112
90cd206 Added descriptions to compile and benchmark so's I can find them agai…
codahale authored
113 desc "Run a set of benchmarks on the compiled extension."
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
114 task :benchmark do
115 TESTS = 100
116 TEST_PWD = "this is a test"
8caa1cc @FooBarWidget When on Ruby 1.9, unlock the global interpreter lock while calculatin…
FooBarWidget authored
117 require File.expand_path(File.join(File.dirname(__FILE__), "lib", "bcrypt"))
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
118 Benchmark.bmbm do |results|
119 4.upto(10) do |n|
120 results.report("cost #{n}:") { TESTS.times { BCrypt::Password.create(TEST_PWD, :cost => n) } }
121 end
122 end
123 end
Something went wrong with that request. Please try again.