File: Rakefile

package info (click to toggle)
ruby-hiredis 0.6.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: ruby: 945; ansic: 503; makefile: 7
file content (53 lines) | stat: -rw-r--r-- 1,205 bytes parent folder | download | duplicates (4)
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