guard 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/guard.rb +1 -1
- data/lib/guard/listeners/darwin.rb +2 -2
- data/lib/guard/listeners/linux.rb +12 -4
- data/lib/guard/version.rb +1 -1
- metadata +4 -4
data/lib/guard.rb
CHANGED
@@ -25,8 +25,8 @@ module Guard
|
|
25
25
|
|
26
26
|
def self.usable?
|
27
27
|
require 'rb-fsevent'
|
28
|
-
if !defined?(FSEvent::VERSION) || Gem::Version.new(FSEvent::VERSION) < Gem::Version.new('0.3.
|
29
|
-
UI.info "Please update rb-fsevent (>= 0.3.
|
28
|
+
if !defined?(FSEvent::VERSION) || Gem::Version.new(FSEvent::VERSION) < Gem::Version.new('0.3.3')
|
29
|
+
UI.info "Please update rb-fsevent (>= 0.3.3)"
|
30
30
|
false
|
31
31
|
else
|
32
32
|
true
|
@@ -3,6 +3,8 @@ module Guard
|
|
3
3
|
attr_reader :inotify, :files, :latency, :callback
|
4
4
|
|
5
5
|
def initialize
|
6
|
+
super
|
7
|
+
|
6
8
|
@inotify = INotify::Notifier.new
|
7
9
|
@files = []
|
8
10
|
@latency = 0.5
|
@@ -10,7 +12,7 @@ module Guard
|
|
10
12
|
|
11
13
|
def on_change(&callback)
|
12
14
|
@callback = callback
|
13
|
-
inotify.watch(Dir.pwd, :recursive, :
|
15
|
+
inotify.watch(Dir.pwd, :recursive, :modify, :create, :delete, :move) do |event|
|
14
16
|
unless event.name == "" # Event on root directory
|
15
17
|
@files << event.absolute_name
|
16
18
|
end
|
@@ -20,12 +22,12 @@ module Guard
|
|
20
22
|
|
21
23
|
def start
|
22
24
|
@stop = false
|
23
|
-
watch_change
|
25
|
+
watch_change unless @watch_change
|
24
26
|
end
|
25
27
|
|
26
28
|
def stop
|
27
29
|
@stop = true
|
28
|
-
|
30
|
+
sleep latency
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.usable?
|
@@ -44,18 +46,24 @@ module Guard
|
|
44
46
|
private
|
45
47
|
|
46
48
|
def watch_change
|
49
|
+
@watch_change = true
|
47
50
|
while !@stop
|
48
51
|
if Config::CONFIG['build'] =~ /java/ || IO.select([inotify.to_io], [], [], latency)
|
52
|
+
break if @stop
|
53
|
+
|
49
54
|
inotify.process
|
55
|
+
update_last_event
|
50
56
|
|
51
57
|
unless files.empty?
|
52
58
|
files.map! { |file| file.gsub("#{Dir.pwd}/", '') }
|
53
59
|
callback.call(files)
|
54
60
|
files.clear
|
55
61
|
end
|
56
|
-
|
62
|
+
|
63
|
+
sleep latency unless @stop
|
57
64
|
end
|
58
65
|
end
|
66
|
+
@watch_change = false
|
59
67
|
end
|
60
68
|
|
61
69
|
end
|
data/lib/guard/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thibaud Guillaume-Gentil
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-24 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|