forked from redis/hiredis-rb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
46 lines (35 loc) · 1.04 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
require "bundler"
Bundler::GemHelper.install_tasks
require "rake/testtask"
require "rake/extensiontask"
unless defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
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
make_cmd = Config::CONFIG['host_os'].downcase =~ /bsd|solaris/ ? "gmake" : "make"
system("cd vendor/hiredis && #{make_cmd} clean")
end
end
# "rake clean" should also clean bundled hiredis
Rake::Task[:clean].enhance(['hiredis:clean'])
# Build from scratch
task :rebuild => [:clean, :compile]
else
task :rebuild do
# no-op
end
end
task :default => [:rebuild, :test]
desc "Run tests"
Rake::TestTask.new(:test) do |t|
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end