This repository has been archived by the owner on Aug 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 114
/
Rakefile
47 lines (38 loc) · 1.08 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
require 'rubygems/package_task'
require 'rake/clean'
require 'rake/extensiontask'
require 'rake/testtask'
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'nokogumbo/version'
# default to running tests
task default: :test
task test: :compile
task gem: :test
ext = Rake::ExtensionTask.new 'nokogumbo' do |e|
e.lib_dir = 'lib/nokogumbo'
e.source_pattern = '{,../../gumbo-parser/src/}*.[hc]'
end
Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.pattern = 'test/test_*.rb'
end
desc 'Run the gumbo unit tests'
task 'test:gumbo' => 'gumbo-parser/googletest' do
sh('make', '-j2', '-C', 'gumbo-parser')
end
desc 'Start a console'
task console: :compile do
sh('irb', '-Ilib', '-rnokogumbo')
end
Gem::PackageTask.new(Gem::Specification.load('nokogumbo.gemspec')) do |pkg|
pkg.need_tar = true
pkg.need_zip = true
end
# cleanup
CLEAN.include(File.join('lib/nokogumbo', ext.binary))
CLOBBER.include(FileList.new('pkg', 'Gemfile.lock'))
# silence cleanup operations
Rake::Task[:clobber_package].clear
CLEAN.existing!
CLOBBER.existing!.uniq!