mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Clean up the Rakefile.
This commit is contained in:
parent
2a25c878e8
commit
c8f67659bb
1 changed files with 12 additions and 25 deletions
27
Rakefile
27
Rakefile
|
@ -1,31 +1,18 @@
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'rake'
|
require 'rake'
|
||||||
|
|
||||||
volatile_requires = ['rcov/rcovtask']
|
|
||||||
not_loaded = []
|
|
||||||
volatile_requires.each do |file|
|
|
||||||
begin
|
|
||||||
require file
|
|
||||||
rescue LoadError
|
|
||||||
not_loaded.push file
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# ----- Benchmarking -----
|
# ----- Benchmarking -----
|
||||||
|
|
||||||
temp_desc = <<END
|
desc <<END
|
||||||
Benchmark haml against ERb.
|
Benchmark haml against ERb.
|
||||||
TIMES=n sets the number of runs. Defaults to 100.
|
TIMES=n sets the number of runs. Defaults to 1000.
|
||||||
END
|
END
|
||||||
|
|
||||||
desc temp_desc.chomp
|
|
||||||
task :benchmark do
|
task :benchmark do
|
||||||
sh "ruby test/benchmark.rb #{ENV['TIMES']}"
|
sh "ruby test/benchmark.rb #{ENV['TIMES']}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# ----- Default: Testing ------
|
# ----- Default: Testing ------
|
||||||
|
|
||||||
desc 'Default: run unit tests.'
|
|
||||||
task :default => :test
|
task :default => :test
|
||||||
|
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
|
@ -53,7 +40,6 @@ Rake::GemPackageTask.new(HAML_GEMSPEC) do |pkg|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "This is an internal task."
|
|
||||||
task :revision_file do
|
task :revision_file do
|
||||||
if Haml.version[:rev] && !Rake.application.top_level_tasks.include?('release')
|
if Haml.version[:rev] && !Rake.application.top_level_tasks.include?('release')
|
||||||
File.open('REVISION', 'w') { |f| f.puts Haml.version[:rev] }
|
File.open('REVISION', 'w') { |f| f.puts Haml.version[:rev] }
|
||||||
|
@ -108,7 +94,9 @@ end
|
||||||
|
|
||||||
# ----- Coverage -----
|
# ----- Coverage -----
|
||||||
|
|
||||||
unless not_loaded.include? 'rcov/rcovtask'
|
begin
|
||||||
|
require 'rcov/rcovtask'
|
||||||
|
|
||||||
Rcov::RcovTask.new do |t|
|
Rcov::RcovTask.new do |t|
|
||||||
t.test_files = FileList['test/**/*_test.rb']
|
t.test_files = FileList['test/**/*_test.rb']
|
||||||
t.rcov_opts << '-x' << '"^\/"'
|
t.rcov_opts << '-x' << '"^\/"'
|
||||||
|
@ -117,17 +105,16 @@ unless not_loaded.include? 'rcov/rcovtask'
|
||||||
end
|
end
|
||||||
t.verbose = true
|
t.verbose = true
|
||||||
end
|
end
|
||||||
end
|
rescue LoadError; end
|
||||||
|
|
||||||
# ----- Profiling -----
|
# ----- Profiling -----
|
||||||
|
|
||||||
temp_desc = <<-END
|
desc <<END
|
||||||
Run a profile of haml.
|
Run a profile of haml.
|
||||||
ENGINE=str sets the engine to be profiled (Haml or Sass).
|
ENGINE=str sets the engine to be profiled (Haml or Sass).
|
||||||
TIMES=n sets the number of runs. Defaults to 100.
|
TIMES=n sets the number of runs. Defaults to 100.
|
||||||
FILE=n sets the file to profile. Defaults to 'standard'.
|
FILE=n sets the file to profile. Defaults to 'standard'.
|
||||||
END
|
END
|
||||||
desc temp_desc.chomp
|
|
||||||
task :profile do
|
task :profile do
|
||||||
require 'test/profile'
|
require 'test/profile'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue