sass-listen 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 83c34d5acc3959e91e3bfdba038c863d9a4a018c
4
+ data.tar.gz: 2ab5632e30ef7ccf1c7e1ececdd193377fdb75ba
5
+ SHA512:
6
+ metadata.gz: a4ad4191d23a3d8b2c8fa0d102626c7085f8fe6cd756c3cdc38569f7ff8f630f2974d15e656e6799f0c7b74f04edc9cfccae41bf55f0edfe537e0a812239d74f
7
+ data.tar.gz: 5daa41e72785162c3ebe4fc5fe6ef1d6290e7d48069c8126104a2d0968ddb06a194deb8f71614d436d940c116eb627b464aa80a558881c6219eca698562d5022
@@ -0,0 +1 @@
1
+ # Moved to [GitHub releases](https://github.com/guard/listen/releases) page.
@@ -0,0 +1,38 @@
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/wiki/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/wiki/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
+ * Update the [CHANGELOG](https://github.com/guard/listen/blob/master/CHANGELOG.md) for noteworthy changes.
35
+ * Please **do not change** the version number.
36
+
37
+ For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
38
+ `#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,297 @@
1
+ # This is a Fork
2
+
3
+ This is a fork of the official version `3.0.x` branch. Sass need to support older
4
+ versions of ruby than Guard wants to support on an ongoing basis, so we are releasing
5
+ updates as needed for critical fixes and will support ruby 2.0 and
6
+ greater for as long as Sass users need it. Our blog has more information about
7
+ ths [Ruby version policy for Sass](http://blog.sass-lang.com/posts/560719).
8
+
9
+ # Listen
10
+
11
+ The Listen gem listens to file modifications and notifies you about the changes.
12
+
13
+ ## Features
14
+
15
+ * OS-optimized adapters on MRI for Mac OS X 10.6+, Linux, \*BSD and Windows, [more info](#listen-adapters) below.
16
+ * Detects file modification, addition and removal.
17
+ * You can watch multiple directories.
18
+ * Regexp-patterns for ignoring paths for more accuracy and speed
19
+ * Increased change detection accuracy on OS X HFS and VFAT volumes.
20
+ * Tested on MRI Ruby environments (2.0+ only) via [Travis CI](https://travis-ci.org/guard/listen),
21
+
22
+ ## Issues / limitations
23
+
24
+ * Limited support for symlinked directories ([#279](https://github.com/guard/listen/issues/279)):
25
+ * Symlinks are always followed ([#25](https://github.com/guard/listen/issues/25)).
26
+ * Symlinked directories pointing within a watched directory are not supported ([#273](https://github.com/guard/listen/pull/273)- see [Duplicate directory errors](https://github.com/guard/listen/wiki/Duplicate-directory-errors)).
27
+ * No directory/adapter-specific configuration options.
28
+ * Support for plugins planned for future.
29
+ * 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'`.
30
+ * Some filesystems won't work without polling (VM/Vagrant Shared folders, NFS, Samba, sshfs, etc.).
31
+ * Specs suite on JRuby and Rubinius aren't reliable on Travis CI, but should work.
32
+ * Windows and \*BSD adapter aren't continuously and automatically tested.
33
+ * OSX adapter has some performance limitations ([#342](https://github.com/guard/listen/issues/342)).
34
+ * Ruby 1.9.3 is no longer maintained (and may not work with Listen) - it's best to upgrade to Ruby 2.2.2.
35
+
36
+ Pull requests or help is very welcome for these.
37
+
38
+ ## Install
39
+
40
+ The simplest way to install Listen is to use [Bundler](http://bundler.io).
41
+
42
+ ```ruby
43
+ gem 'listen', '~> 3.0' # NOTE: for TCP functionality, use '~> 2.10' for now
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ Call `Listen.to` with either a single directory or multiple directories, then define the "changes" callback in a block.
49
+
50
+ ``` ruby
51
+ listener = Listen.to('dir/to/listen', 'dir/to/listen2') do |modified, added, removed|
52
+ puts "modified absolute path: #{modified}"
53
+ puts "added absolute path: #{added}"
54
+ puts "removed absolute path: #{removed}"
55
+ end
56
+ listener.start # not blocking
57
+ sleep
58
+ ```
59
+
60
+ ### Pause / unpause / stop
61
+
62
+ Listeners can also be easily paused/unpaused:
63
+
64
+ ``` ruby
65
+ listener = Listen.to('dir/path/to/listen') { |modified, added, removed| puts 'handle changes here...' }
66
+
67
+ listener.start
68
+ listener.paused? # => false
69
+ listener.processing? # => true
70
+
71
+ listener.pause # stops processing changes (but keeps on collecting them)
72
+ listener.paused? # => true
73
+ listener.processing? # => false
74
+
75
+ listener.unpause # resumes processing changes ("start" would do the same)
76
+ listener.stop # stop both listening to changes and processing them
77
+ ```
78
+
79
+ Note: While paused, Listen keeps on collecting changes in the background - to clear them, call "stop"
80
+
81
+ Note: You should keep track of all started listeners and stop them properly on finish.
82
+
83
+ ### Ignore / ignore!
84
+
85
+ Listen ignores some directories and extensions by default (See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer), you can add ignoring patterns with the `ignore` option/method or overwrite default with `ignore!` option/method.
86
+
87
+ ``` ruby
88
+ listener = Listen.to('dir/path/to/listen', ignore: /\.txt/) { |modified, added, removed| # ... }
89
+ listener.start
90
+ listener.ignore! /\.pkg/ # overwrite all patterns and only ignore pkg extension.
91
+ listener.ignore /\.rb/ # ignore rb extension in addition of pkg.
92
+ sleep
93
+ ```
94
+
95
+ Note: `:ignore` regexp patterns are evaluated against relative paths.
96
+
97
+ Note: Ignoring paths does not improve performance, except when Polling ([#274](https://github.com/guard/listen/issues/274))
98
+
99
+ ### Only
100
+
101
+ Listen catches 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.
102
+
103
+ ``` ruby
104
+ listener = Listen.to('dir/path/to/listen', only: /\.rb$/) { |modified, added, removed| # ... }
105
+ listener.start
106
+ listener.only /_spec\.rb$/ # overwrite all existing only patterns.
107
+ sleep
108
+ ```
109
+
110
+ Note: `:only` regexp patterns are evaluated only against relative **file** paths.
111
+
112
+
113
+ ## Changes callback
114
+
115
+ Changes to the listened-to directories gets reported back to the user in a callback.
116
+ The registered callback gets invoked, when there are changes, with **three** parameters:
117
+ `modified`, `added` and `removed` paths, in that particular order.
118
+ Paths are always returned in their absolute form.
119
+
120
+ Example:
121
+
122
+ ```ruby
123
+ listener = Listen.to('path/to/app') do |modified, added, removed|
124
+ # This block will be called when there are changes.
125
+ end
126
+ listener.start
127
+ sleep
128
+ ```
129
+
130
+ or ...
131
+
132
+ ```ruby
133
+ # Create a callback
134
+ callback = Proc.new do |modified, added, removed|
135
+ # This proc will be called when there are changes.
136
+ end
137
+ listener = Listen.to('dir', &callback)
138
+ listener.start
139
+ sleep
140
+ ```
141
+
142
+ ## Options
143
+
144
+ All the following options can be set through the `Listen.to` after the directory path(s) params.
145
+
146
+ ```ruby
147
+ ignore: [%r{/foo/bar}, /\.pid$/, /\.coffee$/] # Ignore a list of paths
148
+ # default: See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer
149
+
150
+ ignore!: %r{/foo/bar} # Same as ignore options, but overwrite default ignored paths.
151
+
152
+ only: %r{.rb$} # Only listen to specific files
153
+ # default: none
154
+
155
+ latency: 0.5 # Set the delay (**in seconds**) between checking for changes
156
+ # default: 0.25 sec (1.0 sec for polling)
157
+
158
+ wait_for_delay: 4 # Set the delay (**in seconds**) between calls to the callback when changes exist
159
+ # default: 0.10 sec
160
+
161
+ force_polling: true # Force the use of the polling adapter
162
+ # default: none
163
+
164
+ relative: false # Whether changes should be relative to current dir or not
165
+ # default: false
166
+
167
+ polling_fallback_message: 'custom message' # Set a custom polling fallback message (or disable it with false)
168
+ # default: "Listen will be polling for changes. Learn more at https://github.com/guard/listen#listen-adapters."
169
+ ```
170
+
171
+ ## Debugging
172
+
173
+ Setting the environment variable `LISTEN_GEM_DEBUGGING=1` sets up the INFO level logger, while `LISTEN_GEM_DEBUGGING=2` sets up the DEBUG level logger.
174
+
175
+ You can also set `Listen.logger` to a custom logger.
176
+
177
+
178
+ ## Listen adapters
179
+
180
+ The Listen gem has a set of adapters to notify it when there are changes.
181
+
182
+ There are 4 OS-specific adapters to support Darwin, Linux, \*BSD and Windows.
183
+ These adapters are fast as they use some system-calls to implement the notifying function.
184
+
185
+ There is also a polling adapter - although it's much slower than other adapters,
186
+ it works on every platform/system and scenario (including network filesystems such as VM shared folders).
187
+
188
+ 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.
189
+
190
+ The Listen gem will choose the best adapter automatically, if present. If you
191
+ want to force the use of the polling adapter, use the `:force_polling` option
192
+ while initializing the listener.
193
+
194
+ ### On Windows
195
+
196
+ If you are on Windows, it's recommended to use the [`wdm`](https://github.com/Maher4Ever/wdm) adapter instead of polling.
197
+
198
+ Please add the following to your Gemfile:
199
+
200
+ ```ruby
201
+ gem 'wdm', '>= 0.1.0' if Gem.win_platform?
202
+ ```
203
+
204
+ ### On \*BSD
205
+
206
+ If you are on \*BSD you can try to use the [`rb-kqueue`](https://github.com/mat813/rb-kqueue) adapter instead of polling.
207
+
208
+ Please add the following to your Gemfile:
209
+
210
+ ```ruby
211
+ require 'rbconfig'
212
+ if RbConfig::CONFIG['target_os'] =~ /bsd|dragonfly/i
213
+ gem 'rb-kqueue', '>= 0.2'
214
+ end
215
+
216
+ ```
217
+
218
+ ### Getting the [polling fallback message](#options)?
219
+
220
+ Please visit the [installation section of the Listen WIKI](https://github.com/guard/listen/wiki#installation) for more information and options for potential fixes.
221
+
222
+ ### Issues and troubleshooting
223
+
224
+ *NOTE: without providing the output after setting the `LISTEN_GEM_DEBUGGING=1` environment variable, it can be almost impossible to guess why listen is not working as expected.*
225
+
226
+ See [TROUBLESHOOTING](https://github.com/guard/listen/wiki/Troubleshooting)
227
+
228
+ ## Performance
229
+
230
+ 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).
231
+
232
+ Also, if the directories you're watching contain many files, make sure you're:
233
+
234
+ * not using Polling (ideally)
235
+ * using `:ignore` and `:only` options to avoid tracking directories you don't care about (important with Polling and on MacOS)
236
+ * running Listen with the `:latency` and `:wait_for_delay` options not too small or too big (depends on needs)
237
+ * not watching directories with log files, database files or other frequently changing files
238
+ * not using a version of Listen prior to 2.7.7
239
+ * not getting silent crashes within Listen (see LISTEN_GEM_DEBUGGING=2)
240
+ * not running multiple instances of Listen in the background
241
+ * using a file system with atime modification disabled (ideally)
242
+ * not using a filesystem with inaccurate file modification times (ideally), e.g. HFS, VFAT
243
+ * not buffering to a slow terminal (e.g. transparency + fancy font + slow gfx card + lots of output)
244
+ * ideally not running a slow encryption stack, e.g. btrfs + ecryptfs
245
+
246
+ When in doubt, LISTEN_GEM_DEBUGGING=2 can help discover the actual events and time they happened.
247
+
248
+ See also [Tips and Techniques](https://github.com/guard/listen/wiki/Tips-and-Techniques).
249
+
250
+ ## Development
251
+
252
+ * Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/listen/master/frames).
253
+ * Source hosted at [GitHub](https://github.com/guard/listen).
254
+
255
+ Pull requests are very welcome! Please try to follow these simple rules if applicable:
256
+
257
+ * Please create a topic branch for every separate change you make.
258
+ * Make sure your patches are well tested. All specs must pass on [Travis CI](https://travis-ci.org/guard/listen).
259
+ * Update the [Yard](http://yardoc.org/) documentation.
260
+ * Update the [README](https://github.com/guard/listen/blob/master/README.md).
261
+ * Please **do not change** the version number.
262
+
263
+ For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
264
+ `#guard` (irc.freenode.net).
265
+
266
+ ## Acknowledgments
267
+
268
+ * [Michael Kessler (netzpirat)][] for having written the [initial specs](https://github.com/guard/listen/commit/1e457b13b1bb8a25d2240428ce5ed488bafbed1f).
269
+ * [Travis Tilley (ttilley)][] for this awesome work on [fssm][] & [rb-fsevent][].
270
+ * [Nathan Weizenbaum (nex3)][] for [rb-inotify][], a thorough inotify wrapper.
271
+ * [Mathieu Arnold (mat813)][] for [rb-kqueue][], a simple kqueue wrapper.
272
+ * [Maher Sallam][] for [wdm][], windows support wouldn't exist without him.
273
+ * [Yehuda Katz (wycats)][] for [vigilo][], that has been a great source of inspiration.
274
+
275
+ ## Author
276
+
277
+ [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
278
+
279
+ ## Contributors
280
+
281
+ [https://github.com/guard/listen/graphs/contributors](https://github.com/guard/listen/graphs/contributors)
282
+
283
+ [Thibaud Guillaume-Gentil (thibaudgg)]: https://github.com/thibaudgg
284
+ [Maher Sallam]: https://github.com/Maher4Ever
285
+ [Michael Kessler (netzpirat)]: https://github.com/netzpirat
286
+ [Travis Tilley (ttilley)]: https://github.com/ttilley
287
+ [fssm]: https://github.com/ttilley/fssm
288
+ [rb-fsevent]: https://github.com/thibaudgg/rb-fsevent
289
+ [Mathieu Arnold (mat813)]: https://github.com/mat813
290
+ [Nathan Weizenbaum (nex3)]: https://github.com/nex3
291
+ [rb-inotify]: https://github.com/nex3/rb-inotify
292
+ [stereobooster]: https://github.com/stereobooster
293
+ [rb-fchange]: https://github.com/stereobooster/rb-fchange
294
+ [rb-kqueue]: https://github.com/mat813/rb-kqueue
295
+ [Yehuda Katz (wycats)]: https://github.com/wycats
296
+ [vigilo]: https://github.com/wycats/vigilo
297
+ [wdm]: https://github.com/Maher4Ever/wdm
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'listen'
4
+ require 'listen/cli'
5
+
6
+ unless defined?(JRUBY_VERSION)
7
+ if Signal.list.keys.include?('INT')
8
+ Signal.trap('INT') { Thread.new { Listen.stop } }
9
+ end
10
+ end
11
+
12
+ Listen::CLI.start
@@ -0,0 +1,55 @@
1
+ require 'logger'
2
+ require 'listen/logger'
3
+ require 'listen/listener'
4
+
5
+ require 'listen/internals/thread_pool'
6
+
7
+ # Always set up logging by default first time file is required
8
+ #
9
+ # NOTE: If you need to clear the logger completely, do so *after*
10
+ # requiring this file. If you need to set a custom logger,
11
+ # require the listen/logger file and set the logger before requiring
12
+ # this file.
13
+ Listen.setup_default_logger_if_unset
14
+
15
+ # Won't print anything by default because of level - unless you've set
16
+ # LISTEN_GEM_DEBUGGING or provided your own logger with a high enough level
17
+ Listen::Logger.info "Listen loglevel set to: #{Listen.logger.level}"
18
+ Listen::Logger.info "Listen version: #{Listen::VERSION}"
19
+
20
+ module Listen
21
+ class << self
22
+ # Listens to file system modifications on a either single directory or
23
+ # multiple directories.
24
+ #
25
+ # @param (see Listen::Listener#new)
26
+ #
27
+ # @yield [modified, added, removed] the changed files
28
+ # @yieldparam [Array<String>] modified the list of modified files
29
+ # @yieldparam [Array<String>] added the list of added files
30
+ # @yieldparam [Array<String>] removed the list of removed files
31
+ #
32
+ # @return [Listen::Listener] the listener
33
+ #
34
+ def to(*args, &block)
35
+ @listeners ||= []
36
+ Listener.new(*args, &block).tap do |listener|
37
+ @listeners << listener
38
+ end
39
+ end
40
+
41
+ # This is used by the `listen` binary to handle Ctrl-C
42
+ #
43
+ def stop
44
+ Internals::ThreadPool.stop
45
+ @listeners ||= []
46
+
47
+ # TODO: should use a mutex for this
48
+ @listeners.each do |listener|
49
+ # call stop to halt the main loop
50
+ listener.stop
51
+ end
52
+ @listeners = nil
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,43 @@
1
+ require 'listen/adapter/base'
2
+ require 'listen/adapter/bsd'
3
+ require 'listen/adapter/darwin'
4
+ require 'listen/adapter/linux'
5
+ require 'listen/adapter/polling'
6
+ require 'listen/adapter/windows'
7
+
8
+ module Listen
9
+ module Adapter
10
+ OPTIMIZED_ADAPTERS = [Darwin, Linux, BSD, Windows]
11
+ POLLING_FALLBACK_MESSAGE = 'Listen will be polling for changes.'\
12
+ 'Learn more at https://github.com/guard/listen#listen-adapters.'
13
+
14
+ def self.select(options = {})
15
+ _log :debug, 'Adapter: considering polling ...'
16
+ return Polling if options[:force_polling]
17
+ _log :debug, 'Adapter: considering optimized backend...'
18
+ return _usable_adapter_class if _usable_adapter_class
19
+ _log :debug, 'Adapter: falling back to polling...'
20
+ _warn_polling_fallback(options)
21
+ Polling
22
+ rescue
23
+ _log :warn, format('Adapter: failed: %s:%s', $ERROR_POSITION.inspect,
24
+ $ERROR_POSITION * "\n")
25
+ raise
26
+ end
27
+
28
+ private
29
+
30
+ def self._usable_adapter_class
31
+ OPTIMIZED_ADAPTERS.detect(&:usable?)
32
+ end
33
+
34
+ def self._warn_polling_fallback(options)
35
+ msg = options.fetch(:polling_fallback_message, POLLING_FALLBACK_MESSAGE)
36
+ Kernel.warn "[Listen warning]:\n #{msg}" if msg
37
+ end
38
+
39
+ def self._log(type, message)
40
+ Listen::Logger.send(type, message)
41
+ end
42
+ end
43
+ end