Add a --profile option to the compass CLI
This commit is contained in:
parent
d0f33a74b9
commit
87b624a56e
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.new(ARGV).run!
|
||||||
|
end
|
||||||
|
|
||||||
command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(ARGV)
|
if ARGV.delete("--profile")
|
||||||
exit command_line_class.new(ARGV).run!
|
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