1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/Rakefile

83 lines
1.8 KiB
Text
Raw Normal View History

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'
if /java/ === RUBY_PLATFORM
# require 'rake/javaextensiontask'
2021-06-08 00:28:09 -04:00
# Rake::JavaExtensionTask.new(:haml) do |ext|
# ext.ext_dir = 'ext/java'
2021-06-08 00:28:09 -04:00
# ext.lib_dir = 'lib/haml'
# end
task :compile do
# dummy for now
end
else
require 'rake/extensiontask'
2021-06-08 00:28:09 -04:00
Rake::ExtensionTask.new(:haml) do |ext|
ext.lib_dir = 'lib/haml'
end
end
2015-10-06 11:18:41 -04:00
2015-10-11 04:58:11 -04:00
Dir['benchmark/*.rake'].each { |b| import(b) }
2022-10-02 13:20:54 -04:00
Rake::TestTask.new do |t|
t.libs << 'lib' << 'test'
files = Dir['test/haml/**/*_test.rb']
t.ruby_opts = %w[-rtest_helper]
t.test_files = files
t.verbose = true
2015-10-15 11:22:23 -04:00
end
2022-10-02 13:48:14 -04:00
task test: :compile
2015-11-25 11:02:11 -05:00
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
namespace :doc do
task :sass do
require 'sass'
Dir["yard/default/**/*.sass"].each do |sass|
File.open(sass.gsub(/sass$/, 'css'), 'w') do |f|
f.write(Sass::Engine.new(File.read(sass)).render)
end
end
end
desc "List all undocumented methods and classes."
task :undocumented do
command = 'yard --list --query '
command << '"object.docstring.blank? && '
command << '!(object.type == :method && object.is_alias?)"'
sh command
end
end
desc "Generate documentation"
task(:doc => 'doc:sass') {sh "yard"}
desc "Generate documentation incrementally"
task(:redoc) {sh "yard -c"}
2022-10-02 13:20:54 -04:00
task default: %w[compile test]