From c8e07b42282ef6dd0a213542eda100ba0d1ac935 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 24 Jan 2009 14:35:17 -0800 Subject: [PATCH] Make the compass watch command a little more understandable for first time users and handle Interrupt more gracefully. --- lib/compass/commands/watch_project.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/compass/commands/watch_project.rb b/lib/compass/commands/watch_project.rb index bd45f990..a787a808 100644 --- a/lib/compass/commands/watch_project.rb +++ b/lib/compass/commands/watch_project.rb @@ -10,15 +10,22 @@ module Compass class WatchProject < UpdateProject attr_accessor :last_update_time def perform + puts ">>> Compiling all stylesheets." super self.last_update_time = most_recent_update_time + puts ">>> Compass is now watching for changes. Press Ctrl-C to Stop." loop do # TODO: Make this efficient by using filesystem monitoring. - sleep 1 + begin + sleep 1 + rescue Interrupt + puts "" + exit 0 + end file, t = should_update? if t begin - puts ">>> Change detected to #{file} <<<" + puts ">>> Change detected to: #{file}" super rescue StandardError => e ::Compass::Exec.report_error(e, options)