Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

74 lines (62 sloc) 1.996 kB
# encoding: utf-8
require 'bundler'
Bundler::GemHelper.install_tasks
require 'rake/clean'
CLEAN.include "**/*.rbc", ".rbx"
desc "Regenerate Noscript's lexer and parser."
task :regenerate do
has_rex = `which rex`
has_racc = `which racc`
if has_rex && has_racc
`rex lib/noscript/parser/noscript.rex -o lib/noscript/parser/lexer.rb`
`racc lib/noscript/parser/noscript.y -o lib/noscript/parser/parser.rb`
else
puts "You need both Rexical and Racc to do that. Install them by doing:"
puts
puts "\t\tgem install rexical"
puts "\t\tgem install racc"
puts
puts "Or just type `bundle install`."
end
end
desc "regenerates lib/noscript/bootstrap/signature.rb"
task :signature do
require 'digest/sha1'
digest = Digest::SHA1.new
files = Dir.glob('lib/noscript/{bootstrap,compiler}.rb')
files.each do |name|
File.open name, "r" do |file|
while chunk = file.read(1024)
digest << chunk
end
end
end
# Collapse the digest to a 64bit quantity
hd = digest.hexdigest
signature_hash = hd[0, 16].to_i(16) ^ hd[16,16].to_i(16) ^ hd[32,8].to_i(16)
File.open "lib/noscript/signature.rb", "wb" do |file|
file.puts "# This file is generated by `rake signature`. The signature"
file.puts "# is used to ensure that only current compiled files are loaded."
file.puts "Noscript::Signature = Rubinius::Signature ^ #{signature_hash}"
end
end
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/**/*_test.rb'] - FileList['test/integration_test.rb']
t.verbose = true
end
require 'rake/testtask'
Rake::TestTask.new(:integration) do |t|
t.libs << "test"
t.test_files = FileList['test/integration_test.rb']
t.verbose = true
end
desc 'Run Noscript native tests'
task :native do
tests = FileList['test/kernel/*.ns']
tests.each do |test|
system("./bin/noscript #{test}")
end
end
task :default => [:regenerate, :test, :integration] #, :integration, :native]
Jump to Line
Something went wrong with that request. Please try again.