Allow profiling templates from any directory

This commit is contained in:
Norman Clarke 2013-10-14 12:14:33 -03:00
parent a2f616a81d
commit 447813aac5
1 changed files with 3 additions and 3 deletions

View File

@ -81,13 +81,13 @@ Profile Haml.
END
task :profile do
times = (ENV['TIMES'] || '1000').to_i
file = ENV['FILE']
file = ENV['FILE'] || 'test/templates/standard.haml'
require 'bundler/setup'
require 'ruby-prof'
require 'haml'
file = File.read(File.expand_path("../test/templates/#{file || 'standard'}.haml", __FILE__))
default =
file = File.read(File.expand_path("../#{file}", __FILE__))
obj = Object.new
Haml::Engine.new(file, :ugly => true).def_method(obj, :render)
result = RubyProf.profile { times.times { obj.render } }