piko-safe-hub 0.0.1

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.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/listen-3.10.0/CHANGELOG.md +1 -0
  3. data/listen-3.10.0/CONTRIBUTING.md +45 -0
  4. data/listen-3.10.0/LICENSE.txt +22 -0
  5. data/listen-3.10.0/README.md +490 -0
  6. data/listen-3.10.0/bin/listen +11 -0
  7. data/listen-3.10.0/lib/listen/adapter/base.rb +129 -0
  8. data/listen-3.10.0/lib/listen/adapter/bsd.rb +104 -0
  9. data/listen-3.10.0/lib/listen/adapter/config.rb +31 -0
  10. data/listen-3.10.0/lib/listen/adapter/darwin.rb +77 -0
  11. data/listen-3.10.0/lib/listen/adapter/linux.rb +108 -0
  12. data/listen-3.10.0/lib/listen/adapter/polling.rb +40 -0
  13. data/listen-3.10.0/lib/listen/adapter/windows.rb +96 -0
  14. data/listen-3.10.0/lib/listen/adapter.rb +43 -0
  15. data/listen-3.10.0/lib/listen/backend.rb +40 -0
  16. data/listen-3.10.0/lib/listen/change.rb +69 -0
  17. data/listen-3.10.0/lib/listen/cli.rb +65 -0
  18. data/listen-3.10.0/lib/listen/directory.rb +93 -0
  19. data/listen-3.10.0/lib/listen/error.rb +11 -0
  20. data/listen-3.10.0/lib/listen/event/config.rb +39 -0
  21. data/listen-3.10.0/lib/listen/event/loop.rb +92 -0
  22. data/listen-3.10.0/lib/listen/event/processor.rb +128 -0
  23. data/listen-3.10.0/lib/listen/event/queue.rb +52 -0
  24. data/listen-3.10.0/lib/listen/file.rb +95 -0
  25. data/listen-3.10.0/lib/listen/fsm.rb +131 -0
  26. data/listen-3.10.0/lib/listen/listener/config.rb +41 -0
  27. data/listen-3.10.0/lib/listen/listener.rb +136 -0
  28. data/listen-3.10.0/lib/listen/logger.rb +65 -0
  29. data/listen-3.10.0/lib/listen/monotonic_time.rb +27 -0
  30. data/listen-3.10.0/lib/listen/options.rb +24 -0
  31. data/listen-3.10.0/lib/listen/queue_optimizer.rb +129 -0
  32. data/listen-3.10.0/lib/listen/record/entry.rb +66 -0
  33. data/listen-3.10.0/lib/listen/record/symlink_detector.rb +47 -0
  34. data/listen-3.10.0/lib/listen/record.rb +122 -0
  35. data/listen-3.10.0/lib/listen/silencer/controller.rb +50 -0
  36. data/listen-3.10.0/lib/listen/silencer.rb +106 -0
  37. data/listen-3.10.0/lib/listen/thread.rb +54 -0
  38. data/listen-3.10.0/lib/listen/version.rb +5 -0
  39. data/listen-3.10.0/lib/listen.rb +47 -0
  40. data/piko-safe-hub.gemspec +12 -0
  41. metadata +80 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fd3a87981974178f4e2e381c512058297ad027c5e6188abb955484d99928da4e
4
+ data.tar.gz: e9158bc55f9f222d441ec3801d1bb8eccbb9a7dd5f30afde1c00bc440b7b03f4
5
+ SHA512:
6
+ metadata.gz: d5b22dd6eb2d9d39479a0b4be3800c0377073557a75e78c66a7bece6a00e2397a6f1fce081f3627168a47a35efa36b072906a1f64444ba1763caed1e04db5a20
7
+ data.tar.gz: a0e6041a8ac9833f62501c08175c6ff4dd2e4d45dd5fcb3c8e659ac4e09b17630c5245fa82bf6e865029a781d2fbaa2406d4b1ef0f7c9764274864bc193c8215
@@ -0,0 +1 @@
1
+ # Moved to [GitHub releases](https://github.com/guard/listen/releases) page.
@@ -0,0 +1,45 @@
1
+ Contribute to Listen
2
+ ===================
3
+
4
+ File an issue
5
+ -------------
6
+
7
+ If you haven't already, first see [TROUBLESHOOTING](https://github.com/guard/listen/blob/master/README.md#Issues-and-Troubleshooting) for known issues, solutions and workarounds.
8
+
9
+ You can report bugs and feature requests to [GitHub Issues](https://github.com/guard/listen/issues).
10
+
11
+ **Please don't ask question in the issue tracker**, instead ask them in our
12
+ [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
13
+
14
+ Try to figure out where the issue belongs to: Is it an issue with Listen itself or with Guard?
15
+
16
+
17
+ **It's most likely that your bug gets resolved faster if you provide as much information as possible!**
18
+
19
+ The MOST useful information is debugging output from Listen (`LISTEN_GEM_DEBUGGING=1`) - see [TROUBLESHOOTING](https://github.com/guard/listen/blob/master/README.md#Issues-and-Troubleshooting) for details.
20
+
21
+
22
+ Development
23
+ -----------
24
+
25
+ * Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/listen/master/frames).
26
+ * Source hosted at [GitHub](https://github.com/guard/listen).
27
+
28
+ Pull requests are very welcome! Please try to follow these simple rules if applicable:
29
+
30
+ * Please create a topic branch for every separate change you make.
31
+ * Make sure your patches are well tested. All specs run with `rake spec` must pass.
32
+ * Update the [Yard](http://yardoc.org/) documentation.
33
+ * Update the [README](https://github.com/guard/listen/blob/master/README.md).
34
+ * Please **do not change** the version number.
35
+
36
+ The title of your PR will automatically be included in the release notes for the next version of the gem. A maintainer can add one of the following GitHub labels to the PR to automatically categorize it when the release notes are generated:
37
+
38
+ - ⚠️ Breaking
39
+ - ✨ Feature
40
+ - 🐛 Bug Fix
41
+ - 📚 Docs
42
+ - 🏠 Housekeeping
43
+
44
+ For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
45
+ `#guard` (irc.freenode.net).
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Thibaud Guillaume-Gentil
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,490 @@
1
+ # Listen
2
+
3
+ The `listen` gem listens to file modifications and notifies you about the changes.
4
+
5
+ [![Development Status](https://github.com/guard/listen/workflows/Development/badge.svg)](https://github.com/guard/listen/actions?workflow=Development)
6
+ [![Gem Version](https://badge.fury.io/rb/listen.svg)](http://badge.fury.io/rb/listen)
7
+ [![Code Climate](https://codeclimate.com/github/guard/listen.svg)](https://codeclimate.com/github/guard/listen)
8
+ [![Coverage Status](https://coveralls.io/repos/guard/listen/badge.svg?branch=master)](https://coveralls.io/r/guard/listen)
9
+
10
+ ## Features
11
+
12
+ * OS-optimized adapters on MRI for Mac OS X 10.6+, Linux, \*BSD and Windows, [more info](#listen-adapters) below.
13
+ * Detects file modification, addition and removal.
14
+ * You can watch multiple directories.
15
+ * Regexp-patterns for ignoring paths for more accuracy and speed
16
+ * Increased change detection accuracy on OS X HFS and VFAT volumes.
17
+ * Continuous Integration: tested on selected Ruby environments via [Github Workflows](https://github.com/guard/listen/tree/master/.github/workflows).
18
+
19
+ ## Issues / limitations
20
+
21
+ * Limited support for symlinked directories ([#279](https://github.com/guard/listen/issues/279)):
22
+ * Symlinks are always followed ([#25](https://github.com/guard/listen/issues/25)).
23
+ * Symlinked directories pointing within a watched directory are not supported ([#273](https://github.com/guard/listen/pull/273).
24
+ * No directory/adapter-specific configuration options.
25
+ * Support for plugins planned for future.
26
+ * TCP functionality was removed in `listen` [3.0.0](https://github.com/guard/listen/releases/tag/v3.0.0) ([#319](https://github.com/guard/listen/issues/319), [#218](https://github.com/guard/listen/issues/218)). There are plans to extract this feature to separate gems ([#258](https://github.com/guard/listen/issues/258)), until this is finished, you can use by locking the `listen` gem to version `'~> 2.10'`.
27
+ * Some filesystems won't work without polling (VM/Vagrant Shared folders, NFS, Samba, sshfs, etc.).
28
+ * Windows and \*BSD adapter aren't continuously and automatically tested.
29
+ * OSX adapter has some performance limitations ([#342](https://github.com/guard/listen/issues/342)).
30
+ * Listeners do not notify across forked processes, if you wish for multiple processes to receive change notifications you must [listen inside of each process](https://github.com/guard/listen/issues/398#issuecomment-223957952).
31
+
32
+ Pull requests or help is very welcome for these.
33
+
34
+ ## Install
35
+
36
+ The simplest way to install `listen` is to use [Bundler](http://bundler.io).
37
+
38
+ ```ruby
39
+ gem 'listen'
40
+ ```
41
+
42
+ ## Complete Example
43
+ Here is a complete example of using the `listen` gem:
44
+ ```ruby
45
+ require 'listen'
46
+
47
+ listener = Listen.to('/srv/app') do |modified, added, removed|
48
+ puts(modified: modified, added: added, removed: removed)
49
+ end
50
+ listener.start
51
+ sleep
52
+ ```
53
+ Running the above in the background, you can see the callback block being called in response to each command:
54
+ ```
55
+ $ cd /srv/app
56
+ $ touch a.txt
57
+ {:modified=>[], :added=>["/srv/app/a.txt"], :removed=>[]}
58
+
59
+ $ echo more >> a.txt
60
+ {:modified=>["/srv/app/a.txt"], :added=>[], :removed=>[]}
61
+
62
+ $ mv a.txt b.txt
63
+ {:modified=>[], :added=>["/srv/app/b.txt"], :removed=>["/srv/app/a.txt"]}
64
+
65
+ $ vi b.txt
66
+ # add a line to this new file and press ZZ to save and exit
67
+ {:modified=>["/srv/app/b.txt"], :added=>[], :removed=>[]}
68
+
69
+ $ vi c.txt
70
+ # add a line and press ZZ to save and exit
71
+ {:modified=>[], :added=>["/srv/app/c.txt"], :removed=>[]}
72
+
73
+ $ rm b.txt c.txt
74
+ {:modified=>[], :added=>[], :removed=>["/srv/app/b.txt", "/srv/app/c.txt"]}
75
+ ```
76
+
77
+ ## Usage
78
+
79
+ Call `Listen.to` with one or more directories and the "changes" callback passed as a block.
80
+
81
+ ``` ruby
82
+ listener = Listen.to('dir/to/listen', 'dir/to/listen2') do |modified, added, removed|
83
+ puts "modified absolute path array: #{modified}"
84
+ puts "added absolute path array: #{added}"
85
+ puts "removed absolute path array: #{removed}"
86
+ end
87
+ listener.start # starts a listener thread--does not block
88
+
89
+ # do whatever you want here...just don't exit the process :)
90
+
91
+ sleep
92
+ ```
93
+ ## Changes Callback
94
+
95
+ Changes to the listened-to directories are reported by the listener thread in a callback.
96
+ The callback receives **three** array parameters: `modified`, `added` and `removed`, in that order.
97
+ Each of these three is always an array with 0 or more entries.
98
+ Each array entry is an absolute path.
99
+
100
+ ### Pause / start / stop
101
+
102
+ Listeners can also be easily paused and later un-paused with start:
103
+
104
+ ``` ruby
105
+ listener = Listen.to('dir/path/to/listen') { |modified, added, removed| puts 'handle changes here...' }
106
+
107
+ listener.start
108
+ listener.paused? # => false
109
+ listener.processing? # => true
110
+
111
+ listener.pause # stops processing changes (but keeps on collecting them)
112
+ listener.paused? # => true
113
+ listener.processing? # => false
114
+
115
+ listener.start # resumes processing changes
116
+ listener.stop # stop both listening to changes and processing them
117
+ ```
118
+
119
+ Note: While paused, `listen` keeps on collecting changes in the background - to clear them, call `stop`.
120
+
121
+ Note: You should keep track of all started listeners and `stop` them properly on finish.
122
+
123
+ ### Ignore / ignore!
124
+
125
+ `Listen` ignores some directories and extensions by default (See DEFAULT_IGNORED_FILES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer).
126
+ You can add ignoring patterns with the `ignore` option/method or overwrite default with `ignore!` option/method.
127
+
128
+ ``` ruby
129
+ listener = Listen.to('dir/path/to/listen', ignore: /\.txt/) { |modified, added, removed| # ... }
130
+ listener.start
131
+ listener.ignore! /\.pkg/ # overwrite all patterns and only ignore pkg extension.
132
+ listener.ignore /\.rb/ # ignore rb extension in addition of pkg.
133
+ sleep
134
+ ```
135
+
136
+ Note: `:ignore` regexp patterns are evaluated against relative paths.
137
+
138
+ Note: Ignoring paths does not improve performance, except when Polling ([#274](https://github.com/guard/listen/issues/274)).
139
+
140
+ ### Only
141
+
142
+ `Listen` watches all files (less the ignored ones) by default. If you want to only listen to a specific type of file (i.e., just `.rb` extension), you should use the `only` option/method.
143
+
144
+ ``` ruby
145
+ listener = Listen.to('dir/path/to/listen', only: /\.rb$/) { |modified, added, removed| # ... }
146
+ listener.start
147
+ listener.only /_spec\.rb$/ # overwrite all existing only patterns.
148
+ sleep
149
+ ```
150
+
151
+ Note: `:only` regexp patterns are evaluated only against relative **file** paths.
152
+
153
+
154
+ ## Options
155
+
156
+ All the following options can be set through the `Listen.to` after the directory path(s) params.
157
+
158
+ ``` ruby
159
+ ignore: [%r{/foo/bar}, /\.pid$/, /\.coffee$/] # Ignore a list of paths
160
+ # default: See DEFAULT_IGNORED_FILES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer
161
+
162
+ ignore!: %r{/foo/bar} # Same as ignore options, but overwrite default ignored paths.
163
+
164
+ only: %r{.rb$} # Only listen to specific files
165
+ # default: none
166
+
167
+ latency: 0.5 # Set the delay (**in seconds**) between checking for changes
168
+ # default: 0.25 sec (1.0 sec for polling)
169
+
170
+ wait_for_delay: 4 # Set the delay (**in seconds**) between calls to the callback when changes exist
171
+ # default: 0.10 sec
172
+
173
+ force_polling: true # Force the use of the polling adapter
174
+ # default: none
175
+
176
+ relative: false # Whether changes should be relative to current dir or not
177
+ # default: false
178
+
179
+ polling_fallback_message: 'custom message' # Set a custom polling fallback message (or disable it with false)
180
+ # default: "Listen will be polling for changes. Learn more at https://github.com/guard/listen#listen-adapters."
181
+ ```
182
+
183
+ ## Logging and Debugging
184
+
185
+ `Listen` logs its activity to `Listen.logger`.
186
+ This is the primary method of debugging.
187
+
188
+ ### Custom Logger
189
+ You can call `Listen.logger =` to set a custom `listen` logger for the process. For example:
190
+ ``` ruby
191
+ Listen.logger = Rails.logger
192
+ ```
193
+
194
+ ### Default Logger
195
+ If no custom logger is set, a default `listen` logger which logs to to `STDERR` will be created and assigned to `Listen.logger`.
196
+
197
+ The default logger defaults to the `error` logging level (severity).
198
+ You can override the logging level by setting the environment variable `LISTEN_GEM_DEBUGGING=<level>`.
199
+ For `<level>`, all standard `::Logger` levels are supported, with any mix of upper-/lower-case:
200
+ ``` ruby
201
+ export LISTEN_GEM_DEBUGGING=debug # or 2 [deprecated]
202
+ export LISTEN_GEM_DEBUGGING=info # or 1 or true or yes [deprecated]
203
+ export LISTEN_GEM_DEBUGGING=warn
204
+ export LISTEN_GEM_DEBUGGING=fatal
205
+ export LISTEN_GEM_DEBUGGING=error
206
+ ```
207
+ The default of `error` will be used if an unsupported value is set.
208
+
209
+ Note: The alternate values `1`, `2`, `true` and `yes` shown above are deprecated and will be removed from `listen` v4.0.
210
+
211
+ ### Disabling Logging
212
+ If you want to disable `listen` logging, set
213
+ ``` ruby
214
+ Listen.logger = ::Logger.new('/dev/null')
215
+ ```
216
+
217
+ ### Adapter Warnings
218
+ If listen is having trouble with the underlying adapter, it will display warnings with `Kernel#warn` by default,
219
+ which in turn writes to STDERR.
220
+ Sometimes this is not desirable, for example in an environment where STDERR is ignored.
221
+ For these reasons, the behavior can be configured using `Listen.adapter_warn_behavior =`:
222
+ ``` ruby
223
+ Listen.adapter_warn_behavior = :warn # default (true means the same)
224
+ Listen.adapter_warn_behavior = :log # send to logger.warn
225
+ Listen.adapter_warn_behavior = :silent # suppress all adapter warnings (nil or false mean the same)
226
+ ```
227
+ Also there are some cases where specific warnings are not helpful.
228
+ For example, if you are using the polling adapter--and expect to--you can suppress the warning about it
229
+ by providing a callable object like a lambda or proc that determines the behavior based on the `message`:
230
+ ``` ruby
231
+ Listen.adapter_warn_behavior = ->(message) do
232
+ case message
233
+ when /Listen will be polling for changes/
234
+ :silent
235
+ when /directory is already being watched/
236
+ :log
237
+ else
238
+ :warn
239
+ end
240
+ end
241
+ ```
242
+ In cases where the `Listen` gem is embedded inside another service--such as `guard`--the above configuration
243
+ can be set in the environment variable `LISTEN_GEM_ADAPTER_WARN_BEHAVIOR=warn|log|silent`.
244
+
245
+ ## Listen Adapters
246
+
247
+ The `Listen` gem has a set of adapters to notify it when there are changes.
248
+
249
+ There are 4 OS-specific adapters to support Darwin, Linux, \*BSD and Windows.
250
+ These adapters are fast as they use some system-calls to implement the notifying function.
251
+
252
+ There is also a polling adapter - although it's much slower than other adapters,
253
+ it works on every platform/system and scenario (including network filesystems such as VM shared folders).
254
+
255
+ The Darwin and Linux adapters are dependencies of the `listen` gem so they work out of the box. For other adapters a specific gem will have to be added to your Gemfile, please read below.
256
+
257
+ The `listen` gem will choose the best adapter automatically, if present. If you
258
+ want to force the use of the polling adapter, use the `:force_polling` option
259
+ while initializing the listener.
260
+
261
+ ### On Windows
262
+
263
+ If you are on Windows, it's recommended to use the [`wdm`](https://github.com/Maher4Ever/wdm) adapter instead of polling.
264
+
265
+ Please add the following to your Gemfile:
266
+
267
+ ```ruby
268
+ gem 'wdm', '>= 0.1.0'
269
+ ```
270
+
271
+ ### On \*BSD
272
+
273
+ If you are on \*BSD you can try to use the [`rb-kqueue`](https://github.com/mat813/rb-kqueue) adapter instead of polling.
274
+
275
+ Please add the following to your Gemfile:
276
+
277
+ ```ruby
278
+ gem 'rb-kqueue', '>= 0.2'
279
+ ```
280
+
281
+ ### Getting the [polling fallback message](#options)?
282
+
283
+ If you see:
284
+ ```
285
+ Listen will be polling for changes.
286
+ ```
287
+
288
+ This means the Listen gem can’t find an optimized adapter. Typically this is caused by:
289
+
290
+ - You’re on Windows and WDM gem isn’t installed.
291
+ - You’re running the app without Bundler or RubyGems.
292
+ - Using Sass which includes an ancient (the “dinosaur” type of ancient) version of the Listen gem.
293
+
294
+ Possible solutions:
295
+
296
+ 1. Suppress the message by using the :force_polling option. Or, you could just ignore the message since it’s harmless.
297
+ 2. Windows users: Install the WDM gem.
298
+ 3. Upgrade Ruby (use RubyInstaller for Windows or RVM/rbenv for Mac) and RubyGems.
299
+ 3. Run your apps using Bundler.
300
+ 4. Sass users: Install the latest version of Listen and try again.
301
+
302
+ #### Simplified Bundler and Sass example
303
+ Create a Gemfile with these lines:
304
+ ```
305
+ source 'https://rubygems.org'
306
+ gem 'listen'
307
+ gem 'sass'
308
+ ```
309
+ Next, use Bundler to update gems:
310
+ ```
311
+ $ bundle update
312
+ $ bundle exec sass --watch # ... or whatever app is using Listen.
313
+ ```
314
+
315
+ ### Increasing the amount of inotify watchers
316
+
317
+ If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:
318
+ ```
319
+ $ sudo sh -c "echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf"
320
+ $ sudo sysctl -p
321
+ ```
322
+ If you are running ArchLinux, search the `/etc/sysctl.d/` directory for config files with the setting:
323
+ ```
324
+ $ grep -H -s "fs.inotify.max_user_watches" /etc/sysctl.d/*
325
+ /etc/sysctl.d/40-max_user_watches.conf:fs.inotify.max_user_watches=100000
326
+ ```
327
+ Then change the setting in the file you found above to a higher value (see [here](https://www.archlinux.org/news/deprecation-of-etcsysctlconf/) for why):
328
+ ```
329
+ $ sudo sh -c "echo fs.inotify.max_user_watches=524288 > /etc/sysctl.d/40-max-user-watches.conf"
330
+ $ sudo sysctl --system
331
+ ```
332
+
333
+ #### The technical details
334
+ Listen uses `inotify` by default on Linux to monitor directories for changes.
335
+ It's not uncommon to encounter a system limit on the number of files you can monitor.
336
+ For example, Ubuntu Lucid's (64bit) `inotify` limit is set to 8192.
337
+
338
+ You can get your current inotify file watch limit by executing:
339
+ ```
340
+ $ cat /proc/sys/fs/inotify/max_user_watches
341
+ ```
342
+ When this limit is not enough to monitor all files inside a directory, the limit must be increased for Listen to work properly.
343
+
344
+ You can set a new limit temporarily with:
345
+ ```
346
+ $ sudo sysctl fs.inotify.max_user_watches=524288
347
+ $ sudo sysctl -p
348
+ ```
349
+ If you like to make your limit permanent, use:
350
+ ```
351
+ $ sudo sh -c "echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf"
352
+ $ sudo sysctl -p
353
+ ```
354
+ You may also need to pay attention to the values of `max_queued_events` and `max_user_instances` if Listen keeps on complaining.
355
+
356
+ While 524,288 is the maximum number of files that can be watched. Each file watch [takes up 1,080 bytes](https://stackoverflow.com/a/7091897/1156119) on a 64-bit system, so assuming that all 524,288 watches are consumed, that allocates around 540 MiB.
357
+ If you're in an environment that is particularly memory-constrained, consider to specify a lower number.
358
+
359
+ #### More info
360
+ Man page for [inotify(7)](https://linux.die.net/man/7/inotify).
361
+ Blog post: [limit of inotify](https://blog.sorah.jp/2012/01/24/inotify-limitation).
362
+
363
+ ### Issues and Troubleshooting
364
+
365
+ If the gem doesn't work as expected, start by setting `LISTEN_GEM_DEBUGGING=debug` or `LISTEN_GEM_DEBUGGING=info` as described above in [Logging and Debugging](#logging-and-debugging).
366
+
367
+ *NOTE: without providing the output after setting the `LISTEN_GEM_DEBUGGING=debug` environment variable, it is usually impossible to guess why `listen` is not working as expected.*
368
+
369
+ #### 3 steps before you start diagnosing problems
370
+ These 3 steps will:
371
+
372
+ - help quickly troubleshoot obscure problems (trust me, most of them are obscure)
373
+ - help quickly identify the area of the problem (a full list is below)
374
+ - help you get familiar with listen's diagnostic mode (it really comes in handy, trust me)
375
+ - help you create relevant output before you submit an issue (so we can respond with answers instead of tons of questions)
376
+
377
+ Step 1 - The most important option in Listen
378
+ For effective troubleshooting set the `LISTEN_GEM_DEBUGGING=info` variable before starting `listen`.
379
+
380
+ Step 2 - Verify polling works
381
+ Polling has to work ... or something is really wrong (and we need to know that before anything else).
382
+
383
+ (see force_polling option).
384
+
385
+ After starting `listen`, you should see something like:
386
+ ```
387
+ INFO -- : Record.build(): 0.06773114204406738 seconds
388
+ ```
389
+ Step 3 - Trigger some changes directly without using editors or apps
390
+ Make changes e.g. touch foo or echo "a" >> foo (for troubleshooting, avoid using an editor which could generate too many misleading events).
391
+
392
+ You should see something like:
393
+ ```
394
+ INFO -- : listen: raw changes: [[:added, "/home/me/foo"]]
395
+ INFO -- : listen: final changes: {:modified=>[], :added=>["/home/me/foo"], :removed=>[]}
396
+ ```
397
+ "raw changes" contains changes collected during the :wait_for_delay and :latency intervals, while "final changes" is what listen decided are relevant changes (for better editor support).
398
+
399
+ ## Performance
400
+
401
+ If `listen` seems slow or unresponsive, make sure you're not using the Polling adapter (you should see a warning upon startup if you are).
402
+
403
+ Also, if the directories you're watching contain many files, make sure you're:
404
+
405
+ * not using Polling (ideally)
406
+ * using `:ignore` and `:only` options to avoid tracking directories you don't care about (important with Polling and on MacOS)
407
+ * running `listen` with the `:latency` and `:wait_for_delay` options not too small or too big (depends on needs)
408
+ * not watching directories with log files, database files or other frequently changing files
409
+ * not using a version of `listen` prior to 2.7.7
410
+ * not getting silent crashes within `listen` (see `LISTEN_GEM_DEBUGGING=debug`)
411
+ * not running multiple instances of `listen` in the background
412
+ * using a file system with atime modification disabled (ideally)
413
+ * not using a filesystem with inaccurate file modification times (ideally), e.g. HFS, VFAT
414
+ * not buffering to a slow terminal (e.g. transparency + fancy font + slow gfx card + lots of output)
415
+ * ideally not running a slow encryption stack, e.g. btrfs + ecryptfs
416
+
417
+ When in doubt, `LISTEN_GEM_DEBUGGING=debug` can help discover the actual events and time they happened.
418
+
419
+ ## Tips and Techniques
420
+ - Watch only directories you're interested in.
421
+ - Set your editor to save quickly (e.g. without backup files, without atomic-save)
422
+ - Tweak the `:latency` and `:wait_for_delay` options until you get good results (see [options](#options)).
423
+ - Add `:ignore` rules to silence all events you don't care about (reduces a lot of noise, especially if you use it on directories)
424
+
425
+ ## Development
426
+
427
+ * Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/listen/master/frames).
428
+ * Source hosted at [GitHub](https://github.com/guard/listen).
429
+
430
+ Pull requests are very welcome! Please try to follow these simple rules if applicable:
431
+
432
+ * Please create a topic branch for every separate change you make.
433
+ * Make sure your patches are well tested. All specs must pass on [CI](https://github.com/guard/listen/actions?workflow=Development).
434
+ * Update the [Yard](http://yardoc.org/) documentation.
435
+ * Update the [README](https://github.com/guard/listen/blob/master/README.md).
436
+ * Please **do not change** the version number.
437
+
438
+ For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
439
+ `#guard` (irc.freenode.net).
440
+
441
+ ## Releasing
442
+
443
+ ### Prerequisites
444
+
445
+ * You must have commit rights to the GitHub repository.
446
+ * You must have push rights for rubygems.org.
447
+
448
+ ### How to release
449
+
450
+ 1. Run `bundle install` to make sure that you have all the gems necessary for testing and releasing.
451
+ 2. **Ensure all tests are passing by running `bundle exec rake`.**
452
+ 3. Determine which would be the correct next version number according to [semver](http://semver.org/).
453
+ 4. Update the version in `./lib/listen/version.rb`.
454
+ 5. Update the version in the Install section of `./README.md` (`gem 'listen', '~> X.Y'`).
455
+ 6. Commit the version in a single commit, the message should be "Preparing vX.Y.Z"
456
+ 7. Run `bundle exec rake release:full`; this will tag, push to GitHub, and publish to rubygems.org.
457
+ 8. Update and publish the release notes on the [GitHub releases page](https://github.com/guard/listen/releases) if necessary
458
+
459
+ ## Acknowledgments
460
+
461
+ * [Michael Kessler (netzpirat)][] for having written the [initial specs](https://github.com/guard/listen/commit/1e457b13b1bb8a25d2240428ce5ed488bafbed1f).
462
+ * [Travis Tilley (ttilley)][] for this awesome work on [fssm][] & [rb-fsevent][].
463
+ * [Natalie Weizenbaum (nex3)][] for [rb-inotify][], a thorough inotify wrapper.
464
+ * [Mathieu Arnold (mat813)][] for [rb-kqueue][], a simple kqueue wrapper.
465
+ * [Maher Sallam][] for [wdm][], windows support wouldn't exist without him.
466
+ * [Yehuda Katz (wycats)][] for [vigilo][], that has been a great source of inspiration.
467
+
468
+ ## Author
469
+
470
+ [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
471
+
472
+ ## Contributors
473
+
474
+ [https://github.com/guard/listen/graphs/contributors](https://github.com/guard/listen/graphs/contributors)
475
+
476
+ [Thibaud Guillaume-Gentil (thibaudgg)]: https://github.com/thibaudgg
477
+ [Maher Sallam]: https://github.com/Maher4Ever
478
+ [Michael Kessler (netzpirat)]: https://github.com/netzpirat
479
+ [Travis Tilley (ttilley)]: https://github.com/ttilley
480
+ [fssm]: https://github.com/ttilley/fssm
481
+ [rb-fsevent]: https://github.com/thibaudgg/rb-fsevent
482
+ [Mathieu Arnold (mat813)]: https://github.com/mat813
483
+ [Natalie Weizenbaum (nex3)]: https://github.com/nex3
484
+ [rb-inotify]: https://github.com/nex3/rb-inotify
485
+ [stereobooster]: https://github.com/stereobooster
486
+ [rb-fchange]: https://github.com/stereobooster/rb-fchange
487
+ [rb-kqueue]: https://github.com/mat813/rb-kqueue
488
+ [Yehuda Katz (wycats)]: https://github.com/wycats
489
+ [vigilo]: https://github.com/wycats/vigilo
490
+ [wdm]: https://github.com/Maher4Ever/wdm
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'listen'
5
+ require 'listen/cli'
6
+
7
+ if !defined?(JRUBY_VERSION) && Signal.list.keys.include?('INT')
8
+ Signal.trap('INT') { Thread.new { Listen.stop } }
9
+ end
10
+
11
+ Listen::CLI.start