From 5bb7d0d06acb60ea4643db9dde892c50ff9e79bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Immanuel=20H=C3=A4ussermann?= Date: Sat, 13 Aug 2011 16:29:50 +0200 Subject: [PATCH] guard is no longer crashing when haml fails to compile --- changelog.md | 3 +++ lib/guard/haml.rb | 8 ++++++-- lib/guard/haml/version.rb | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 42329d1..4b908a4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # CHANGELOG +## 0.3.1. +* guard-haml is no longer crashing guard when HAML fails to compile + ## 0.3.0 * Added the input option, to exclude a path from the output path. (github.com/draiken) diff --git a/lib/guard/haml.rb b/lib/guard/haml.rb index 8562784..f9b2cfb 100644 --- a/lib/guard/haml.rb +++ b/lib/guard/haml.rb @@ -15,8 +15,12 @@ def initialize(watchers = [], options = {}) def compile_haml file content = File.new(file).read - engine = ::Haml::Engine.new(content, (@options[:haml_options] || {})) - engine.render + begin + engine = ::Haml::Engine.new(content, (@options[:haml_options] || {})) + engine.render + rescue StandardError => error + ::Guard::UI.info "HAML Error: " + error.message + end end # Get the file path to output the html based on the file being diff --git a/lib/guard/haml/version.rb b/lib/guard/haml/version.rb index e0e26eb..8b553bd 100644 --- a/lib/guard/haml/version.rb +++ b/lib/guard/haml/version.rb @@ -1,5 +1,5 @@ module Guard class HamlVersion - VERSION = '0.3.0' + VERSION = '0.3.1' end end \ No newline at end of file