forked from redis/hiredis-rb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
53 lines (40 loc) · 1.18 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 "bundler"
Bundler::GemHelper.install_tasks
require "rbconfig"
require "rake/testtask"
require "rake/extensiontask"
if RUBY_PLATFORM =~ /java|mswin|mingw/i
task :rebuild do
# no-op
end
else
Rake::ExtensionTask.new('hiredis_ext') do |task|
# Pass --with-foo-config args to extconf.rb
task.config_options = ARGV[1..-1] || []
task.lib_dir = File.join(*['lib', 'hiredis', 'ext'])
end
namespace :hiredis do
task :clean do
# Fetch hiredis if not present
if !File.directory?("vendor/hiredis/.git")
system("git submodule update --init")
end
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
make_program = $1 || ENV['make']
unless make_program then
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
end
system("cd vendor/hiredis && #{make_program} clean")
end
end
# "rake clean" should also clean bundled hiredis
Rake::Task[:clean].enhance(['hiredis:clean'])
# Build from scratch
task :rebuild => [:clean, :compile]
end
task :default => [:rebuild, :test]
desc "Run tests"
Rake::TestTask.new(:test) do |t|
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end