Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 90 lines (79 sloc) 2.284 kB
6c505b3 @tmm1 Switch to rspec2
tmm1 authored
1 require 'rspec/core/rake_task'
a548e49 Initial checkin.
codahale authored
2 require 'rake/gempackagetask'
1965feb @tmm1 Switch to rake-compiler for building binary win32/java gems.
tmm1 authored
3 require 'rake/extensiontask'
4 require 'rake/javaextensiontask'
a548e49 Initial checkin.
codahale authored
5 require 'rake/contrib/rubyforgepublisher'
6 require 'rake/clean'
7 require 'rake/rdoctask'
6c505b3 @tmm1 Switch to rspec2
tmm1 authored
8 require 'benchmark'
a548e49 Initial checkin.
codahale authored
9
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
10 CLEAN.include(
7e4f6e0 @FooBarWidget Move MRI C extension into 'mri' subdirectory.
FooBarWidget authored
11 "ext/mri/*.o",
12 "ext/mri/*.bundle",
13 "ext/mri/*.so",
14 "ext/jruby/bcrypt_jruby/*.class"
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
15 )
16 CLOBBER.include(
7e4f6e0 @FooBarWidget Move MRI C extension into 'mri' subdirectory.
FooBarWidget authored
17 "ext/mri/Makefile",
17b18ea @codahale Do a better job of ensuring BCrypt.java gets compiled.
authored
18 "doc/coverage",
19 "pkg"
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
20 )
85cd242 @tmm1 Split out gemspec so git repo can be used in a Gemfile
tmm1 authored
21 GEMSPEC = eval(File.read(File.expand_path("../bcrypt-ruby.gemspec", __FILE__)))
a548e49 Initial checkin.
codahale authored
22
2020114 @codahale Make rake compile behave better, make the default task a full recompi…
authored
23 task :default => [:compile, :spec]
a548e49 Initial checkin.
codahale authored
24
25 desc "Run all specs"
6c505b3 @tmm1 Switch to rspec2
tmm1 authored
26 RSpec::Core::RakeTask.new do |t|
27 t.pattern = 'spec/**/*_spec.rb'
fb7906c @FooBarWidget Fix the unit tests.
FooBarWidget authored
28 end
29
30 desc "Run all specs, with coverage testing"
6c505b3 @tmm1 Switch to rspec2
tmm1 authored
31 RSpec::Core::RakeTask.new(:rcov) do |t|
32 t.pattern = 'spec/**/*_spec.rb'
a548e49 Initial checkin.
codahale authored
33 t.rcov = true
6c505b3 @tmm1 Switch to rspec2
tmm1 authored
34 t.rcov_path = 'doc/coverage'
79bcfae @FooBarWidget When running the coverage test, correctly ignore non-bcrypt-ruby sour…
FooBarWidget authored
35 t.rcov_opts = ['--exclude', 'rspec,diff-lcs,rcov,_spec,_helper']
a548e49 Initial checkin.
codahale authored
36 end
37
38 desc 'Generate RDoc'
39 rd = Rake::RDocTask.new do |rdoc|
4600360 Updated changelog with full details of what's been changed.
codahale authored
40 rdoc.rdoc_dir = 'doc/rdoc'
85cd242 @tmm1 Split out gemspec so git repo can be used in a Gemfile
tmm1 authored
41 rdoc.options += GEMSPEC.rdoc_options
a548e49 Initial checkin.
codahale authored
42 rdoc.template = ENV['TEMPLATE'] if ENV['TEMPLATE']
85cd242 @tmm1 Split out gemspec so git repo can be used in a Gemfile
tmm1 authored
43 rdoc.rdoc_files.include(*GEMSPEC.extra_rdoc_files)
a548e49 Initial checkin.
codahale authored
44 end
45
85cd242 @tmm1 Split out gemspec so git repo can be used in a Gemfile
tmm1 authored
46 Rake::GemPackageTask.new(GEMSPEC) do |pkg|
a548e49 Initial checkin.
codahale authored
47 pkg.need_zip = true
48 pkg.need_tar = true
49 end
50
1965feb @tmm1 Switch to rake-compiler for building binary win32/java gems.
tmm1 authored
51 if RUBY_PLATFORM =~ /java/
85cd242 @tmm1 Split out gemspec so git repo can be used in a Gemfile
tmm1 authored
52 Rake::JavaExtensionTask.new('bcrypt_ext', GEMSPEC) do |ext|
1965feb @tmm1 Switch to rake-compiler for building binary win32/java gems.
tmm1 authored
53 ext.ext_dir = 'ext/jruby'
54 end
8f7acf4 @FooBarWidget Finish JRuby support.
FooBarWidget authored
55 else
85cd242 @tmm1 Split out gemspec so git repo can be used in a Gemfile
tmm1 authored
56 Rake::ExtensionTask.new("bcrypt_ext", GEMSPEC) do |ext|
1965feb @tmm1 Switch to rake-compiler for building binary win32/java gems.
tmm1 authored
57 ext.ext_dir = 'ext/mri'
58 ext.cross_compile = true
59 ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
8f7acf4 @FooBarWidget Finish JRuby support.
FooBarWidget authored
60
1965feb @tmm1 Switch to rake-compiler for building binary win32/java gems.
tmm1 authored
61 # inject 1.8/1.9 pure-ruby entry point
62 ext.cross_compiling do |spec|
63 spec.files += ["lib/#{ext.name}.rb"]
8f7acf4 @FooBarWidget Finish JRuby support.
FooBarWidget authored
64 end
65 end
1965feb @tmm1 Switch to rake-compiler for building binary win32/java gems.
tmm1 authored
66 end
67
68 # Entry point for fat-binary gems on win32
69 file("lib/bcrypt_ext.rb") do |t|
70 File.open(t.name, 'wb') do |f|
71 f.write <<-eoruby
72 RUBY_VERSION =~ /(\\d+.\\d+)/
73 require "\#{$1}/#{File.basename(t.name, '.rb')}"
74 eoruby
f01304a @FooBarWidget Improve 'compile' Rake task.
FooBarWidget authored
75 end
1965feb @tmm1 Switch to rake-compiler for building binary win32/java gems.
tmm1 authored
76 at_exit{ FileUtils.rm t.name if File.exists?(t.name) }
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
77 end
78
90cd206 Added descriptions to compile and benchmark so's I can find them agai…
codahale authored
79 desc "Run a set of benchmarks on the compiled extension."
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
80 task :benchmark do
81 TESTS = 100
82 TEST_PWD = "this is a test"
8caa1cc @FooBarWidget When on Ruby 1.9, unlock the global interpreter lock while calculatin…
FooBarWidget authored
83 require File.expand_path(File.join(File.dirname(__FILE__), "lib", "bcrypt"))
51520c4 Fixed cleaning and clobbering, added benchmark task, removed doc dire…
codahale authored
84 Benchmark.bmbm do |results|
85 4.upto(10) do |n|
86 results.report("cost #{n}:") { TESTS.times { BCrypt::Password.create(TEST_PWD, :cost => n) } }
87 end
88 end
89 end
Something went wrong with that request. Please try again.