Add a --profile option to the compass CLI
This commit is contained in:
parent
b313ac794e
commit
dd2c9eb72d
1
Gemfile
1
Gemfile
@ -11,3 +11,4 @@ gem "rcov"
|
|||||||
gem "rubyzip"
|
gem "rubyzip"
|
||||||
gem "livereload"
|
gem "livereload"
|
||||||
gem "chunky_png"
|
gem "chunky_png"
|
||||||
|
gem "ruby-prof"
|
||||||
|
19
bin/compass
19
bin/compass
@ -21,6 +21,21 @@ fallback_load_path(File.join(File.dirname(__FILE__), '..', 'lib')) do
|
|||||||
require 'compass/exec'
|
require 'compass/exec'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
runner = Proc.new do
|
||||||
command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(ARGV)
|
command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(ARGV)
|
||||||
exit command_line_class.new(ARGV).run!
|
command_line_class.new(ARGV).run!
|
||||||
|
end
|
||||||
|
|
||||||
|
if ARGV.delete("--profile")
|
||||||
|
require 'ruby-prof'
|
||||||
|
RubyProf.start
|
||||||
|
exit_code = runner.call
|
||||||
|
result = RubyProf.stop
|
||||||
|
|
||||||
|
# Print a flat profile to text
|
||||||
|
printer = RubyProf::FlatPrinter.new(result)
|
||||||
|
printer.print(STDERR, 0)
|
||||||
|
exit exit_code
|
||||||
|
else
|
||||||
|
exit runner.call
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user