Make the compass watch command a little more understandable for first time users and handle Interrupt more gracefully.

This commit is contained in:
Chris Eppstein 2009-01-24 14:35:17 -08:00
parent 8fc0c48dd5
commit c8e07b4228

View File

@ -10,15 +10,22 @@ module Compass
class WatchProject < UpdateProject class WatchProject < UpdateProject
attr_accessor :last_update_time attr_accessor :last_update_time
def perform def perform
puts ">>> Compiling all stylesheets."
super super
self.last_update_time = most_recent_update_time self.last_update_time = most_recent_update_time
puts ">>> Compass is now watching for changes. Press Ctrl-C to Stop."
loop do loop do
# TODO: Make this efficient by using filesystem monitoring. # TODO: Make this efficient by using filesystem monitoring.
sleep 1 begin
sleep 1
rescue Interrupt
puts ""
exit 0
end
file, t = should_update? file, t = should_update?
if t if t
begin begin
puts ">>> Change detected to #{file} <<<" puts ">>> Change detected to: #{file}"
super super
rescue StandardError => e rescue StandardError => e
::Compass::Exec.report_error(e, options) ::Compass::Exec.report_error(e, options)