/
githubmirror
/
jekyll
Обзор
Документация
Войти
/
githubmirror
/
jekyll
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4.3.4
script/rubyprof
23 строки
649 B
ashmaroli
Rewrite `script/rubyprof` as a Ruby script (#6813)
01 мар 2018, 12:57
01 мар 2018, 12:57
4032c3e
Код
Авторство
О чём код?
#!/usr/bin/env ruby require "ruby-prof" require File.expand_path("../lib/jekyll", __dir__) result = RubyProf.profile do Jekyll::Commands::Build.process({ "source" => File.expand_path("../docs", __dir__), "destination" => File.expand_path("../docs/_site", __dir__), }) end puts "\nProcessing result.." dir_path = File.expand_path("../tmp", __dir__) file_path = File.join(dir_path, "rubyprof-#{Time.now.strftime('%Y%m%d%H%M%S')}") FileUtils.mkdir_p(dir_path) unless Dir.exist?(dir_path) File.open(file_path, "wb") do |file| RubyProf::FlatPrinter.new(result).print(file) end puts "Profile result printed to #{file_path.cyan}"