forked from gjtorikian/mathematical
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
55 lines (41 loc) · 1.15 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
54
55
#!/usr/bin/env rake
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'fileutils'
require 'tmpdir'
LASEM_DIR = File.expand_path(File.join(File.dirname(__FILE__), 'ext', 'mathematical', 'lasem'))
Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end
require 'rake/extensiontask'
spec = Gem::Specification.load('mathematical.gemspec')
Rake::ExtensionTask.new('mathematical', spec) do |ext|
ext.lib_dir = File.join('lib', 'mathematical')
end
task default: [:test]
Gem::PackageTask.new(spec)
Rake::Task[:test].prerequisites
task :build => [:clean]
Rake::Task[:clean].enhance do
Dir.chdir(LASEM_DIR) { puts `git clean -fdx`; }
end
desc 'Copy samples to gh-pages'
task :copy_samples do
Dir.mktmpdir do |tmp|
system "cp -r samples #{tmp}"
system 'git checkout gh-pages'
system "cp -r #{tmp}/samples ."
end
end
desc 'Pretty format C code'
task :format do
puts `astyle --indent=spaces=2 --style=1tbs --keep-one-line-blocks \
$(ack -n -f --type=cpp --type=cc ext/mathematical/)`
end
desc 'Run a benchmark'
task :benchmark do
$:.unshift 'lib'
load 'script/benchmark.rb'
end