2011-11-09 13:46:51 -05:00
|
|
|
#!/usr/bin/env rake
|
2012-05-01 14:53:01 -04:00
|
|
|
require 'bundler/setup'
|
2011-11-09 13:46:51 -05:00
|
|
|
require "bundler/gem_tasks"
|
2011-11-10 11:12:41 -05:00
|
|
|
|
|
|
|
task :clean do
|
2012-05-01 14:53:01 -04:00
|
|
|
sh "rm -rf lib/v8/init.bundle lib/v8/init.so"
|
2011-11-10 11:12:41 -05:00
|
|
|
sh "rm -rf pkg"
|
|
|
|
end
|
|
|
|
|
2012-01-31 16:52:08 -05:00
|
|
|
require "rake/extensiontask"
|
2012-05-01 14:53:01 -04:00
|
|
|
Rake::ExtensionTask.new("init", eval(File.read("therubyracer.gemspec"))) do |ext|
|
2012-01-31 16:52:08 -05:00
|
|
|
ext.ext_dir = "ext/v8"
|
2011-11-10 11:12:41 -05:00
|
|
|
ext.lib_dir = "lib/v8"
|
|
|
|
ext.source_pattern = "*.{cc,h}"
|
|
|
|
end
|
|
|
|
|
2012-01-31 16:52:08 -05:00
|
|
|
require 'rspec/core/rake_task'
|
2012-06-15 11:22:51 -04:00
|
|
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
2012-06-19 08:01:42 -04:00
|
|
|
task.rspec_opts = '--tag ~memory --tag ~threads'
|
2012-06-15 11:22:51 -04:00
|
|
|
end
|
2011-11-10 11:12:41 -05:00
|
|
|
|
2012-01-31 16:52:08 -05:00
|
|
|
task :sanity => [:clean, :compile] do
|
|
|
|
sh %q{ruby -Ilib -e "require 'v8'"}
|
|
|
|
end
|
2011-11-10 11:12:41 -05:00
|
|
|
|
2012-06-14 05:42:43 -04:00
|
|
|
NativeGem = "pkg/therubyracer-#{V8::VERSION}-#{Gem::Platform.new(RUBY_PLATFORM)}.gem"
|
|
|
|
file NativeGem => :build do
|
2012-06-14 05:20:28 -04:00
|
|
|
require "rubygems/compiler"
|
2012-06-14 05:42:43 -04:00
|
|
|
compiler = Gem::Compiler.new("pkg/therubyracer-#{V8::VERSION}.gem", 'pkg')
|
2012-06-14 05:20:28 -04:00
|
|
|
compiler.compile
|
|
|
|
end
|
|
|
|
|
2012-06-14 05:42:43 -04:00
|
|
|
desc "Build #{NativeGem} into the pkg directory"
|
|
|
|
task "build:native" => NativeGem
|
|
|
|
|
|
|
|
desc "Build and install #{File.basename NativeGem} into system gems"
|
|
|
|
task "install:native" => "build:native" do
|
|
|
|
sh "gem install #{NativeGem}"
|
|
|
|
end
|
|
|
|
|
2012-01-31 16:52:08 -05:00
|
|
|
task :default => :spec
|
2011-11-10 11:12:41 -05:00
|
|
|
|