Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

controller.rb : prevent re-parsing the script when only its access ti…

…me changes.
  • Loading branch information...
commit ec6cdb9928467cf67c18bc1a9e1bb327b551df9b 1 parent 17fa9bf
jperret authored
Showing with 9 additions and 1 deletion.
  1. +1 −1  lib/watchr/controller.rb
  2. +8 −0 test/test_controller.rb
2  lib/watchr/controller.rb
View
@@ -59,7 +59,7 @@ def update(path, event_type = nil)
path = Pathname(path).expand_path
Watchr.debug("received #{event_type.inspect} event for #{path.relative_path_from(Pathname(Dir.pwd))}")
- if path == @script.path
+ if path == @script.path && event_type != :accessed
@script.parse!
@handler.refresh(monitored_paths)
else
8 test/test_controller.rb
View
@@ -109,5 +109,13 @@ def setup
@handler.stubs(:listen).raises(Interrupt)
@controller.run
end
+
+ test "does not parse script on mere script file access" do
+ path = to_p('abc')
+ @script.stubs(:path).returns(path)
+ @script.expects(:parse!).never
+
+ @controller.update('abc', :accessed)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.