listen 0.4.7 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +161 -147
- data/LICENSE +20 -20
- data/README.md +2 -3
- data/lib/listen.rb +6 -5
- data/lib/listen/adapter.rb +72 -27
- data/lib/listen/adapters/darwin.rb +11 -10
- data/lib/listen/adapters/linux.rb +33 -30
- data/lib/listen/adapters/polling.rb +1 -0
- data/lib/listen/adapters/windows.rb +27 -21
- data/lib/listen/dependency_manager.rb +126 -0
- data/lib/listen/directory_record.rb +318 -318
- data/lib/listen/listener.rb +203 -203
- data/lib/listen/multi_listener.rb +121 -121
- data/lib/listen/turnstile.rb +28 -28
- data/lib/listen/version.rb +3 -3
- metadata +14 -57
data/lib/listen/turnstile.rb
CHANGED
@@ -1,28 +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
|
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
@@ -1,3 +1,3 @@
|
|
1
|
-
module Listen
|
2
|
-
VERSION = '0.
|
3
|
-
end
|
1
|
+
module Listen
|
2
|
+
VERSION = '0.5.0'
|
3
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,56 +10,8 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-09-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: rb-fsevent
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.9.1
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ~>
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 0.9.1
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
|
-
name: rb-inotify
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
|
-
requirements:
|
36
|
-
- - ~>
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: 0.8.8
|
39
|
-
type: :runtime
|
40
|
-
prerelease: false
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.8.8
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: rb-fchange
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.0.5
|
55
|
-
type: :runtime
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 0.0.5
|
63
15
|
- !ruby/object:Gem::Dependency
|
64
16
|
name: bundler
|
65
17
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,17 +37,18 @@ executables: []
|
|
85
37
|
extensions: []
|
86
38
|
extra_rdoc_files: []
|
87
39
|
files:
|
40
|
+
- lib/listen.rb
|
41
|
+
- lib/listen/dependency_manager.rb
|
42
|
+
- lib/listen/version.rb
|
88
43
|
- lib/listen/adapter.rb
|
44
|
+
- lib/listen/multi_listener.rb
|
45
|
+
- lib/listen/listener.rb
|
46
|
+
- lib/listen/turnstile.rb
|
47
|
+
- lib/listen/directory_record.rb
|
48
|
+
- lib/listen/adapters/polling.rb
|
89
49
|
- lib/listen/adapters/darwin.rb
|
90
50
|
- lib/listen/adapters/linux.rb
|
91
|
-
- lib/listen/adapters/polling.rb
|
92
51
|
- lib/listen/adapters/windows.rb
|
93
|
-
- lib/listen/directory_record.rb
|
94
|
-
- lib/listen/listener.rb
|
95
|
-
- lib/listen/multi_listener.rb
|
96
|
-
- lib/listen/turnstile.rb
|
97
|
-
- lib/listen/version.rb
|
98
|
-
- lib/listen.rb
|
99
52
|
- CHANGELOG.md
|
100
53
|
- LICENSE
|
101
54
|
- README.md
|
@@ -111,6 +64,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
64
|
- - ! '>='
|
112
65
|
- !ruby/object:Gem::Version
|
113
66
|
version: '0'
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
hash: 786921235
|
114
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
71
|
none: false
|
116
72
|
requirements:
|
@@ -124,3 +80,4 @@ signing_key:
|
|
124
80
|
specification_version: 3
|
125
81
|
summary: Listen to file modifications
|
126
82
|
test_files: []
|
83
|
+
has_rdoc:
|