-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRakefile
62 lines (54 loc) · 1.27 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
# -*- ruby -*-
begin
require 'isolate/now'
rescue LoadError
STDERR.puts "Run `gem install isolate` to install 'isolate'."
end
begin
require 'rake/extensiontask'
Rake::ExtensionTask.new("v8") do |ext|
ext.lib_dir = 'lib/mustang'
ext.source_pattern = "*.{cpp,h}"
end
rescue LoadError
STDERR.puts "Run `gem install rake-compiler` to install 'rake-compiler'."
end
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = ENV['RSPEC_OPTS']
end
rescue LoadError
task :spec do
abort 'Run `gem install rspec` to install RSpec'
end
end
task :test => [:clean, :compile, :spec]
task :default => :test
begin
require 'metric_fu'
rescue LoadError
end
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "Mustang - V8 for ruby"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
desc "Opens console with loaded mustang env."
task :console do
require 'mustang'
require 'irb'
ARGV.clear
IRB.start
end
desc "Runs V8 benchmark suite."
task :benchmark do
require 'mustang'
Dir.chdir(File.expand_path("../vendor/v8/benchmarks", __FILE__))
cxt = Mustang::Context.new
cxt[:print] = method(:puts)
cxt[:load] = cxt.method(:load)
cxt.load("run.js")
end