-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
79 lines (61 loc) · 1.65 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
require 'rake/clean'
require 'rdoc/task'
require 'rubygems/package_task'
PKG_NAME = "gumbo"
PKG_VERSION = "1.0.0"
EXT_CONF = "ext/extconf.rb"
MAKEFILE = "ext/Makefile"
MODULE = "ext/gumbo.so"
SRC = Dir.glob("ext/*.c") << MAKEFILE
CLEAN.include [MODULE, "ext/*.o"]
CLOBBER.include ["ext/mkmf.log", "ext/extconf.h", MAKEFILE]
# Build
file MAKEFILE => EXT_CONF do |t|
Dir::chdir(File::dirname(EXT_CONF)) do
unless sh "ruby #{File::basename(EXT_CONF)}"
$stderr.puts "extconf.rb failed"
break
end
end
end
file MODULE => SRC do |t|
Dir::chdir(File::dirname(EXT_CONF)) do
unless sh "make"
$stderr.puts "make failed"
break
end
end
end
desc "Build the native library"
task :build => MODULE
# Documentation
RDOC_FILES = FileList["ext/gumbo.c"]
Rake::RDocTask.new do |task|
#task.main = "README.rdoc"
task.rdoc_dir = "doc/api"
task.rdoc_files.include(RDOC_FILES)
end
Rake::RDocTask.new(:ri) do |task|
#task.main = "README.rdoc"
task.rdoc_dir = "doc/ri"
task.options << "--ri-system"
task.rdoc_files.include(RDOC_FILES)
end
# Packaging
PKG_FILES = FileList["Rakefile", "LICENSE", "README.mkd",
"lib/**/*.rb",
"ext/extconf.rb", "ext/*.[hc]"]
SPEC = Gem::Specification.new do |spec|
spec.name = PKG_NAME
spec.version = PKG_VERSION
spec.summary = "Ruby bindings for the gumbo html5 parser"
spec.author = "Nicolas Martyanoff"
spec.email = "khaelin@gmail.com"
spec.license = "ISC"
spec.files = PKG_FILES
spec.extensions = "ext/extconf.rb"
spec.required_ruby_version = ">= 1.9.3"
end
Gem::PackageTask.new(SPEC) do |pkg|
pkg.need_tar = true
end