sass 3.1.0 → 3.3.0
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.
- checksums.yaml +7 -0
- data/CONTRIBUTING +1 -1
- data/MIT-LICENSE +2 -2
- data/README.md +29 -17
- data/Rakefile +43 -9
- data/VERSION +1 -1
- data/VERSION_DATE +1 -0
- data/VERSION_NAME +1 -1
- data/bin/sass +6 -1
- data/bin/sass-convert +6 -1
- data/bin/scss +6 -1
- data/ext/mkrf_conf.rb +27 -0
- data/lib/sass/cache_stores/base.rb +7 -3
- data/lib/sass/cache_stores/chain.rb +3 -2
- data/lib/sass/cache_stores/filesystem.rb +5 -7
- data/lib/sass/cache_stores/memory.rb +1 -1
- data/lib/sass/cache_stores/null.rb +2 -2
- data/lib/sass/callbacks.rb +2 -1
- data/lib/sass/css.rb +168 -53
- data/lib/sass/engine.rb +502 -174
- data/lib/sass/environment.rb +151 -111
- data/lib/sass/error.rb +7 -7
- data/lib/sass/exec.rb +176 -60
- data/lib/sass/features.rb +40 -0
- data/lib/sass/importers/base.rb +46 -7
- data/lib/sass/importers/deprecated_path.rb +51 -0
- data/lib/sass/importers/filesystem.rb +113 -30
- data/lib/sass/importers.rb +1 -0
- data/lib/sass/logger/base.rb +30 -0
- data/lib/sass/logger/log_level.rb +45 -0
- data/lib/sass/logger.rb +12 -0
- data/lib/sass/media.rb +213 -0
- data/lib/sass/plugin/compiler.rb +194 -104
- data/lib/sass/plugin/configuration.rb +18 -25
- data/lib/sass/plugin/merb.rb +1 -1
- data/lib/sass/plugin/staleness_checker.rb +37 -11
- data/lib/sass/plugin.rb +10 -13
- data/lib/sass/railtie.rb +2 -1
- data/lib/sass/repl.rb +5 -6
- data/lib/sass/script/css_lexer.rb +8 -4
- data/lib/sass/script/css_parser.rb +5 -2
- data/lib/sass/script/functions.rb +1547 -618
- data/lib/sass/script/lexer.rb +122 -72
- data/lib/sass/script/parser.rb +304 -135
- data/lib/sass/script/tree/funcall.rb +306 -0
- data/lib/sass/script/{interpolation.rb → tree/interpolation.rb} +43 -13
- data/lib/sass/script/tree/list_literal.rb +77 -0
- data/lib/sass/script/tree/literal.rb +45 -0
- data/lib/sass/script/tree/map_literal.rb +64 -0
- data/lib/sass/script/{node.rb → tree/node.rb} +30 -12
- data/lib/sass/script/{operation.rb → tree/operation.rb} +33 -21
- data/lib/sass/script/{string_interpolation.rb → tree/string_interpolation.rb} +14 -4
- data/lib/sass/script/{unary_operation.rb → tree/unary_operation.rb} +21 -9
- data/lib/sass/script/tree/variable.rb +57 -0
- data/lib/sass/script/tree.rb +15 -0
- data/lib/sass/script/value/arg_list.rb +36 -0
- data/lib/sass/script/value/base.rb +238 -0
- data/lib/sass/script/value/bool.rb +40 -0
- data/lib/sass/script/{color.rb → value/color.rb} +256 -74
- data/lib/sass/script/value/deprecated_false.rb +55 -0
- data/lib/sass/script/value/helpers.rb +155 -0
- data/lib/sass/script/value/list.rb +128 -0
- data/lib/sass/script/value/map.rb +70 -0
- data/lib/sass/script/value/null.rb +49 -0
- data/lib/sass/script/{number.rb → value/number.rb} +115 -62
- data/lib/sass/script/{string.rb → value/string.rb} +9 -11
- data/lib/sass/script/value.rb +12 -0
- data/lib/sass/script.rb +35 -9
- data/lib/sass/scss/css_parser.rb +2 -12
- data/lib/sass/scss/parser.rb +657 -230
- data/lib/sass/scss/rx.rb +17 -12
- data/lib/sass/scss/static_parser.rb +37 -6
- data/lib/sass/scss.rb +0 -1
- data/lib/sass/selector/abstract_sequence.rb +35 -3
- data/lib/sass/selector/comma_sequence.rb +29 -14
- data/lib/sass/selector/sequence.rb +371 -74
- data/lib/sass/selector/simple.rb +28 -13
- data/lib/sass/selector/simple_sequence.rb +163 -36
- data/lib/sass/selector.rb +138 -36
- data/lib/sass/shared.rb +3 -5
- data/lib/sass/source/map.rb +196 -0
- data/lib/sass/source/position.rb +39 -0
- data/lib/sass/source/range.rb +41 -0
- data/lib/sass/stack.rb +126 -0
- data/lib/sass/supports.rb +228 -0
- data/lib/sass/tree/at_root_node.rb +82 -0
- data/lib/sass/tree/comment_node.rb +34 -29
- data/lib/sass/tree/content_node.rb +9 -0
- data/lib/sass/tree/css_import_node.rb +60 -0
- data/lib/sass/tree/debug_node.rb +3 -3
- data/lib/sass/tree/directive_node.rb +33 -3
- data/lib/sass/tree/each_node.rb +9 -9
- data/lib/sass/tree/extend_node.rb +20 -6
- data/lib/sass/tree/for_node.rb +6 -6
- data/lib/sass/tree/function_node.rb +12 -4
- data/lib/sass/tree/if_node.rb +2 -15
- data/lib/sass/tree/import_node.rb +11 -5
- data/lib/sass/tree/media_node.rb +27 -11
- data/lib/sass/tree/mixin_def_node.rb +15 -4
- data/lib/sass/tree/mixin_node.rb +27 -7
- data/lib/sass/tree/node.rb +69 -35
- data/lib/sass/tree/prop_node.rb +47 -31
- data/lib/sass/tree/return_node.rb +4 -3
- data/lib/sass/tree/root_node.rb +20 -4
- data/lib/sass/tree/rule_node.rb +37 -26
- data/lib/sass/tree/supports_node.rb +38 -0
- data/lib/sass/tree/trace_node.rb +33 -0
- data/lib/sass/tree/variable_node.rb +10 -4
- data/lib/sass/tree/visitors/base.rb +5 -8
- data/lib/sass/tree/visitors/check_nesting.rb +67 -52
- data/lib/sass/tree/visitors/convert.rb +134 -53
- data/lib/sass/tree/visitors/cssize.rb +245 -51
- data/lib/sass/tree/visitors/deep_copy.rb +102 -0
- data/lib/sass/tree/visitors/extend.rb +68 -0
- data/lib/sass/tree/visitors/perform.rb +331 -105
- data/lib/sass/tree/visitors/set_options.rb +125 -0
- data/lib/sass/tree/visitors/to_css.rb +259 -95
- data/lib/sass/tree/warn_node.rb +3 -3
- data/lib/sass/tree/while_node.rb +3 -3
- data/lib/sass/util/cross_platform_random.rb +19 -0
- data/lib/sass/util/multibyte_string_scanner.rb +157 -0
- data/lib/sass/util/normalized_map.rb +130 -0
- data/lib/sass/util/ordered_hash.rb +192 -0
- data/lib/sass/util/subset_map.rb +11 -2
- data/lib/sass/util/test.rb +9 -0
- data/lib/sass/util.rb +565 -39
- data/lib/sass/version.rb +27 -15
- data/lib/sass.rb +39 -4
- data/test/sass/cache_test.rb +15 -0
- data/test/sass/compiler_test.rb +223 -0
- data/test/sass/conversion_test.rb +901 -107
- data/test/sass/css2sass_test.rb +94 -0
- data/test/sass/engine_test.rb +1059 -164
- data/test/sass/exec_test.rb +86 -0
- data/test/sass/extend_test.rb +933 -837
- data/test/sass/fixtures/test_staleness_check_across_importers.css +1 -0
- data/test/sass/fixtures/test_staleness_check_across_importers.scss +1 -0
- data/test/sass/functions_test.rb +995 -136
- data/test/sass/importer_test.rb +338 -18
- data/test/sass/logger_test.rb +58 -0
- data/test/sass/more_results/more_import.css +2 -2
- data/test/sass/plugin_test.rb +114 -30
- data/test/sass/results/cached_import_option.css +3 -0
- data/test/sass/results/filename_fn.css +3 -0
- data/test/sass/results/import.css +2 -2
- data/test/sass/results/import_charset.css +1 -0
- data/test/sass/results/import_charset_1_8.css +1 -0
- data/test/sass/results/import_charset_ibm866.css +1 -0
- data/test/sass/results/import_content.css +1 -0
- data/test/sass/results/script.css +1 -1
- data/test/sass/results/scss_import.css +2 -2
- data/test/sass/results/units.css +2 -2
- data/test/sass/script_conversion_test.rb +43 -1
- data/test/sass/script_test.rb +380 -36
- data/test/sass/scss/css_test.rb +257 -75
- data/test/sass/scss/scss_test.rb +2322 -110
- data/test/sass/source_map_test.rb +887 -0
- data/test/sass/templates/_cached_import_option_partial.scss +1 -0
- data/test/sass/templates/_double_import_loop2.sass +1 -0
- data/test/sass/templates/_filename_fn_import.scss +11 -0
- data/test/sass/templates/_imported_content.sass +3 -0
- data/test/sass/templates/_same_name_different_partiality.scss +1 -0
- data/test/sass/templates/bork5.sass +3 -0
- data/test/sass/templates/cached_import_option.scss +3 -0
- data/test/sass/templates/double_import_loop1.sass +1 -0
- data/test/sass/templates/filename_fn.scss +18 -0
- data/test/sass/templates/import_charset.sass +2 -0
- data/test/sass/templates/import_charset_1_8.sass +2 -0
- data/test/sass/templates/import_charset_ibm866.sass +2 -0
- data/test/sass/templates/import_content.sass +4 -0
- data/test/sass/templates/same_name_different_ext.sass +2 -0
- data/test/sass/templates/same_name_different_ext.scss +1 -0
- data/test/sass/templates/same_name_different_partiality.scss +1 -0
- data/test/sass/templates/single_import_loop.sass +1 -0
- data/test/sass/templates/subdir/import_up1.scss +1 -0
- data/test/sass/templates/subdir/import_up2.scss +1 -0
- data/test/sass/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +147 -0
- data/test/sass/util/normalized_map_test.rb +51 -0
- data/test/sass/util_test.rb +183 -0
- data/test/sass/value_helpers_test.rb +181 -0
- data/test/test_helper.rb +45 -5
- data/vendor/listen/CHANGELOG.md +228 -0
- data/vendor/listen/CONTRIBUTING.md +38 -0
- data/vendor/listen/Gemfile +30 -0
- data/vendor/listen/Guardfile +8 -0
- data/vendor/{fssm → listen}/LICENSE +1 -1
- data/vendor/listen/README.md +315 -0
- data/vendor/listen/Rakefile +47 -0
- data/vendor/listen/Vagrantfile +96 -0
- data/vendor/listen/lib/listen/adapter.rb +214 -0
- data/vendor/listen/lib/listen/adapters/bsd.rb +112 -0
- data/vendor/listen/lib/listen/adapters/darwin.rb +85 -0
- data/vendor/listen/lib/listen/adapters/linux.rb +113 -0
- data/vendor/listen/lib/listen/adapters/polling.rb +67 -0
- data/vendor/listen/lib/listen/adapters/windows.rb +87 -0
- data/vendor/listen/lib/listen/dependency_manager.rb +126 -0
- data/vendor/listen/lib/listen/directory_record.rb +371 -0
- data/vendor/listen/lib/listen/listener.rb +225 -0
- data/vendor/listen/lib/listen/multi_listener.rb +143 -0
- data/vendor/listen/lib/listen/turnstile.rb +28 -0
- data/vendor/listen/lib/listen/version.rb +3 -0
- data/vendor/listen/lib/listen.rb +40 -0
- data/vendor/listen/listen.gemspec +22 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +183 -0
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +36 -0
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +37 -0
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +47 -0
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +68 -0
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +30 -0
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +107 -0
- data/vendor/listen/spec/listen/directory_record_spec.rb +1225 -0
- data/vendor/listen/spec/listen/listener_spec.rb +169 -0
- data/vendor/listen/spec/listen/multi_listener_spec.rb +174 -0
- data/vendor/listen/spec/listen/turnstile_spec.rb +56 -0
- data/vendor/listen/spec/listen_spec.rb +73 -0
- data/vendor/listen/spec/spec_helper.rb +21 -0
- data/vendor/listen/spec/support/adapter_helper.rb +629 -0
- data/vendor/listen/spec/support/directory_record_helper.rb +55 -0
- data/vendor/listen/spec/support/fixtures_helper.rb +29 -0
- data/vendor/listen/spec/support/listeners_helper.rb +156 -0
- data/vendor/listen/spec/support/platform_helper.rb +15 -0
- metadata +344 -271
- data/lib/sass/less.rb +0 -382
- data/lib/sass/script/bool.rb +0 -18
- data/lib/sass/script/funcall.rb +0 -162
- data/lib/sass/script/list.rb +0 -76
- data/lib/sass/script/literal.rb +0 -245
- data/lib/sass/script/variable.rb +0 -54
- data/lib/sass/scss/sass_parser.rb +0 -11
- data/test/sass/less_conversion_test.rb +0 -653
- data/vendor/fssm/README.markdown +0 -55
- data/vendor/fssm/Rakefile +0 -59
- data/vendor/fssm/VERSION.yml +0 -5
- data/vendor/fssm/example.rb +0 -9
- data/vendor/fssm/fssm.gemspec +0 -77
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
- data/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
- data/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
- data/vendor/fssm/lib/fssm/monitor.rb +0 -26
- data/vendor/fssm/lib/fssm/path.rb +0 -91
- data/vendor/fssm/lib/fssm/pathname.rb +0 -502
- data/vendor/fssm/lib/fssm/state/directory.rb +0 -57
- data/vendor/fssm/lib/fssm/state/file.rb +0 -24
- data/vendor/fssm/lib/fssm/support.rb +0 -63
- data/vendor/fssm/lib/fssm/tree.rb +0 -176
- data/vendor/fssm/lib/fssm.rb +0 -33
- data/vendor/fssm/profile/prof-cache.rb +0 -40
- data/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
- data/vendor/fssm/profile/prof-pathname.rb +0 -68
- data/vendor/fssm/profile/prof-plain-pathname.html +0 -988
- data/vendor/fssm/profile/prof.html +0 -2379
- data/vendor/fssm/spec/path_spec.rb +0 -75
- data/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/fssm/spec/spec_helper.rb +0 -14
@@ -0,0 +1,315 @@
|
|
1
|
+
# Listen [](http://travis-ci.org/guard/listen)
|
2
|
+
|
3
|
+
The Listen gem listens to file modifications and notifies you about the changes.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
* Works everywhere!
|
8
|
+
* Supports watching multiple directories from a single listener.
|
9
|
+
* OS-specific adapters for Mac OS X 10.6+, Linux, *BSD and Windows.
|
10
|
+
* Automatic fallback to polling if OS-specific adapter doesn't work.
|
11
|
+
* Detects file modification, addition and removal.
|
12
|
+
* Checksum comparison for modifications made under the same second.
|
13
|
+
* Allows supplying regexp-patterns to ignore and filter paths for better results.
|
14
|
+
* Tested on all Ruby environments via [travis-ci](http://travis-ci.org/guard/listen).
|
15
|
+
|
16
|
+
## Install
|
17
|
+
|
18
|
+
``` bash
|
19
|
+
gem install listen
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
There are **two ways** to use Listen:
|
25
|
+
|
26
|
+
1. Call `Listen.to` with either a single directory or multiple directories, then define the `change` callback in a block.
|
27
|
+
2. Create a `listener` object and use it in an (ARel style) chainable way.
|
28
|
+
|
29
|
+
Feel free to give your feeback via [Listen issues](https://github.com/guard/listen/issues)
|
30
|
+
|
31
|
+
### Block API
|
32
|
+
|
33
|
+
``` ruby
|
34
|
+
# Listen to a single directory.
|
35
|
+
Listen.to('dir/path/to/listen', :filter => /\.rb$/, :ignore => %r{ignored/path/}) do |modified, added, removed|
|
36
|
+
# ...
|
37
|
+
end
|
38
|
+
|
39
|
+
# Listen to multiple directories.
|
40
|
+
Listen.to('dir/to/awesome_app', 'dir/to/other_app', :filter => /\.rb$/, :latency => 0.1) do |modified, added, removed|
|
41
|
+
# ...
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
### "Object" API
|
46
|
+
|
47
|
+
``` ruby
|
48
|
+
listener = Listen.to('dir/path/to/listen')
|
49
|
+
listener = listener.ignore(%r{^ignored/path/})
|
50
|
+
listener = listener.filter(/\.rb$/)
|
51
|
+
listener = listener.latency(0.5)
|
52
|
+
listener = listener.force_polling(true)
|
53
|
+
listener = listener.polling_fallback_message(false)
|
54
|
+
listener = listener.change(&callback)
|
55
|
+
listener.start # blocks execution!
|
56
|
+
```
|
57
|
+
|
58
|
+
### Chainable
|
59
|
+
|
60
|
+
``` ruby
|
61
|
+
Listen.to('dir/path/to/listen')
|
62
|
+
.ignore(%r{^ignored/path/})
|
63
|
+
.filter(/\.rb$/)
|
64
|
+
.latency(0.5)
|
65
|
+
.force_polling(true)
|
66
|
+
.polling_fallback_message('custom message')
|
67
|
+
.change(&callback)
|
68
|
+
.start # blocks execution!
|
69
|
+
```
|
70
|
+
|
71
|
+
### Pause/Unpause
|
72
|
+
|
73
|
+
Listener can also easily be paused/unpaused:
|
74
|
+
|
75
|
+
``` ruby
|
76
|
+
listener = Listen.to('dir/path/to/listen')
|
77
|
+
listener.start(false) # non-blocking mode
|
78
|
+
listener.pause # stop listening to changes
|
79
|
+
listener.paused? # => true
|
80
|
+
listener.unpause
|
81
|
+
listener.stop
|
82
|
+
```
|
83
|
+
|
84
|
+
## Listening to changes on multiple directories
|
85
|
+
|
86
|
+
The Listen gem provides the `MultiListener` class to watch multiple directories and
|
87
|
+
handle their changes from a single listener:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
listener = Listen::MultiListener.new('app/css', 'app/js')
|
91
|
+
listener.latency(0.5)
|
92
|
+
|
93
|
+
# Configure the listener to your needs...
|
94
|
+
|
95
|
+
listener.start # blocks execution!
|
96
|
+
````
|
97
|
+
|
98
|
+
For an easier access, the `Listen.to` method can also be used to create a multi-listener:
|
99
|
+
|
100
|
+
``` ruby
|
101
|
+
listener = Listen.to('app/css', 'app/js')
|
102
|
+
.ignore(%r{^vendor/}) # both js/vendor and css/vendor will be ignored
|
103
|
+
.change(&assets_callback)
|
104
|
+
|
105
|
+
listener.start # blocks execution!
|
106
|
+
```
|
107
|
+
|
108
|
+
## Changes callback
|
109
|
+
|
110
|
+
Changes to the listened-to directories gets reported back to the user in a callback.
|
111
|
+
The registered callback gets invoked, when there are changes, with **three** parameters:
|
112
|
+
`modified_paths`, `added_paths` and `removed_paths` in that particular order.
|
113
|
+
|
114
|
+
You can register a callback in two ways. The first way is by passing a block when calling
|
115
|
+
the `Listen.to` method or when initializing a listener object:
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
Listen.to('path/to/app') do |modified, added, removed|
|
119
|
+
# This block will be called when there are changes.
|
120
|
+
end
|
121
|
+
|
122
|
+
# or ...
|
123
|
+
|
124
|
+
listener = Listen::Listener.new('path/to/app') do |modified, added, removed|
|
125
|
+
# This block will be called when there are changes.
|
126
|
+
end
|
127
|
+
|
128
|
+
```
|
129
|
+
|
130
|
+
The second way to register a callback is be calling the `change` method on any
|
131
|
+
listener passing it a block:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
# Create a callback
|
135
|
+
callback = Proc.new do |modified, added, removed|
|
136
|
+
# This proc will be called when there are changes.
|
137
|
+
end
|
138
|
+
|
139
|
+
listener = Listen.to('dir')
|
140
|
+
listener.change(&callback) # convert the callback to a block and register it
|
141
|
+
|
142
|
+
listener.start # blocks execution
|
143
|
+
```
|
144
|
+
|
145
|
+
### Paths in callbacks
|
146
|
+
|
147
|
+
Listeners invoke callbacks passing them absolute paths by default:
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
# Assume someone changes the 'style.css' file in '/home/user/app/css' after creating
|
151
|
+
# the listener.
|
152
|
+
Listen.to('/home/user/app/css') do |modified, added, removed|
|
153
|
+
modified.inspect # => ['/home/user/app/css/style.css']
|
154
|
+
end
|
155
|
+
```
|
156
|
+
|
157
|
+
#### Relative paths in callbacks
|
158
|
+
|
159
|
+
When creating a listener for a **single** path (more specifically a `Listen::Listener` instance),
|
160
|
+
you can pass `:relative_paths => true` as an option to get relative paths in
|
161
|
+
your callback:
|
162
|
+
|
163
|
+
```ruby
|
164
|
+
# Assume someone changes the 'style.css' file in '/home/user/app/css' after creating
|
165
|
+
# the listener.
|
166
|
+
Listen.to('/home/user/app/css', :relative_paths => true) do |modified, added, removed|
|
167
|
+
modified.inspect # => ['style.css']
|
168
|
+
end
|
169
|
+
```
|
170
|
+
|
171
|
+
Passing the `:relative_paths => true` option won't work when listeneing to multiple
|
172
|
+
directories:
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
# Assume someone changes the 'style.css' file in '/home/user/app/css' after creating
|
176
|
+
# the listener.
|
177
|
+
Listen.to('/home/user/app/css', '/home/user/app/js', :relative_paths => true) do |modified, added, removed|
|
178
|
+
modified.inspect # => ['/home/user/app/css/style.css']
|
179
|
+
end
|
180
|
+
```
|
181
|
+
|
182
|
+
## Options
|
183
|
+
|
184
|
+
These options can be set through `Listen.to` params or via methods (see the "Object" API)
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
:filter => /\.rb$/, /\.coffee$/ # Filter files to listen to via a regexps list.
|
188
|
+
# default: none
|
189
|
+
|
190
|
+
:ignore => %r{app/CMake/}, /\.pid$/ # Ignore a list of paths (root directory or sub-dir)
|
191
|
+
# default: See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::DirectoryRecord
|
192
|
+
|
193
|
+
:latency => 0.5 # Set the delay (**in seconds**) between checking for changes
|
194
|
+
# default: 0.25 sec (1.0 sec for polling)
|
195
|
+
|
196
|
+
:relative_paths => true # Enable the use of relative paths in the callback.
|
197
|
+
# default: false
|
198
|
+
|
199
|
+
:force_polling => true # Force the use of the polling adapter
|
200
|
+
# default: none
|
201
|
+
|
202
|
+
:polling_fallback_message => 'custom message' # Set a custom polling fallback message (or disable it with `false`)
|
203
|
+
# default: "WARNING: Listen fallen back to polling, learn more at https://github.com/guard/listen#fallback."
|
204
|
+
```
|
205
|
+
|
206
|
+
### The patterns for filtering and ignoring paths
|
207
|
+
|
208
|
+
Just like the unix convention of beginning absolute paths with the
|
209
|
+
directory-separator (forward slash `/` in unix) and with no prefix for relative paths,
|
210
|
+
Listen doesn't prefix relative paths (to the watched directory) with a directory-separator.
|
211
|
+
|
212
|
+
Therefore make sure _NOT_ to prefix your regexp-patterns for filtering or ignoring paths
|
213
|
+
with a directory-separator, otherwise they won't work as expected.
|
214
|
+
|
215
|
+
As an example: to ignore the `build` directory in a C-project, use `%r{build/}`
|
216
|
+
and not `%r{/build/}`.
|
217
|
+
|
218
|
+
Use `#filter!` and `#ignore!` methods to overwrites default patterns.
|
219
|
+
|
220
|
+
### Non-blocking listening to changes
|
221
|
+
|
222
|
+
Starting a listener blocks the current thread by default. That means any code after the
|
223
|
+
`start` call won't be run until the listener is stopped (which needs to be done from another thread).
|
224
|
+
|
225
|
+
For advanced usage there is an option to disable this behavior and have the listener start working
|
226
|
+
in the background without blocking. To enable non-blocking listening the `start` method of
|
227
|
+
the listener (be it `Listener` or `MultiListener`) needs to be called with `false` as a parameter.
|
228
|
+
|
229
|
+
Here is an example of using a listener in the non-blocking mode:
|
230
|
+
|
231
|
+
```ruby
|
232
|
+
listener = Listen.to('dir/path/to/listen')
|
233
|
+
listener.start(false) # doesn't block execution
|
234
|
+
|
235
|
+
# Code here will run immediately after starting the listener
|
236
|
+
|
237
|
+
```
|
238
|
+
|
239
|
+
**note**: Using the `Listen.to` helper-method with a callback-block will always
|
240
|
+
block execution. See the "Block API" section for an example.
|
241
|
+
|
242
|
+
## Listen adapters
|
243
|
+
|
244
|
+
The Listen gem has a set of adapters to notify it when there are changes.
|
245
|
+
There are 3 OS-specific adapters to support Mac, Linux, *BSD and Windows. These adapters are fast
|
246
|
+
as they use some system-calls to implement the notifying function.
|
247
|
+
|
248
|
+
There is also a polling adapter which is a cross-platform adapter and it will
|
249
|
+
work on any system. This adapter is unfortunately slower than the rest of the adapters.
|
250
|
+
|
251
|
+
The Listen gem will choose the best and working adapter for your machine automatically. If you
|
252
|
+
want to force the use of the polling adapter, either use the `:force_polling` option
|
253
|
+
while initializing the listener or call the `force_polling` method on your listener
|
254
|
+
before starting it.
|
255
|
+
|
256
|
+
## Polling fallback
|
257
|
+
|
258
|
+
When a OS-specific adapter doesn't work the Listen gem automatically falls back to the polling adapter.
|
259
|
+
Here are some things you could try to avoid the polling fallback:
|
260
|
+
|
261
|
+
* [Update your Dropbox client](http://www.dropbox.com/downloading) (if used).
|
262
|
+
* Increase latency. (Please [open an issue](https://github.com/guard/listen/issues/new) if you think that default is too low.)
|
263
|
+
* Move or rename the listened folder.
|
264
|
+
* Update/reboot your OS.
|
265
|
+
|
266
|
+
If your application keeps using the polling-adapter and you can't figure out why, feel free to [open an issue](https://github.com/guard/listen/issues/new) (and be sure to give all the details).
|
267
|
+
|
268
|
+
## Development [](https://gemnasium.com/guard/listen)
|
269
|
+
|
270
|
+
* Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/listen/master/frames).
|
271
|
+
* Source hosted at [GitHub](https://github.com/guard/listen).
|
272
|
+
|
273
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
274
|
+
|
275
|
+
* Please create a topic branch for every separate change you make.
|
276
|
+
* Make sure your patches are well tested. All specs run with `rake spec:portability` must pass.
|
277
|
+
* Update the [Yard](http://yardoc.org/) documentation.
|
278
|
+
* Update the README.
|
279
|
+
* Update the CHANGELOG for noteworthy changes.
|
280
|
+
* Please **do not change** the version number.
|
281
|
+
|
282
|
+
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
283
|
+
`#guard` (irc.freenode.net).
|
284
|
+
|
285
|
+
## Acknowledgment
|
286
|
+
|
287
|
+
* [Michael Kessler (netzpirat)][] for having written the [initial specs](https://github.com/guard/listen/commit/1e457b13b1bb8a25d2240428ce5ed488bafbed1f).
|
288
|
+
* [Travis Tilley (ttilley)][] for this awesome work on [fssm][] & [rb-fsevent][].
|
289
|
+
* [Nathan Weizenbaum (nex3)][] for [rb-inotify][], a thorough inotify wrapper.
|
290
|
+
* [Mathieu Arnold (mat813)][] for [rb-kqueue][], a simple kqueue wrapper.
|
291
|
+
* [stereobooster][] for [rb-fchange][], windows support wouldn't exist without him.
|
292
|
+
* [Yehuda Katz (wycats)][] for [vigilo][], that has been a great source of inspiration.
|
293
|
+
|
294
|
+
## Authors
|
295
|
+
|
296
|
+
* [Thibaud Guillaume-Gentil][] ([@thibaudgg](http://twitter.com/thibaudgg))
|
297
|
+
* [Maher Sallam][] ([@mahersalam](http://twitter.com/mahersalam))
|
298
|
+
|
299
|
+
## Contributors
|
300
|
+
|
301
|
+
[https://github.com/guard/listen/contributors](https://github.com/guard/listen/contributors)
|
302
|
+
|
303
|
+
[Thibaud Guillaume-Gentil]: https://github.com/thibaudgg
|
304
|
+
[Maher Sallam]: https://github.com/Maher4Ever
|
305
|
+
[Michael Kessler (netzpirat)]: https://github.com/netzpirat
|
306
|
+
[Travis Tilley (ttilley)]: https://github.com/ttilley
|
307
|
+
[fssm]: https://github.com/ttilley/fssm
|
308
|
+
[rb-fsevent]: https://github.com/thibaudgg/rb-fsevent
|
309
|
+
[Mathieu Arnold (mat813)]: https://github.com/mat813
|
310
|
+
[Nathan Weizenbaum (nex3)]: https://github.com/nex3
|
311
|
+
[rb-inotify]: https://github.com/nex3/rb-inotify
|
312
|
+
[stereobooster]: https://github.com/stereobooster
|
313
|
+
[rb-fchange]: https://github.com/stereobooster/rb-fchange
|
314
|
+
[Yehuda Katz (wycats)]: https://github.com/wycats
|
315
|
+
[vigilo]: https://github.com/wycats/vigilo
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
task :default => :spec
|
6
|
+
|
7
|
+
require 'rbconfig'
|
8
|
+
namespace(:spec) do
|
9
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/i
|
10
|
+
desc "Run all specs on multiple ruby versions (requires pik)"
|
11
|
+
task(:portability) do
|
12
|
+
%w[187 192 161].each do |version|
|
13
|
+
system "cmd /c echo -----------#{version}------------ & " +
|
14
|
+
"pik use #{version} & " +
|
15
|
+
"bundle install & " +
|
16
|
+
"bundle exec rspec spec"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
else
|
20
|
+
desc "Run all specs on multiple ruby versions (requires rvm)"
|
21
|
+
task(:portability) do
|
22
|
+
travis_config_file = File.expand_path("../.travis.yml", __FILE__)
|
23
|
+
begin
|
24
|
+
travis_options ||= YAML::load_file(travis_config_file)
|
25
|
+
rescue => ex
|
26
|
+
puts "Travis config file '#{travis_config_file}' could not be found: #{ex.message}"
|
27
|
+
return
|
28
|
+
end
|
29
|
+
|
30
|
+
travis_options['rvm'].each do |version|
|
31
|
+
system <<-BASH
|
32
|
+
bash -c 'source ~/.rvm/scripts/rvm;
|
33
|
+
rvm #{version};
|
34
|
+
ruby_version_string_size=`ruby -v | wc -m`
|
35
|
+
echo;
|
36
|
+
for ((c=1; c<$ruby_version_string_size; c++)); do echo -n "="; done
|
37
|
+
echo;
|
38
|
+
echo "`ruby -v`";
|
39
|
+
for ((c=1; c<$ruby_version_string_size; c++)); do echo -n "="; done
|
40
|
+
echo;
|
41
|
+
RBXOPT="-Xrbc.db" bundle install;
|
42
|
+
RBXOPT="-Xrbc.db" bundle exec rspec spec -f doc 2>&1;'
|
43
|
+
BASH
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant::Config.run do |config|
|
5
|
+
# All Vagrant configuration is done here. The most common configuration
|
6
|
+
# options are documented and commented below. For a complete reference,
|
7
|
+
# please see the online documentation at vagrantup.com.
|
8
|
+
|
9
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
10
|
+
config.vm.box = "lucid32"
|
11
|
+
|
12
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
13
|
+
# doesn't already exist on the user's system.
|
14
|
+
# config.vm.box_url = "http://domain.com/path/to/above.box"
|
15
|
+
|
16
|
+
# Boot with a GUI so you can see the screen. (Default is headless)
|
17
|
+
# config.vm.boot_mode = :gui
|
18
|
+
|
19
|
+
# Assign this VM to a host-only network IP, allowing you to access it
|
20
|
+
# via the IP. Host-only networks can talk to the host machine as well as
|
21
|
+
# any other machines on the same network, but cannot be accessed (through this
|
22
|
+
# network interface) by any external networks.
|
23
|
+
# config.vm.network :hostonly, "33.33.33.10"
|
24
|
+
|
25
|
+
# Assign this VM to a bridged network, allowing you to connect directly to a
|
26
|
+
# network using the host's network device. This makes the VM appear as another
|
27
|
+
# physical device on your network.
|
28
|
+
# config.vm.network :bridged
|
29
|
+
|
30
|
+
# Forward a port from the guest to the host, which allows for outside
|
31
|
+
# computers to access the VM, whereas host only networking does not.
|
32
|
+
# config.vm.forward_port 80, 8080
|
33
|
+
|
34
|
+
# Share an additional folder to the guest VM. The first argument is
|
35
|
+
# an identifier, the second is the path on the guest to mount the
|
36
|
+
# folder, and the third is the path on the host to the actual folder.
|
37
|
+
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
|
38
|
+
|
39
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
40
|
+
# are contained in a directory path relative to this Vagrantfile.
|
41
|
+
# You will need to create the manifests directory and a manifest in
|
42
|
+
# the file lucid32.pp in the manifests_path directory.
|
43
|
+
#
|
44
|
+
# An example Puppet manifest to provision the message of the day:
|
45
|
+
#
|
46
|
+
# # group { "puppet":
|
47
|
+
# # ensure => "present",
|
48
|
+
# # }
|
49
|
+
# #
|
50
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
51
|
+
# #
|
52
|
+
# # file { '/etc/motd':
|
53
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
54
|
+
# # Managed by Puppet.\n"
|
55
|
+
# # }
|
56
|
+
#
|
57
|
+
# config.vm.provision :puppet do |puppet|
|
58
|
+
# puppet.manifests_path = "manifests"
|
59
|
+
# puppet.manifest_file = "lucid32.pp"
|
60
|
+
# end
|
61
|
+
|
62
|
+
# Enable provisioning with chef solo, specifying a cookbooks path (relative
|
63
|
+
# to this Vagrantfile), and adding some recipes and/or roles.
|
64
|
+
#
|
65
|
+
# config.vm.provision :chef_solo do |chef|
|
66
|
+
# chef.cookbooks_path = "cookbooks"
|
67
|
+
# chef.add_recipe "mysql"
|
68
|
+
# chef.add_role "web"
|
69
|
+
#
|
70
|
+
# # You may also specify custom JSON attributes:
|
71
|
+
# chef.json = { :mysql_password => "foo" }
|
72
|
+
# end
|
73
|
+
|
74
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
75
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
76
|
+
#
|
77
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
78
|
+
# ORGNAME in the URL and validation key.
|
79
|
+
#
|
80
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
81
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
82
|
+
# validation key to validation.pem.
|
83
|
+
#
|
84
|
+
# config.vm.provision :chef_client do |chef|
|
85
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
86
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
87
|
+
# end
|
88
|
+
#
|
89
|
+
# If you're using the Opscode platform, your validator client is
|
90
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
91
|
+
#
|
92
|
+
# IF you have your own Chef Server, the default validation client name is
|
93
|
+
# chef-validator, unless you changed the configuration.
|
94
|
+
#
|
95
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
96
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
require 'thread'
|
3
|
+
require 'set'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Listen
|
7
|
+
class Adapter
|
8
|
+
attr_accessor :directories, :latency, :paused
|
9
|
+
|
10
|
+
# The default delay between checking for changes.
|
11
|
+
DEFAULT_LATENCY = 0.25
|
12
|
+
|
13
|
+
# The default warning message when there is a missing dependency.
|
14
|
+
MISSING_DEPENDENCY_MESSAGE = <<-EOS.gsub(/^\s*/, '')
|
15
|
+
For a better performance, it's recommended that you satisfy the missing dependency.
|
16
|
+
EOS
|
17
|
+
|
18
|
+
# The default warning message when falling back to polling adapter.
|
19
|
+
POLLING_FALLBACK_MESSAGE = <<-EOS.gsub(/^\s*/, '')
|
20
|
+
Listen will be polling changes. Learn more at https://github.com/guard/listen#polling-fallback.
|
21
|
+
EOS
|
22
|
+
|
23
|
+
# Selects the appropriate adapter implementation for the
|
24
|
+
# current OS and initializes it.
|
25
|
+
#
|
26
|
+
# @param [String, Array<String>] directories the directories to watch
|
27
|
+
# @param [Hash] options the adapter options
|
28
|
+
# @option options [Boolean] force_polling to force polling or not
|
29
|
+
# @option options [String, Boolean] polling_fallback_message to change polling fallback message or remove it
|
30
|
+
# @option options [Float] latency the delay between checking for changes in seconds
|
31
|
+
#
|
32
|
+
# @yield [changed_dirs, options] callback Callback called when a change happens
|
33
|
+
# @yieldparam [Array<String>] changed_dirs the changed directories
|
34
|
+
# @yieldparam [Hash] options callback options (like :recursive => true)
|
35
|
+
#
|
36
|
+
# @return [Listen::Adapter] the chosen adapter
|
37
|
+
#
|
38
|
+
def self.select_and_initialize(directories, options = {}, &callback)
|
39
|
+
return Adapters::Polling.new(directories, options, &callback) if options.delete(:force_polling)
|
40
|
+
|
41
|
+
warning = ''
|
42
|
+
|
43
|
+
begin
|
44
|
+
if Adapters::Darwin.usable_and_works?(directories, options)
|
45
|
+
return Adapters::Darwin.new(directories, options, &callback)
|
46
|
+
elsif Adapters::Linux.usable_and_works?(directories, options)
|
47
|
+
return Adapters::Linux.new(directories, options, &callback)
|
48
|
+
elsif Adapters::BSD.usable_and_works?(directories, options)
|
49
|
+
return Adapters::BSD.new(directories, options, &callback)
|
50
|
+
elsif Adapters::Windows.usable_and_works?(directories, options)
|
51
|
+
return Adapters::Windows.new(directories, options, &callback)
|
52
|
+
end
|
53
|
+
rescue DependencyManager::Error => e
|
54
|
+
warning += e.message + "\n" + MISSING_DEPENDENCY_MESSAGE
|
55
|
+
end
|
56
|
+
|
57
|
+
unless options[:polling_fallback_message] == false
|
58
|
+
warning += options[:polling_fallback_message] || POLLING_FALLBACK_MESSAGE
|
59
|
+
Kernel.warn "[Listen warning]:\n" + warning.gsub(/^(.*)/, ' \1')
|
60
|
+
end
|
61
|
+
|
62
|
+
Adapters::Polling.new(directories, options, &callback)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Initializes the adapter.
|
66
|
+
#
|
67
|
+
# @param [String, Array<String>] directories the directories to watch
|
68
|
+
# @param [Hash] options the adapter options
|
69
|
+
# @option options [Float] latency the delay between checking for changes in seconds
|
70
|
+
# @option options [Boolean] report_changes whether or not to automatically report changes (run the callback)
|
71
|
+
#
|
72
|
+
# @yield [changed_dirs, options] callback Callback called when a change happens
|
73
|
+
# @yieldparam [Array<String>] changed_dirs the changed directories
|
74
|
+
# @yieldparam [Hash] options callback options (like :recursive => true)
|
75
|
+
#
|
76
|
+
# @return [Listen::Adapter] the adapter
|
77
|
+
#
|
78
|
+
def initialize(directories, options = {}, &callback)
|
79
|
+
@directories = Array(directories)
|
80
|
+
@callback = callback
|
81
|
+
@paused = false
|
82
|
+
@mutex = Mutex.new
|
83
|
+
@changed_dirs = Set.new
|
84
|
+
@turnstile = Turnstile.new
|
85
|
+
@latency ||= DEFAULT_LATENCY
|
86
|
+
@latency = options[:latency] if options[:latency]
|
87
|
+
@report_changes = options[:report_changes].nil? ? true : options[:report_changes]
|
88
|
+
end
|
89
|
+
|
90
|
+
# Starts the adapter.
|
91
|
+
#
|
92
|
+
# @param [Boolean] blocking whether or not to block the current thread after starting
|
93
|
+
#
|
94
|
+
def start(blocking = true)
|
95
|
+
@stop = false
|
96
|
+
end
|
97
|
+
|
98
|
+
# Stops the adapter.
|
99
|
+
#
|
100
|
+
def stop
|
101
|
+
@stop = true
|
102
|
+
@turnstile.signal # ensure no thread is blocked
|
103
|
+
end
|
104
|
+
|
105
|
+
# Returns whether the adapter is statred or not
|
106
|
+
#
|
107
|
+
# @return [Boolean] whether the adapter is started or not
|
108
|
+
#
|
109
|
+
def started?
|
110
|
+
@stop.nil? ? false : !@stop
|
111
|
+
end
|
112
|
+
|
113
|
+
# Blocks the main thread until the poll thread
|
114
|
+
# runs the callback.
|
115
|
+
#
|
116
|
+
def wait_for_callback
|
117
|
+
@turnstile.wait unless @paused
|
118
|
+
end
|
119
|
+
|
120
|
+
# Blocks the main thread until N changes are
|
121
|
+
# detected.
|
122
|
+
#
|
123
|
+
def wait_for_changes(goal = 0)
|
124
|
+
changes = 0
|
125
|
+
|
126
|
+
loop do
|
127
|
+
@mutex.synchronize { changes = @changed_dirs.size }
|
128
|
+
|
129
|
+
return if @paused || @stop
|
130
|
+
return if changes >= goal
|
131
|
+
|
132
|
+
sleep(@latency)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# Checks if the adapter is usable on the current OS.
|
137
|
+
#
|
138
|
+
# @return [Boolean] whether usable or not
|
139
|
+
#
|
140
|
+
def self.usable?
|
141
|
+
load_depenencies
|
142
|
+
dependencies_loaded?
|
143
|
+
end
|
144
|
+
|
145
|
+
# Checks if the adapter is usable and works on the current OS.
|
146
|
+
#
|
147
|
+
# @param [String, Array<String>] directories the directories to watch
|
148
|
+
# @param [Hash] options the adapter options
|
149
|
+
# @option options [Float] latency the delay between checking for changes in seconds
|
150
|
+
#
|
151
|
+
# @return [Boolean] whether usable and work or not
|
152
|
+
#
|
153
|
+
def self.usable_and_works?(directories, options = {})
|
154
|
+
usable? && Array(directories).all? { |d| works?(d, options) }
|
155
|
+
end
|
156
|
+
|
157
|
+
# Runs a tests to determine if the adapter can actually pick up
|
158
|
+
# changes in a given directory and returns the result.
|
159
|
+
#
|
160
|
+
# @note This test takes some time depending the adapter latency.
|
161
|
+
#
|
162
|
+
# @param [String, Pathname] directory the directory to watch
|
163
|
+
# @param [Hash] options the adapter options
|
164
|
+
# @option options [Float] latency the delay between checking for changes in seconds
|
165
|
+
#
|
166
|
+
# @return [Boolean] whether the adapter works or not
|
167
|
+
#
|
168
|
+
def self.works?(directory, options = {})
|
169
|
+
work = false
|
170
|
+
test_file = "#{directory}/.listen_test"
|
171
|
+
callback = lambda { |*| work = true }
|
172
|
+
adapter = self.new(directory, options, &callback)
|
173
|
+
adapter.start(false)
|
174
|
+
|
175
|
+
FileUtils.touch(test_file)
|
176
|
+
|
177
|
+
t = Thread.new { sleep(adapter.latency * 5); adapter.stop }
|
178
|
+
|
179
|
+
adapter.wait_for_callback
|
180
|
+
work
|
181
|
+
ensure
|
182
|
+
Thread.kill(t) if t
|
183
|
+
FileUtils.rm(test_file) if File.exists?(test_file)
|
184
|
+
adapter.stop if adapter && adapter.started?
|
185
|
+
end
|
186
|
+
|
187
|
+
# Runs the callback and passes it the changes if there are any.
|
188
|
+
#
|
189
|
+
def report_changes
|
190
|
+
changed_dirs = nil
|
191
|
+
|
192
|
+
@mutex.synchronize do
|
193
|
+
return if @changed_dirs.empty?
|
194
|
+
changed_dirs = @changed_dirs.to_a
|
195
|
+
@changed_dirs.clear
|
196
|
+
end
|
197
|
+
|
198
|
+
@callback.call(changed_dirs, {})
|
199
|
+
@turnstile.signal
|
200
|
+
end
|
201
|
+
|
202
|
+
private
|
203
|
+
|
204
|
+
# Polls changed directories and reports them back
|
205
|
+
# when there are changes.
|
206
|
+
#
|
207
|
+
def poll_changed_dirs
|
208
|
+
until @stop
|
209
|
+
sleep(@latency)
|
210
|
+
report_changes
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|