-
Notifications
You must be signed in to change notification settings - Fork 6
/
Rakefile
47 lines (41 loc) · 1.47 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
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 = 'ots'
s.version = '0' # modify ext/version.h
s.date = Date.today
s.authors = ['Bharanee Rathna']
s.email = ['[email protected]']
s.summary = 'Open Text Summarizer interface for Ruby.'
s.description = 'Ruby interface to libots libraries for unix.'
s.homepage = 'http://github.com/deepfryed/ots'
s.files = Dir['ext/**/*.{c,h}'] + Dir['{ext,test,lib}/**/*.rb'] + %w(README.md CHANGELOG) + Dir['*/*.xml']
s.extensions = %w(ext/ots/extconf.rb)
s.require_paths = %w(lib ext)
s.add_development_dependency('rake')
s.add_development_dependency('rake-compiler')
end
desc 'Generate ots gemspec'
task :gemspec do
$gemspec.date = Date.today
$gemspec.version = File.read($rootdir + 'ext/ots/version.h').scan(/[\d.]+/).first
File.open('ots.gemspec', 'w') {|fh| fh.write($gemspec.to_ruby)}
end
desc 'compile extension'
task :compile do
Dir.chdir('ext/ots') do
system('ruby extconf.rb && make clean && make -j2') or raise 'unable to compile ots'
end
end
Rake::TestTask.new(:test) do |test|
test.libs << 'ext' << 'lib' << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end
task default: :test
task :test => [:compile]