autotest-inotify 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/autotest/inotify.rb +11 -5
  2. metadata +35 -13
@@ -1,7 +1,6 @@
1
1
  # Extend autotest with inotify goodness
2
2
 
3
3
  require "rubygems"
4
- require "ruby-debug"
5
4
  require "autotest"
6
5
  require "rbconfig"
7
6
  require "rb-inotify"
@@ -42,7 +41,7 @@ module Autotest::Inotify
42
41
  def wait_for_changes
43
42
  @changed_files = {}
44
43
  hook :waiting
45
- @notifier.process
44
+ @notifier.process while @changed_files.empty?
46
45
  end
47
46
 
48
47
  def find_files_to_test(files=nil)
@@ -67,9 +66,16 @@ module Autotest::Inotify
67
66
 
68
67
  def setup_inotify
69
68
  @notifier = INotify::Notifier.new
70
- self.find_files.keys.each do |filename|
71
- @notifier.watch(filename, :modify) do |event|
72
- handle_file_event(event)
69
+ files = self.find_files.keys
70
+ dirs = files.map{|f| File.dirname( f )}.uniq
71
+ # Watch directories to catch delete/move swap patterns as well as direct
72
+ # modifications. This handles, e.g. :w in vim.
73
+ dirs.each do |dir|
74
+ @notifier.watch( dir, :all_events ) do |event|
75
+ if event.flags.include? :modify and
76
+ files.include? event.absolute_name
77
+ handle_file_event( event )
78
+ end
73
79
  end
74
80
  end
75
81
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autotest-inotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
5
11
  platform: ruby
6
12
  authors:
7
13
  - Eric Wollesen
@@ -9,29 +15,39 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-03-11 00:00:00 -07:00
18
+ date: 2010-06-17 00:00:00 -06:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: autotest
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 63
30
+ segments:
31
+ - 4
32
+ - 2
33
+ - 4
23
34
  version: 4.2.4
24
- version:
35
+ type: :runtime
36
+ version_requirements: *id001
25
37
  - !ruby/object:Gem::Dependency
26
38
  name: rb-inotify
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
30
42
  requirements:
31
43
  - - ">="
32
44
  - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
33
48
  version: "0"
34
- version:
49
+ type: :runtime
50
+ version_requirements: *id002
35
51
  description: Autotest relies on filesystem polling to detect modifications in source code files. This is expensive for the CPU, harddrive and battery - and unnecesary on Linux with libinotify installed. This gem teaches autotest how to use libinotify.
36
52
  email: ericw@kill-0.com
37
53
  executables: []
@@ -55,21 +71,27 @@ rdoc_options:
55
71
  require_paths:
56
72
  - lib
57
73
  required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
58
75
  requirements:
59
76
  - - ">="
60
77
  - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
61
81
  version: "0"
62
- version:
63
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
64
84
  requirements:
65
85
  - - ">="
66
86
  - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
67
90
  version: "0"
68
- version:
69
91
  requirements: []
70
92
 
71
93
  rubyforge_project:
72
- rubygems_version: 1.3.5
94
+ rubygems_version: 1.3.7
73
95
  signing_key:
74
96
  specification_version: 3
75
97
  summary: Teaches autotest to use libinotify (on Linux) instead of filesystem polling.