#!/usr/bin/env bash
export BENCHMARK=1
TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site'})"
RUBY=$(cat <<RUBY
require 'ruby-prof'
result = RubyProf.profile{ ${TEST_SCRIPT} }
printer = RubyProf::CallTreePrinter.new(result)
filename = "tmp/ruby_prof_#{rand 10000}"
puts "Writing profile to #{filename}"
file = File.open(filename, "w")
printer.print(file, {})
file.close
RUBY
)
bundle exec ruby -r ./lib/jekyll -e "${RUBY}"