listen 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +12 -0
- data/lib/listen/listener.rb +29 -1
- data/lib/listen/version.rb +1 -1
- metadata +10 -10
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -94,6 +94,18 @@ These options can be set through `Listen.to` params or via methods (see the "Obj
|
|
94
94
|
# default: "WARNING: Listen fallen back to polling, learn more at https://github.com/guard/listen#fallback."
|
95
95
|
```
|
96
96
|
|
97
|
+
### Pause/Unpause
|
98
|
+
|
99
|
+
Listener can also easily be paused/unpaused:
|
100
|
+
|
101
|
+
``` ruby
|
102
|
+
listener = Listen.to('dir/path/to/listen')
|
103
|
+
listener.start # enter the run loop
|
104
|
+
listener.pause # stop the run loop and enter the wait loop
|
105
|
+
listener.unpause # re-enter the run loop
|
106
|
+
listener.stop
|
107
|
+
```
|
108
|
+
|
97
109
|
## Listen adapters
|
98
110
|
|
99
111
|
The Listen gem has a set of adapters to notify it when there are changes.
|
data/lib/listen/listener.rb
CHANGED
@@ -9,7 +9,7 @@ require 'listen/adapters/windows'
|
|
9
9
|
|
10
10
|
module Listen
|
11
11
|
class Listener
|
12
|
-
attr_accessor :directory, :ignored_paths, :file_filters, :sha1_checksums, :paths
|
12
|
+
attr_accessor :directory, :ignored_paths, :file_filters, :sha1_checksums, :paths, :paused
|
13
13
|
|
14
14
|
# Default paths that gets ignored by the listener
|
15
15
|
DEFAULT_IGNORED_PATHS = %w[.bundle .git .DS_Store log tmp vendor]
|
@@ -55,7 +55,35 @@ module Listen
|
|
55
55
|
# Stop the adapter.
|
56
56
|
#
|
57
57
|
def stop
|
58
|
+
if @paused
|
59
|
+
@paused = false
|
60
|
+
else
|
61
|
+
@adapter.stop
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Stop the adapter and wait
|
66
|
+
#
|
67
|
+
def pause
|
68
|
+
@paused = true
|
58
69
|
@adapter.stop
|
70
|
+
sleep 0.1 while @paused
|
71
|
+
end
|
72
|
+
|
73
|
+
# UnPause and re-initialize @paths and start the adapter
|
74
|
+
#
|
75
|
+
def unpause
|
76
|
+
@paused = false
|
77
|
+
init_paths
|
78
|
+
@adapter.start
|
79
|
+
end
|
80
|
+
|
81
|
+
# Is this listener paused
|
82
|
+
#
|
83
|
+
# @return [Boolean] listener paused status
|
84
|
+
#
|
85
|
+
def paused?
|
86
|
+
@paused == true
|
59
87
|
end
|
60
88
|
|
61
89
|
# Add ignored path to the listener.
|
data/lib/listen/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rb-fsevent
|
16
|
-
requirement: &
|
16
|
+
requirement: &70305954323260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70305954323260
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rb-inotify
|
27
|
-
requirement: &
|
27
|
+
requirement: &70305954322620 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.8.8
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70305954322620
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rb-fchange
|
38
|
-
requirement: &
|
38
|
+
requirement: &70305954322080 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.0.5
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70305954322080
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70305954321620 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70305954321620
|
58
58
|
description: The Listen gem listens to file modifications and notifies you about the
|
59
59
|
changes. Works everywhere!
|
60
60
|
email:
|