RakefileView |
---|
6 | 6 | require 'rake/clean' |
7 | 7 | require 'rake/rdoctask' |
8 | 8 | require 'benchmark' |
9 | 9 | |
10 | | -PKG_NAME = "bcrypt-ruby" |
11 | | -PKG_VERSION = "2.1.2" |
12 | | -PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" |
13 | | -PKG_FILES = FileList[ |
14 | | - '[A-Z]*', |
15 | | - 'lib/**/*.rb', |
16 | | - 'spec/**/*.rb', |
17 | | - 'ext/mri/*.c', |
18 | | - 'ext/mri/*.h', |
19 | | - 'ext/mri/*.rb', |
20 | | - 'ext/jruby/bcrypt_jruby/BCrypt.java' |
21 | | -] |
22 | 10 | CLEAN.include( |
23 | 11 | "ext/mri/*.o", |
24 | 12 | "ext/mri/*.bundle", |
25 | 13 | "ext/mri/*.so", |
29 | 17 | "ext/mri/Makefile", |
30 | 18 | "doc/coverage", |
31 | 19 | "pkg" |
32 | 20 | ) |
| 21 | +GEMSPEC = eval(File.read(File.expand_path("../bcrypt-ruby.gemspec", __FILE__))) |
33 | 22 | |
34 | 23 | task :default => [:compile, :spec] |
35 | 24 | |
36 | 25 | desc "Run all specs" |
48 | 37 | |
49 | 38 | desc 'Generate RDoc' |
50 | 39 | rd = Rake::RDocTask.new do |rdoc| |
51 | 40 | rdoc.rdoc_dir = 'doc/rdoc' |
52 | | - rdoc.options << '--title' << 'bcrypt-ruby' << '--line-numbers' << '--inline-source' << '--main' << 'README' |
| 41 | + rdoc.options += GEMSPEC.rdoc_options |
53 | 42 | rdoc.template = ENV['TEMPLATE'] if ENV['TEMPLATE'] |
54 | | - rdoc.rdoc_files.include('README', 'COPYING', 'CHANGELOG', 'lib/**/*.rb') |
| 43 | + rdoc.rdoc_files.include(*GEMSPEC.extra_rdoc_files) |
55 | 44 | end |
56 | 45 | |
57 | | -spec = Gem::Specification.new do |s| |
58 | | - s.name = PKG_NAME |
59 | | - s.version = PKG_VERSION |
60 | | - s.summary = "OpenBSD's bcrypt() password hashing algorithm." |
61 | | - s.description = <<-EOF |
62 | | - bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project |
63 | | - for hashing passwords. bcrypt-ruby provides a simple, humane wrapper for safely handling |
64 | | - passwords. |
65 | | - EOF |
66 | | - |
67 | | - s.files = PKG_FILES.to_a |
68 | | - s.require_path = 'lib' |
69 | | - s.add_development_dependency 'rake-compiler' |
70 | | - |
71 | | - s.has_rdoc = true |
72 | | - s.rdoc_options = rd.options |
73 | | - s.extra_rdoc_files = rd.rdoc_files.to_a |
74 | | - |
75 | | - s.extensions = FileList["ext/mri/extconf.rb"].to_a |
76 | | - |
77 | | - s.authors = ["Coda Hale"] |
78 | | - s.email = "coda.hale@gmail.com" |
79 | | - s.homepage = "http://bcrypt-ruby.rubyforge.org" |
80 | | - s.rubyforge_project = "bcrypt-ruby" |
81 | | -end |
82 | | - |
83 | | -Rake::GemPackageTask.new(spec) do |pkg| |
| 46 | +Rake::GemPackageTask.new(GEMSPEC) do |pkg| |
84 | 47 | pkg.need_zip = true |
85 | 48 | pkg.need_tar = true |
86 | 49 | end |
87 | 50 | |
88 | 51 | if RUBY_PLATFORM =~ /java/ |
89 | | - Rake::JavaExtensionTask.new('bcrypt_ext', spec) do |ext| |
| 52 | + Rake::JavaExtensionTask.new('bcrypt_ext', GEMSPEC) do |ext| |
90 | 53 | ext.ext_dir = 'ext/jruby' |
91 | 54 | end |
92 | 55 | else |
93 | | - Rake::ExtensionTask.new("bcrypt_ext", spec) do |ext| |
| 56 | + Rake::ExtensionTask.new("bcrypt_ext", GEMSPEC) do |ext| |
94 | 57 | ext.ext_dir = 'ext/mri' |
95 | 58 | ext.cross_compile = true |
96 | 59 | ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60'] |
97 | 60 | |