-
Notifications
You must be signed in to change notification settings - Fork 14
/
Rakefile
95 lines (83 loc) · 2.81 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Copyright 2008 David Vollbracht & Philippe Hanrigou
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'rake/clean'
require 'rubygems'
CLEAN.include '**/*.o'
CLEAN.include '**/*.so'
CLEAN.include '**/*.bundle'
CLOBBER.include '**/*.log'
CLOBBER.include '**/Makefile'
CLOBBER.include '**/extconf.h'
CLOBBER.include 'pkk/*'
SYSTEM_TIMER_VERSION = "1.2.4"
SYSTEM_TIMER_GEM_NAME = "system_timer"
desc 'Default: run unit tests.'
task :default => :test
desc 'Install the gem into the local gem repository'
task :install => 'package' do
sh "gem install ./pkg/#{SYSTEM_TIMER_GEM_NAME}-#{SYSTEM_TIMER_VERSION}.gem"
end
desc 'Test SystemTimer'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
task :test => 'ext/system_timer/libsystem_timer_native.so'
desc 'Generate documentation for System Timer.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'System Timer'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
file 'ext/system_timer/Makefile' => 'ext/system_timer/extconf.rb' do
Dir.chdir('ext/system_timer') do
ruby 'extconf.rb'
end
end
file 'ext/system_timer/libsystem_timer_native.so' => 'ext/system_timer/Makefile' do
Dir.chdir('ext/system_timer') do
pid = fork { exec "make" }
Process.waitpid pid
end
fail "Make failed (status #{m})" unless $?.exitstatus == 0
end
specification = Gem::Specification.new do |s|
s.name = SYSTEM_TIMER_GEM_NAME
s.summary = "Set a Timeout based on signals, which are more reliable than Timeout. Timeout is based on green threads."
s.version = SYSTEM_TIMER_VERSION
s.authors = ["Philippe Hanrigou", "David Vollbracht"]
if ENV['PACKAGE_FOR_WIN32'] || PLATFORM['win32']
s.platform = Gem::Platform.new "mswin32"
s.files = FileList['lib/system_timer_stub.rb']
s.autorequire = "system_timer_stub"
else
s.platform = Gem::Platform::RUBY
s.files = [ "COPYING", "LICENSE", "ChangeLog"] +
FileList['ext/**/*.c'] +
FileList['ext/**/*.rb'] +
FileList['lib/**/*.rb'] +
FileList['test/**/*.rb']
s.autorequire = "system_timer"
s.extensions = ["ext/system_timer/extconf.rb"]
end
s.require_path = "lib"
s.rdoc_options << '--title' << 'System Timer' << '--main' << 'README' << '--line-numbers'
s.has_rdoc = true
s.extra_rdoc_files = ['README']
s.test_file = "test/all_tests.rb"
s.rubyforge_project = "systemtimer"
end
Rake::GemPackageTask.new(specification) do |package|
package.need_zip = false
package.need_tar = false
end
desc "Publish RDoc on Rubyforge website"
task :publish_rdoc => :rdoc do
sh "scp -r rdoc/* #{ENV['USER']}@rubyforge.org:/var/www/gforge-projects/systemtimer"
end