guard-sass 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/guard/sass.rb CHANGED
@@ -73,7 +73,8 @@ module Guard
73
73
  options[:load_paths] += load_paths
74
74
  options[:load_paths].flatten!
75
75
 
76
- @runner = Runner.new(watchers, options)
76
+ @formatter = Formatter.new(:hide_success => options[:hide_success])
77
+ @runner = Runner.new(watchers, @formatter, options)
77
78
  super(watchers, options)
78
79
  end
79
80
 
@@ -103,13 +104,22 @@ module Guard
103
104
 
104
105
  # Get owners
105
106
  owners = search_files.select do |file|
106
- # Get dependencies of file
107
- deps = ::Sass::Engine.for_file(file, @options).dependencies.collect! {|dep| dep.options[:filename] }
107
+ deps = []
108
+ begin
109
+ # Get dependencies of file
110
+ deps = ::Sass::Engine.for_file(file, @options).dependencies.collect! {|dep| dep.options[:filename] }
111
+
112
+ rescue ::Sass::SyntaxError => e
113
+ message = "Resolving partial owners of #{file} failed"
114
+ @formatter.error "Sass > #{e.sass_backtrace_str(file)}", :notification => message
115
+ end
116
+
108
117
  # Find intersection with paths
109
118
  deps_in_paths = deps.intersection paths
110
119
  # Any paths in the dependencies?
111
120
  !deps_in_paths.empty?
112
121
  end
122
+
113
123
  # Return our resolved set of paths to recompile
114
124
  owners
115
125
  end
@@ -134,7 +144,7 @@ module Guard
134
144
 
135
145
  changed_files, success = @runner.run(paths)
136
146
  notify changed_files
137
-
147
+
138
148
  throw :task_has_failed unless success
139
149
  end
140
150
 
@@ -9,17 +9,18 @@ module Guard
9
9
  attr_reader :options
10
10
 
11
11
  # @param watchers [Array<Guard::Watcher>]
12
+ # @param formatter [Guard::Sass::Formatter]
12
13
  # @param options [Hash] See Guard::Sass::DEFAULTS for available options
13
- def initialize(watchers, options={})
14
+ def initialize(watchers, formatter, options={})
14
15
  @watchers = watchers
16
+ @formatter = formatter
15
17
  @options = options
16
- @formatter = Formatter.new(:hide_success => options[:hide_success])
17
18
  end
18
19
 
19
20
  # @param files [Array<String>]
20
21
  # @return [Array<Array,Boolean>]
21
22
  def run(files)
22
- changed_files, errors = compile_files(files)
23
+ changed_files, errors = compile_files(files)
23
24
  [changed_files, errors.empty?]
24
25
  end
25
26
 
@@ -81,7 +82,7 @@ module Guard
81
82
  :debug_info => options[:debug_info],
82
83
  :line_numbers => options[:line_numbers]
83
84
  }
84
-
85
+
85
86
  ::Sass::Engine.for_file(file, sass_options).render
86
87
  end
87
88
 
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  class SassVersion
3
- VERSION = '1.0.3'
3
+ VERSION = '1.0.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-18 00:00:00.000000000 Z
12
+ date: 2013-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard