listen 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +22 -0
- data/README.md +146 -29
- data/lib/listen.rb +22 -10
- data/lib/listen/adapter.rb +89 -50
- data/lib/listen/adapters/darwin.rb +43 -18
- data/lib/listen/adapters/linux.rb +48 -33
- data/lib/listen/adapters/polling.rb +20 -7
- data/lib/listen/adapters/windows.rb +38 -31
- data/lib/listen/directory_record.rb +254 -0
- data/lib/listen/listener.rb +59 -228
- data/lib/listen/multi_listener.rb +121 -0
- data/lib/listen/turnstile.rb +28 -0
- data/lib/listen/version.rb +1 -1
- metadata +16 -11
@@ -0,0 +1,28 @@
|
|
1
|
+
module Listen
|
2
|
+
# Allows two threads to wait on eachother.
|
3
|
+
#
|
4
|
+
# @note Only two threads can be used with this Turnstile
|
5
|
+
# because of the current implementation.
|
6
|
+
class Turnstile
|
7
|
+
|
8
|
+
# Initialize the turnstile.
|
9
|
+
#
|
10
|
+
def initialize
|
11
|
+
# Until ruby offers semahpores, only queues can be used
|
12
|
+
# to implement a turnstile.
|
13
|
+
@q = Queue.new
|
14
|
+
end
|
15
|
+
|
16
|
+
# Blocks the current thread until a signal is received.
|
17
|
+
#
|
18
|
+
def wait
|
19
|
+
@q.pop if @q.num_waiting == 0
|
20
|
+
end
|
21
|
+
|
22
|
+
# Unblocks the waiting thread if there is one.
|
23
|
+
#
|
24
|
+
def signal
|
25
|
+
@q.push :dummy if @q.num_waiting == 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/listen/version.rb
CHANGED
metadata
CHANGED
@@ -1,30 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Thibaud Guillaume-Gentil
|
9
|
+
- Maher Sallam
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
+
date: 2012-04-09 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: rb-fsevent
|
16
|
-
requirement: &
|
17
|
+
requirement: &70142623977580 !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
20
|
- - ~>
|
20
21
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.9.
|
22
|
+
version: 0.9.1
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
+
version_requirements: *70142623977580
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: rb-inotify
|
27
|
-
requirement: &
|
28
|
+
requirement: &70142623977120 !ruby/object:Gem::Requirement
|
28
29
|
none: false
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
@@ -32,10 +33,10 @@ dependencies:
|
|
32
33
|
version: 0.8.8
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
+
version_requirements: *70142623977120
|
36
37
|
- !ruby/object:Gem::Dependency
|
37
38
|
name: rb-fchange
|
38
|
-
requirement: &
|
39
|
+
requirement: &70142623976660 !ruby/object:Gem::Requirement
|
39
40
|
none: false
|
40
41
|
requirements:
|
41
42
|
- - ~>
|
@@ -43,10 +44,10 @@ dependencies:
|
|
43
44
|
version: 0.0.5
|
44
45
|
type: :runtime
|
45
46
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
+
version_requirements: *70142623976660
|
47
48
|
- !ruby/object:Gem::Dependency
|
48
49
|
name: bundler
|
49
|
-
requirement: &
|
50
|
+
requirement: &70142623976280 !ruby/object:Gem::Requirement
|
50
51
|
none: false
|
51
52
|
requirements:
|
52
53
|
- - ! '>='
|
@@ -54,11 +55,12 @@ dependencies:
|
|
54
55
|
version: '0'
|
55
56
|
type: :development
|
56
57
|
prerelease: false
|
57
|
-
version_requirements: *
|
58
|
+
version_requirements: *70142623976280
|
58
59
|
description: The Listen gem listens to file modifications and notifies you about the
|
59
60
|
changes. Works everywhere!
|
60
61
|
email:
|
61
62
|
- thibaud@thibaud.me
|
63
|
+
- maher@sallam.me
|
62
64
|
executables: []
|
63
65
|
extensions: []
|
64
66
|
extra_rdoc_files: []
|
@@ -68,7 +70,10 @@ files:
|
|
68
70
|
- lib/listen/adapters/linux.rb
|
69
71
|
- lib/listen/adapters/polling.rb
|
70
72
|
- lib/listen/adapters/windows.rb
|
73
|
+
- lib/listen/directory_record.rb
|
71
74
|
- lib/listen/listener.rb
|
75
|
+
- lib/listen/multi_listener.rb
|
76
|
+
- lib/listen/turnstile.rb
|
72
77
|
- lib/listen/version.rb
|
73
78
|
- lib/listen.rb
|
74
79
|
- CHANGELOG.md
|