Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #18 from jonathanperret/fix-script-reparse-on-access

Patch to avoid re-parsing script on atime change
  • Loading branch information...
commit 726e61b4fe49c2a99793dd1064c8fc58c88d29b7 2 parents 17fa9bf + ec6cdb9
@mynyml authored
Showing with 9 additions and 1 deletion.
  1. +1 −1  lib/watchr/controller.rb
  2. +8 −0 test/test_controller.rb
View
2  lib/watchr/controller.rb
@@ -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
View
8 test/test_controller.rb
@@ -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.