Commit b2b98b06 authored by Eloy Durán's avatar Eloy Durán

Use the `PROFILE=filename` env var to profile work.

Currently supported printer types are:
* `filename.html`: GraphHtmlPrinter
* `filename.txt`: GraphPrinter

For more printers see
https://github.com/ruby-prof/ruby-prof/blob/master/README.rdoc#printers.
parent dda5160e
...@@ -44,6 +44,7 @@ group :debugging do ...@@ -44,6 +44,7 @@ group :debugging do
gem 'kicker' gem 'kicker'
gem 'awesome_print' gem 'awesome_print'
gem 'pry' gem 'pry'
gem 'ruby-prof'
end end
group :ruby_1_8_7 do group :ruby_1_8_7 do
......
...@@ -143,6 +143,7 @@ GEM ...@@ -143,6 +143,7 @@ GEM
powerpack (~> 0.0.6) powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
ruby-prof (0.13.0)
ruby-progressbar (1.6.0) ruby-progressbar (1.6.0)
safe_yaml (1.0.4) safe_yaml (1.0.4)
slop (3.6.0) slop (3.6.0)
...@@ -178,5 +179,6 @@ DEPENDENCIES ...@@ -178,5 +179,6 @@ DEPENDENCIES
rake rake
rb-fsevent rb-fsevent
rubocop rubocop
ruby-prof
webmock webmock
xcodeproj! xcodeproj!
...@@ -30,4 +30,20 @@ end ...@@ -30,4 +30,20 @@ end
STDOUT.sync = true if ENV['CP_STDOUT_SYNC'] == 'TRUE' STDOUT.sync = true if ENV['CP_STDOUT_SYNC'] == 'TRUE'
require 'cocoapods' require 'cocoapods'
Pod::Command.run(ARGV)
if profile_filename = ENV['PROFILE']
require 'ruby-prof'
reporter = case (profile_extname = File.extname(profile_filename))
when '.txt'
RubyProf::GraphPrinter
when '.html'
RubyProf::GraphHtmlPrinter
else
raise "Unknown profiler format indicated by extension: #{profile_extname}"
end
File.open(profile_filename, 'w') do |io|
reporter.new(RubyProf.profile { Pod::Command.run(ARGV) }).print(io)
end
else
Pod::Command.run(ARGV)
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment