listen 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/README.md +2 -0
- data/lib/listen/directory_record.rb +22 -0
- data/lib/listen/listener.rb +22 -0
- data/lib/listen/multi_listener.rb +22 -0
- data/lib/listen/version.rb +1 -1
- metadata +6 -2
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.6.0 - November 21, 2012
|
2
|
+
|
3
|
+
### New feature
|
4
|
+
|
5
|
+
- Add bang versions for filter and ignore listener methods. ([@tarsolya][])
|
6
|
+
|
1
7
|
## 0.5.3 - October 3, 2012
|
2
8
|
|
3
9
|
### Bug fixes
|
@@ -182,5 +188,6 @@
|
|
182
188
|
[@sunaku]: https://github.com/sunaku
|
183
189
|
[@textgoeshere]: https://github.com/textgoeshere
|
184
190
|
[@thibaudgg]: https://github.com/thibaudgg
|
191
|
+
[@tarsolya]: https://github.com/tarsolya
|
185
192
|
[@vongruenigen]: https://github.com/vongruenigen
|
186
193
|
[WDM]: https://github.com/Maher4Ever/wdm
|
data/README.md
CHANGED
@@ -215,6 +215,8 @@ with a directory-separator, otherwise they won't work as expected.
|
|
215
215
|
As an example: to ignore the `build` directory in a C-project, use `%r{build/}`
|
216
216
|
and not `%r{/build/}`.
|
217
217
|
|
218
|
+
Use `#filter!` and `#ignore!` methods to overwrites default patterns.
|
219
|
+
|
218
220
|
### Non-blocking listening to changes
|
219
221
|
|
220
222
|
Starting a listener blocks the current thread by default. That means any code after the
|
@@ -88,6 +88,17 @@ module Listen
|
|
88
88
|
@ignoring_patterns.merge(regexps)
|
89
89
|
end
|
90
90
|
|
91
|
+
# Replaces ignoring patterns in the record.
|
92
|
+
#
|
93
|
+
# @example Ignore only these paths
|
94
|
+
# ignore! %r{^ignored/path/}, /man/
|
95
|
+
#
|
96
|
+
# @param [Regexp] regexp a pattern for ignoring paths
|
97
|
+
#
|
98
|
+
def ignore!(*regexps)
|
99
|
+
@ignoring_patterns.replace(regexps)
|
100
|
+
end
|
101
|
+
|
91
102
|
# Adds filtering patterns to the listener.
|
92
103
|
#
|
93
104
|
# @example Filter some files
|
@@ -99,6 +110,17 @@ module Listen
|
|
99
110
|
@filtering_patterns.merge(regexps)
|
100
111
|
end
|
101
112
|
|
113
|
+
# Replaces filtering patterns in the listener.
|
114
|
+
#
|
115
|
+
# @example Filter only these files
|
116
|
+
# ignore /\.txt$/, /.*\.zip/
|
117
|
+
#
|
118
|
+
# @param [Regexp] regexp a pattern for filtering paths
|
119
|
+
#
|
120
|
+
def filter!(*regexps)
|
121
|
+
@filtering_patterns.replace(regexps)
|
122
|
+
end
|
123
|
+
|
102
124
|
# Returns whether a path should be ignored or not.
|
103
125
|
#
|
104
126
|
# @param [String] path the path to test.
|
data/lib/listen/listener.rb
CHANGED
@@ -93,6 +93,17 @@ module Listen
|
|
93
93
|
self
|
94
94
|
end
|
95
95
|
|
96
|
+
# Replaces ignoring patterns in the listener.
|
97
|
+
#
|
98
|
+
# @param (see Listen::DirectoryRecord#ignore!)
|
99
|
+
#
|
100
|
+
# @return [Listen::Listener] the listener
|
101
|
+
#
|
102
|
+
def ignore!(*regexps)
|
103
|
+
@directory_record.ignore!(*regexps)
|
104
|
+
self
|
105
|
+
end
|
106
|
+
|
96
107
|
# Adds filtering patterns to the listener.
|
97
108
|
#
|
98
109
|
# @param (see Listen::DirectoryRecord#filter)
|
@@ -104,6 +115,17 @@ module Listen
|
|
104
115
|
self
|
105
116
|
end
|
106
117
|
|
118
|
+
# Replacing filtering patterns in the listener.
|
119
|
+
#
|
120
|
+
# @param (see Listen::DirectoryRecord#filter!)
|
121
|
+
#
|
122
|
+
# @return [Listen::Listener] the listener
|
123
|
+
#
|
124
|
+
def filter!(*regexps)
|
125
|
+
@directory_record.filter!(*regexps)
|
126
|
+
self
|
127
|
+
end
|
128
|
+
|
107
129
|
# Sets the latency for the adapter. This is a helper method
|
108
130
|
# to simplify changing the latency directly from the listener.
|
109
131
|
#
|
@@ -65,6 +65,17 @@ module Listen
|
|
65
65
|
self
|
66
66
|
end
|
67
67
|
|
68
|
+
# Replaces ignored paths in the listener.
|
69
|
+
#
|
70
|
+
# @param (see Listen::DirectoryRecord#ignore!)
|
71
|
+
#
|
72
|
+
# @return [Listen::Listener] the listener
|
73
|
+
#
|
74
|
+
def ignore!(*paths)
|
75
|
+
@directories_records.each { |r| r.ignore!(*paths) }
|
76
|
+
self
|
77
|
+
end
|
78
|
+
|
68
79
|
# Adds file filters to the listener.
|
69
80
|
#
|
70
81
|
# @param (see Listen::DirectoryRecord#filter)
|
@@ -76,6 +87,17 @@ module Listen
|
|
76
87
|
self
|
77
88
|
end
|
78
89
|
|
90
|
+
# Replaces file filters in the listener.
|
91
|
+
#
|
92
|
+
# @param (see Listen::DirectoryRecord#filter!)
|
93
|
+
#
|
94
|
+
# @return [Listen::Listener] the listener
|
95
|
+
#
|
96
|
+
def filter!(*regexps)
|
97
|
+
@directories_records.each { |r| r.filter!(*regexps) }
|
98
|
+
self
|
99
|
+
end
|
100
|
+
|
79
101
|
# Runs the callback passing it the changes if there are any.
|
80
102
|
#
|
81
103
|
# @param (see Listen::DirectoryRecord#fetch_changes)
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -64,6 +64,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
64
|
- - ! '>='
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
hash: -2035972010079293192
|
67
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
71
|
none: false
|
69
72
|
requirements:
|
@@ -77,3 +80,4 @@ signing_key:
|
|
77
80
|
specification_version: 3
|
78
81
|
summary: Listen to file modifications
|
79
82
|
test_files: []
|
83
|
+
has_rdoc:
|