-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
68 lines (56 loc) · 1.51 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
56
57
58
59
60
61
62
63
64
65
66
67
68
require "bundler/gem_tasks"
require 'rake'
require 'rake/clean'
require 'rbconfig'
require 'rake/testtask'
require 'rake/extensiontask'
require 'rubygems/package_task'
require File.expand_path('../lib/acpc_dealer/version', __FILE__)
task :default => :test
desc 'Compile hand_evaluator and dealer'
task :compile => ['compile:hand_evaluator', 'compile:dealer']
desc 'Run tests'
task :test => :compile
task :build => :clean
desc 'Remove compiled products'
task :clean => ['clean:hand_evaluator', 'clean:dealer']
Rake::TestTask.new do |t|
t.libs << "lib" << 'spec/support'
t.test_files = FileList['spec/**/*_spec.rb']
t.verbose = false
t.warning = false
end
def gemspec
@clean_gemspec ||= eval(File.read(File.expand_path('../acpc_dealer.gemspec', __FILE__)))
end
Gem::PackageTask.new(gemspec)
Rake::ExtensionTask.new('hand_evaluator', gemspec)
namespace :compile do
desc 'Compile ACPC dealer'
task :dealer do
Dir.chdir(File.expand_path('../vendor/project_acpc_server', __FILE__)) do
sh "make"
end
end
end
namespace :clean do
desc 'Clean hand_evaluator'
task :hand_evaluator do
Dir.chdir(File.expand_path('../ext/hand_evaluator', __FILE__)) do
begin
sh 'make clean'
rescue
end
end
sh "rm -f #{File.expand_path('../lib/hand_evaluator.so', __FILE__)}"
end
desc 'Clean ACPC dealer'
task :dealer do
begin
Dir.chdir(File.expand_path('../vendor/project_acpc_server', __FILE__)) do
sh "make clean"
end
rescue Errno::ENOENT
end
end
end