-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRakefile
53 lines (46 loc) · 1.73 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require 'date'
require 'pathname'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/extensiontask'
$rootdir = Pathname.new(__FILE__).dirname
$gemspec = Gem::Specification.new do |s|
s.name = 'bloom-filter'
s.version = '0' # modify ext/version.h
s.date = Date.today
s.authors = ['Bharanee Rathna']
s.email = ['deepfryed@gmail.com']
s.summary = 'A fast Bloom Filter library for Ruby.'
s.description = 'A fast Bloom Filter library for Ruby for unices.'
s.homepage = 'http://github.com/deepfryed/bloom-filter'
s.files = Dir['ext/**/*.{cc,c,h}'] + Dir['{ext,test}/*.rb'] + %w(LICENSE README.md CHANGELOG) + Dir['lib/**/*.rb']
s.licenses = %W(MIT)
s.extensions = %w(ext/extconf.rb)
s.require_paths = %w(lib)
s.add_development_dependency('rake', '~> 0')
s.add_development_dependency('rake-compiler', '~> 0')
end
desc 'Generate bloom-filter gemspec'
task :gemspec do
$gemspec.date = Date.today
$gemspec.version = File.read($rootdir + 'ext/version.h').scan(/[\d.]+/).first
File.open('bloom-filter.gemspec', 'w') {|fh| fh.write($gemspec.to_ruby)}
end
Rake::ExtensionTask.new do |ext|
ext.name = 'bloom_filter'
ext.ext_dir = 'ext'
ext.lib_dir = 'lib'
end
Rake::TestTask.new(:test) do |test|
test.libs << 'ext' << 'lib' << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end
task test: [:compile]
task default: :test
desc 'tag release and build gem'
task :release => [:test, :gemspec] do
system("git tag -m 'version #{$gemspec.version}' v#{$gemspec.version}") or raise "failed to tag release"
system("gem build #{$gemspec.name}.gemspec")
end