2015-12-23 09:04:56 -05:00
|
|
|
require 'bundler/setup'
|
2015-10-06 11:18:41 -04:00
|
|
|
require 'bundler/gem_tasks'
|
2016-02-06 01:22:21 -05:00
|
|
|
|
|
|
|
#
|
|
|
|
# Prepend DevKit into compilation phase
|
|
|
|
#
|
|
|
|
if Gem.win_platform?
|
|
|
|
desc 'Activates DevKit'
|
|
|
|
task :devkit do
|
|
|
|
begin
|
|
|
|
require 'devkit'
|
|
|
|
rescue LoadError
|
|
|
|
abort 'Failed to load DevKit required for compilation'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
task compile: :devkit
|
|
|
|
end
|
|
|
|
|
2015-10-06 11:18:41 -04:00
|
|
|
require 'rake/testtask'
|
2015-11-25 11:07:06 -05:00
|
|
|
require 'rake/extensiontask'
|
2015-10-06 11:18:41 -04:00
|
|
|
|
2015-10-11 04:58:11 -04:00
|
|
|
Dir['benchmark/*.rake'].each { |b| import(b) }
|
|
|
|
|
2015-10-24 07:44:18 -04:00
|
|
|
namespace :haml do
|
|
|
|
Rake::TestTask.new do |t|
|
|
|
|
t.libs << 'lib' << 'test'
|
|
|
|
files = Dir['test/haml/*_test.rb']
|
|
|
|
files << 'test/haml/haml-spec/*_test.rb'
|
|
|
|
t.ruby_opts = %w[-rtest_helper]
|
|
|
|
t.test_files = files
|
|
|
|
t.verbose = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
namespace :hamlit do
|
|
|
|
Rake::TestTask.new do |t|
|
|
|
|
t.libs << 'lib' << 'test'
|
|
|
|
t.ruby_opts = %w[-rtest_helper]
|
|
|
|
t.test_files = Dir['test/hamlit/**/*_test.rb']
|
|
|
|
t.verbose = true
|
|
|
|
end
|
2015-10-06 11:18:41 -04:00
|
|
|
end
|
2015-10-13 09:02:16 -04:00
|
|
|
|
2015-11-25 11:02:11 -05:00
|
|
|
namespace :test do
|
|
|
|
Rake::TestTask.new(:all) do |t|
|
|
|
|
t.libs << 'lib' << 'test'
|
|
|
|
files = Dir['test/hamlit/**/*_test.rb']
|
|
|
|
files += Dir['test/haml/*_test.rb']
|
|
|
|
files << 'test/haml/haml-spec/*_test.rb'
|
|
|
|
t.ruby_opts = %w[-rtest_helper]
|
|
|
|
t.test_files = files
|
|
|
|
t.verbose = true
|
|
|
|
end
|
2015-10-24 08:18:48 -04:00
|
|
|
|
2015-11-25 11:02:11 -05:00
|
|
|
Rake::TestTask.new(:spec) do |t|
|
|
|
|
t.libs << 'lib' << 'test'
|
|
|
|
t.ruby_opts = %w[-rtest_helper]
|
|
|
|
t.test_files = %w[test/haml/haml-spec/ugly_test.rb test/haml/haml-spec/pretty_test.rb]
|
|
|
|
t.verbose = true
|
|
|
|
end
|
2015-10-15 11:22:23 -04:00
|
|
|
|
|
|
|
Rake::TestTask.new(:engine) do |t|
|
|
|
|
t.libs << 'lib' << 'test'
|
|
|
|
t.ruby_opts = %w[-rtest_helper]
|
2015-10-24 07:29:50 -04:00
|
|
|
t.test_files = %w[test/haml/engine_test.rb]
|
2015-10-15 11:22:23 -04:00
|
|
|
t.verbose = true
|
|
|
|
end
|
|
|
|
|
|
|
|
Rake::TestTask.new(:filters) do |t|
|
|
|
|
t.libs << 'lib' << 'test'
|
|
|
|
t.ruby_opts = %w[-rtest_helper]
|
2015-10-24 07:29:50 -04:00
|
|
|
t.test_files = %w[test/haml/filters_test.rb]
|
2015-10-15 11:22:23 -04:00
|
|
|
t.verbose = true
|
|
|
|
end
|
|
|
|
|
|
|
|
Rake::TestTask.new(:helper) do |t|
|
|
|
|
t.libs << 'lib' << 'test'
|
|
|
|
t.ruby_opts = %w[-rtest_helper]
|
2015-10-24 07:29:50 -04:00
|
|
|
t.test_files = %w[test/haml/helper_test.rb]
|
2015-10-15 11:22:23 -04:00
|
|
|
t.verbose = true
|
|
|
|
end
|
|
|
|
|
|
|
|
Rake::TestTask.new(:template) do |t|
|
|
|
|
t.libs << 'lib' << 'test'
|
|
|
|
t.ruby_opts = %w[-rtest_helper]
|
2015-10-24 07:29:50 -04:00
|
|
|
t.test_files = %w[test/haml/template_test.rb]
|
2015-10-15 11:22:23 -04:00
|
|
|
t.verbose = true
|
|
|
|
end
|
|
|
|
end
|
2015-11-25 11:02:11 -05:00
|
|
|
|
2015-11-25 11:07:06 -05:00
|
|
|
Rake::ExtensionTask.new(:hamlit) do |ext|
|
|
|
|
ext.lib_dir = 'lib/hamlit'
|
|
|
|
end
|
|
|
|
|
2015-11-30 06:40:23 -05:00
|
|
|
desc 'bench task for CI'
|
|
|
|
task bench: :compile do
|
|
|
|
if ENV['SLIM_BENCH'] == '1'
|
|
|
|
cmd = %w[bundle exec ruby benchmark/slim/run-benchmarks.rb]
|
|
|
|
else
|
|
|
|
cmd = ['bin/bench', 'bench', ('-c' if ENV['COMPILE'] == '1'), *ENV['TEMPLATE'].split(',')].compact
|
|
|
|
end
|
|
|
|
exit system(*cmd)
|
|
|
|
end
|
|
|
|
|
2015-11-25 11:07:06 -05:00
|
|
|
task default: %w[compile hamlit:test]
|
|
|
|
task test: %w[compile test:all]
|