2008-08-23 17:00:46 +00:00
|
|
|
#!/usr/bin/env ruby
|
2010-11-14 18:59:49 +00:00
|
|
|
# The compass command line utility
|
2008-08-23 17:00:46 +00:00
|
|
|
|
2010-11-14 18:59:49 +00:00
|
|
|
# This allows compass to run easily from a git checkout without install.
|
|
|
|
def fallback_load_path(path)
|
|
|
|
retried = false
|
|
|
|
begin
|
|
|
|
yield
|
|
|
|
rescue LoadError
|
|
|
|
unless retried
|
|
|
|
$: << path
|
|
|
|
retried = true
|
|
|
|
retry
|
|
|
|
end
|
|
|
|
raise
|
|
|
|
end
|
|
|
|
end
|
2008-08-23 17:00:46 +00:00
|
|
|
|
2010-11-14 18:59:49 +00:00
|
|
|
fallback_load_path(File.join(File.dirname(__FILE__), '..', 'lib')) do
|
|
|
|
require 'compass'
|
|
|
|
require 'compass/exec'
|
|
|
|
end
|
2009-09-30 01:35:24 +00:00
|
|
|
|
2010-09-12 21:11:05 +00:00
|
|
|
runner = Proc.new do
|
2010-12-10 17:34:36 +00:00
|
|
|
Compass::Exec::SubCommandUI.new(ARGV).run!
|
2010-09-12 21:11:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
if ARGV.delete("--profile")
|
|
|
|
require 'ruby-prof'
|
|
|
|
RubyProf.start
|
|
|
|
exit_code = runner.call
|
|
|
|
result = RubyProf.stop
|
2010-11-14 18:59:49 +00:00
|
|
|
|
2010-09-12 21:11:05 +00:00
|
|
|
# Print a flat profile to text
|
|
|
|
printer = RubyProf::FlatPrinter.new(result)
|
|
|
|
printer.print(STDERR, 0)
|
|
|
|
exit exit_code
|
|
|
|
else
|
2011-11-07 02:02:41 +00:00
|
|
|
exit runner.call || 1
|
2010-09-12 21:11:05 +00:00
|
|
|
end
|