sass 3.2.19 → 3.4.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +3 -1
- data/CODE_OF_CONDUCT.md +10 -0
- data/CONTRIBUTING.md +148 -0
- data/MIT-LICENSE +1 -1
- data/README.md +87 -61
- data/Rakefile +119 -15
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/VERSION_NAME +1 -1
- data/bin/sass +1 -1
- data/bin/scss +1 -1
- data/extra/sass-spec-ref.sh +32 -0
- data/extra/update_watch.rb +1 -1
- data/lib/sass/cache_stores/base.rb +2 -2
- data/lib/sass/cache_stores/chain.rb +2 -1
- data/lib/sass/cache_stores/filesystem.rb +8 -12
- data/lib/sass/cache_stores/memory.rb +5 -6
- data/lib/sass/cache_stores/null.rb +2 -2
- data/lib/sass/callbacks.rb +3 -2
- data/lib/sass/css.rb +22 -23
- data/lib/sass/deprecation.rb +55 -0
- data/lib/sass/engine.rb +487 -191
- data/lib/sass/environment.rb +172 -58
- data/lib/sass/error.rb +21 -24
- data/lib/sass/exec/base.rb +199 -0
- data/lib/sass/exec/sass_convert.rb +283 -0
- data/lib/sass/exec/sass_scss.rb +440 -0
- data/lib/sass/exec.rb +5 -703
- data/lib/sass/features.rb +47 -0
- data/lib/sass/importers/base.rb +50 -7
- data/lib/sass/importers/deprecated_path.rb +51 -0
- data/lib/sass/importers/filesystem.rb +54 -21
- data/lib/sass/importers.rb +1 -0
- data/lib/sass/logger/base.rb +9 -5
- data/lib/sass/logger/delayed.rb +50 -0
- data/lib/sass/logger/log_level.rb +3 -7
- data/lib/sass/logger.rb +9 -7
- data/lib/sass/media.rb +20 -23
- data/lib/sass/plugin/compiler.rb +321 -145
- data/lib/sass/plugin/configuration.rb +45 -34
- data/lib/sass/plugin/merb.rb +3 -3
- data/lib/sass/plugin/rack.rb +3 -3
- data/lib/sass/plugin/rails.rb +1 -1
- data/lib/sass/plugin/staleness_checker.rb +6 -6
- data/lib/sass/plugin.rb +9 -8
- data/lib/sass/repl.rb +3 -3
- data/lib/sass/script/css_lexer.rb +8 -4
- data/lib/sass/script/css_parser.rb +4 -2
- data/lib/sass/script/css_variable_warning.rb +52 -0
- data/lib/sass/script/functions.rb +1583 -433
- data/lib/sass/script/lexer.rb +198 -79
- data/lib/sass/script/parser.rb +463 -133
- data/lib/sass/script/tree/funcall.rb +313 -0
- data/lib/sass/script/tree/interpolation.rb +223 -0
- data/lib/sass/script/tree/list_literal.rb +104 -0
- data/lib/sass/script/tree/literal.rb +49 -0
- data/lib/sass/script/tree/map_literal.rb +64 -0
- data/lib/sass/script/{node.rb → tree/node.rb} +42 -14
- data/lib/sass/script/tree/operation.rb +156 -0
- data/lib/sass/script/tree/selector.rb +26 -0
- data/lib/sass/script/tree/string_interpolation.rb +125 -0
- data/lib/sass/script/{unary_operation.rb → tree/unary_operation.rb} +6 -6
- data/lib/sass/script/tree/variable.rb +57 -0
- data/lib/sass/script/tree.rb +16 -0
- data/lib/sass/script/{arg_list.rb → value/arg_list.rb} +9 -25
- data/lib/sass/script/value/base.rb +241 -0
- data/lib/sass/script/value/bool.rb +35 -0
- data/lib/sass/script/value/color.rb +698 -0
- data/lib/sass/script/value/helpers.rb +272 -0
- data/lib/sass/script/value/list.rb +113 -0
- data/lib/sass/script/value/map.rb +70 -0
- data/lib/sass/script/{null.rb → value/null.rb} +14 -7
- data/lib/sass/script/{number.rb → value/number.rb} +196 -86
- data/lib/sass/script/value/string.rb +138 -0
- data/lib/sass/script/value.rb +11 -0
- data/lib/sass/script.rb +38 -11
- data/lib/sass/scss/css_parser.rb +25 -5
- data/lib/sass/scss/parser.rb +532 -458
- data/lib/sass/scss/rx.rb +21 -14
- data/lib/sass/scss/static_parser.rb +328 -9
- data/lib/sass/scss.rb +0 -2
- data/lib/sass/selector/abstract_sequence.rb +36 -19
- data/lib/sass/selector/comma_sequence.rb +125 -26
- data/lib/sass/selector/pseudo.rb +266 -0
- data/lib/sass/selector/sequence.rb +200 -71
- data/lib/sass/selector/simple.rb +30 -32
- data/lib/sass/selector/simple_sequence.rb +193 -64
- data/lib/sass/selector.rb +65 -194
- data/lib/sass/shared.rb +2 -2
- data/lib/sass/source/map.rb +213 -0
- data/lib/sass/source/position.rb +39 -0
- data/lib/sass/source/range.rb +41 -0
- data/lib/sass/stack.rb +120 -0
- data/lib/sass/supports.rb +19 -23
- data/lib/sass/tree/at_root_node.rb +83 -0
- data/lib/sass/tree/charset_node.rb +1 -1
- data/lib/sass/tree/comment_node.rb +4 -4
- data/lib/sass/tree/css_import_node.rb +19 -11
- data/lib/sass/tree/debug_node.rb +2 -2
- data/lib/sass/tree/directive_node.rb +21 -4
- data/lib/sass/tree/each_node.rb +8 -8
- data/lib/sass/tree/error_node.rb +18 -0
- data/lib/sass/tree/extend_node.rb +14 -7
- data/lib/sass/tree/for_node.rb +4 -4
- data/lib/sass/tree/function_node.rb +14 -4
- data/lib/sass/tree/if_node.rb +1 -1
- data/lib/sass/tree/import_node.rb +10 -10
- data/lib/sass/tree/keyframe_rule_node.rb +15 -0
- data/lib/sass/tree/media_node.rb +4 -14
- data/lib/sass/tree/mixin_def_node.rb +4 -4
- data/lib/sass/tree/mixin_node.rb +21 -8
- data/lib/sass/tree/node.rb +59 -15
- data/lib/sass/tree/prop_node.rb +42 -24
- data/lib/sass/tree/return_node.rb +3 -2
- data/lib/sass/tree/root_node.rb +19 -3
- data/lib/sass/tree/rule_node.rb +49 -26
- data/lib/sass/tree/supports_node.rb +0 -13
- data/lib/sass/tree/trace_node.rb +2 -1
- data/lib/sass/tree/variable_node.rb +9 -3
- data/lib/sass/tree/visitors/base.rb +5 -8
- data/lib/sass/tree/visitors/check_nesting.rb +62 -36
- data/lib/sass/tree/visitors/convert.rb +111 -76
- data/lib/sass/tree/visitors/cssize.rb +206 -74
- data/lib/sass/tree/visitors/deep_copy.rb +11 -6
- data/lib/sass/tree/visitors/extend.rb +19 -17
- data/lib/sass/tree/visitors/perform.rb +308 -190
- data/lib/sass/tree/visitors/set_options.rb +21 -7
- data/lib/sass/tree/visitors/to_css.rb +273 -92
- data/lib/sass/tree/warn_node.rb +2 -2
- data/lib/sass/tree/while_node.rb +2 -2
- data/lib/sass/util/cross_platform_random.rb +19 -0
- data/lib/sass/util/normalized_map.rb +129 -0
- data/lib/sass/util/ordered_hash.rb +192 -0
- data/lib/sass/util/subset_map.rb +5 -5
- data/lib/sass/util/test.rb +0 -1
- data/lib/sass/util.rb +620 -193
- data/lib/sass/version.rb +22 -24
- data/lib/sass.rb +27 -13
- data/test/sass/cache_test.rb +62 -20
- data/test/sass/callbacks_test.rb +1 -1
- data/test/sass/compiler_test.rb +236 -0
- data/test/sass/conversion_test.rb +472 -44
- data/test/sass/css2sass_test.rb +73 -5
- data/test/sass/css_variable_test.rb +132 -0
- data/test/sass/encoding_test.rb +219 -0
- data/test/sass/engine_test.rb +618 -415
- data/test/sass/exec_test.rb +12 -2
- data/test/sass/extend_test.rb +419 -168
- data/test/sass/functions_test.rb +931 -93
- data/test/sass/importer_test.rb +250 -21
- data/test/sass/logger_test.rb +1 -1
- data/test/sass/more_results/more_import.css +1 -1
- data/test/sass/more_templates/more1.sass +10 -10
- data/test/sass/more_templates/more_import.sass +2 -2
- data/test/sass/plugin_test.rb +26 -34
- data/test/sass/results/compact.css +1 -1
- data/test/sass/results/complex.css +4 -4
- data/test/sass/results/expanded.css +1 -1
- data/test/sass/results/import.css +1 -1
- data/test/sass/results/import_charset_ibm866.css +2 -2
- data/test/sass/results/mixins.css +17 -17
- data/test/sass/results/nested.css +1 -1
- data/test/sass/results/parent_ref.css +2 -2
- data/test/sass/results/script.css +5 -5
- data/test/sass/results/scss_import.css +1 -1
- data/test/sass/script_conversion_test.rb +97 -39
- data/test/sass/script_test.rb +911 -102
- data/test/sass/scss/css_test.rb +215 -34
- data/test/sass/scss/rx_test.rb +8 -4
- data/test/sass/scss/scss_test.rb +2424 -325
- data/test/sass/source_map_test.rb +1055 -0
- data/test/sass/superselector_test.rb +210 -0
- data/test/sass/templates/_partial.sass +1 -1
- data/test/sass/templates/basic.sass +10 -10
- data/test/sass/templates/bork1.sass +1 -1
- data/test/sass/templates/bork5.sass +1 -1
- data/test/sass/templates/compact.sass +10 -10
- data/test/sass/templates/complex.sass +187 -187
- data/test/sass/templates/compressed.sass +10 -10
- data/test/sass/templates/expanded.sass +10 -10
- data/test/sass/templates/import.sass +2 -2
- data/test/sass/templates/importee.sass +3 -3
- data/test/sass/templates/mixins.sass +22 -22
- data/test/sass/templates/multiline.sass +4 -4
- data/test/sass/templates/nested.sass +13 -13
- data/test/sass/templates/parent_ref.sass +12 -12
- data/test/sass/templates/script.sass +70 -70
- data/test/sass/templates/scss_import.scss +2 -1
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
- data/test/sass/templates/subdir/subdir.sass +3 -3
- data/test/sass/templates/units.sass +10 -10
- data/test/sass/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +11 -3
- data/test/sass/util/normalized_map_test.rb +51 -0
- data/test/sass/util/subset_map_test.rb +2 -2
- data/test/sass/util_test.rb +99 -43
- data/test/sass/value_helpers_test.rb +179 -0
- data/test/sass-spec.yml +3 -0
- data/test/test_helper.rb +42 -12
- data/vendor/listen/CHANGELOG.md +1 -228
- data/vendor/listen/Gemfile +5 -15
- data/vendor/listen/README.md +111 -77
- data/vendor/listen/Rakefile +0 -42
- data/vendor/listen/lib/listen/adapter.rb +195 -82
- data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
- data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
- data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
- data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
- data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
- data/vendor/listen/lib/listen/directory_record.rb +96 -61
- data/vendor/listen/lib/listen/listener.rb +135 -37
- data/vendor/listen/lib/listen/turnstile.rb +9 -5
- data/vendor/listen/lib/listen/version.rb +1 -1
- data/vendor/listen/lib/listen.rb +33 -19
- data/vendor/listen/listen.gemspec +6 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +43 -77
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
- data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
- data/vendor/listen/spec/listen/listener_spec.rb +128 -39
- data/vendor/listen/spec/listen_spec.rb +15 -21
- data/vendor/listen/spec/spec_helper.rb +4 -0
- data/vendor/listen/spec/support/adapter_helper.rb +52 -15
- data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
- data/vendor/listen/spec/support/listeners_helper.rb +30 -7
- metadata +161 -111
- data/CONTRIBUTING +0 -3
- data/lib/sass/script/bool.rb +0 -18
- data/lib/sass/script/color.rb +0 -606
- data/lib/sass/script/funcall.rb +0 -245
- data/lib/sass/script/interpolation.rb +0 -79
- data/lib/sass/script/list.rb +0 -85
- data/lib/sass/script/literal.rb +0 -221
- data/lib/sass/script/operation.rb +0 -110
- data/lib/sass/script/string.rb +0 -51
- data/lib/sass/script/string_interpolation.rb +0 -103
- data/lib/sass/script/variable.rb +0 -58
- data/lib/sass/scss/script_lexer.rb +0 -15
- data/lib/sass/scss/script_parser.rb +0 -25
- data/test/Gemfile +0 -3
- data/test/Gemfile.lock +0 -10
- data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
- data/vendor/listen/lib/listen/multi_listener.rb +0 -143
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
- data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
data/vendor/listen/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Listen [![Build Status](https://secure.travis-ci.org/guard/listen.png?branch=master)](http://travis-ci.org/guard/listen)
|
1
|
+
# Listen [![Gem Version](https://badge.fury.io/rb/listen.png)](http://badge.fury.io/rb/listen) [![Build Status](https://secure.travis-ci.org/guard/listen.png?branch=master)](http://travis-ci.org/guard/listen) [![Dependency Status](https://gemnasium.com/guard/listen.png)](https://gemnasium.com/guard/listen) [![Code Climate](https://codeclimate.com/github/guard/listen.png)](https://codeclimate.com/github/guard/listen) [![Coverage Status](https://coveralls.io/repos/guard/listen/badge.png?branch=master)](https://coveralls.io/r/guard/listen)
|
2
2
|
|
3
3
|
The Listen gem listens to file modifications and notifies you about the changes.
|
4
4
|
|
@@ -9,24 +9,60 @@ The Listen gem listens to file modifications and notifies you about the changes.
|
|
9
9
|
* OS-specific adapters for Mac OS X 10.6+, Linux, *BSD and Windows.
|
10
10
|
* Automatic fallback to polling if OS-specific adapter doesn't work.
|
11
11
|
* Detects file modification, addition and removal.
|
12
|
-
*
|
12
|
+
* File content checksum comparison for modifications made under the same second.
|
13
13
|
* Allows supplying regexp-patterns to ignore and filter paths for better results.
|
14
|
-
* Tested on all Ruby environments via [
|
14
|
+
* Tested on all Ruby environments via [Travis CI](https://travis-ci.org/guard/listen).
|
15
|
+
|
16
|
+
## Pending features
|
17
|
+
|
18
|
+
Still not implemented, pull requests are welcome.
|
19
|
+
|
20
|
+
* Symlinks support. [#25](https://github.com/guard/listen/issues/25)
|
21
|
+
* Signal handling. [#105](https://github.com/guard/listen/issues/105)
|
22
|
+
* Non-recursive directory scanning. [#111](https://github.com/guard/listen/issues/111)
|
15
23
|
|
16
24
|
## Install
|
17
25
|
|
18
|
-
|
19
|
-
|
26
|
+
### Using Bundler
|
27
|
+
|
28
|
+
The simplest way to install Listen is to use Bundler.
|
29
|
+
|
30
|
+
Add Listen to your Gemfile:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
group :development do
|
34
|
+
gem 'listen'
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
and install it by running Bundler:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
$ bundle
|
42
|
+
```
|
43
|
+
|
44
|
+
### Install the gem with RubyGems
|
45
|
+
|
46
|
+
```bash
|
47
|
+
$ gem install listen
|
48
|
+
```
|
49
|
+
|
50
|
+
### On Windows
|
51
|
+
|
52
|
+
If your are on Windows and using Ruby MRI >= 1.9.2 you can try to use the [`wdm`](https://github.com/Maher4Ever/wdm) instead of polling.
|
53
|
+
Please add the following to your Gemfile:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
require 'rbconfig'
|
57
|
+
gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
20
58
|
```
|
21
59
|
|
22
60
|
## Usage
|
23
61
|
|
24
62
|
There are **two ways** to use Listen:
|
25
63
|
|
26
|
-
1. Call `Listen.to
|
27
|
-
2. Create a `listener` object and use it in
|
28
|
-
|
29
|
-
Feel free to give your feeback via [Listen issues](https://github.com/guard/listen/issues)
|
64
|
+
1. Block API: Call `Listen.to`/`Listen.to!` with either a single directory or multiple directories, then define the `change` callback in a block.
|
65
|
+
2. "Object" API: Create a `listener` object and use it in a chainable way.
|
30
66
|
|
31
67
|
### Block API
|
32
68
|
|
@@ -51,11 +87,13 @@ listener = listener.filter(/\.rb$/)
|
|
51
87
|
listener = listener.latency(0.5)
|
52
88
|
listener = listener.force_polling(true)
|
53
89
|
listener = listener.polling_fallback_message(false)
|
90
|
+
listener = listener.force_adapter(Listen::Adapters::Linux)
|
54
91
|
listener = listener.change(&callback)
|
55
|
-
listener.start
|
92
|
+
listener.start
|
56
93
|
```
|
57
94
|
|
58
|
-
|
95
|
+
**Note**: All the "Object" API methods except `start`/`start!` return the listener
|
96
|
+
and are thus chainable:
|
59
97
|
|
60
98
|
``` ruby
|
61
99
|
Listen.to('dir/path/to/listen')
|
@@ -65,7 +103,7 @@ Listen.to('dir/path/to/listen')
|
|
65
103
|
.force_polling(true)
|
66
104
|
.polling_fallback_message('custom message')
|
67
105
|
.change(&callback)
|
68
|
-
.start
|
106
|
+
.start
|
69
107
|
```
|
70
108
|
|
71
109
|
### Pause/Unpause
|
@@ -74,35 +112,11 @@ Listener can also easily be paused/unpaused:
|
|
74
112
|
|
75
113
|
``` ruby
|
76
114
|
listener = Listen.to('dir/path/to/listen')
|
77
|
-
listener.start
|
115
|
+
listener.start # non-blocking mode
|
78
116
|
listener.pause # stop listening to changes
|
79
117
|
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!
|
118
|
+
listener.unpause # start listening to changes again
|
119
|
+
listener.stop # stop completely the listener
|
106
120
|
```
|
107
121
|
|
108
122
|
## Changes callback
|
@@ -112,7 +126,7 @@ The registered callback gets invoked, when there are changes, with **three** par
|
|
112
126
|
`modified_paths`, `added_paths` and `removed_paths` in that particular order.
|
113
127
|
|
114
128
|
You can register a callback in two ways. The first way is by passing a block when calling
|
115
|
-
the `Listen.to
|
129
|
+
the `Listen.to`/`Listen.to!` method or when initializing a listener object:
|
116
130
|
|
117
131
|
```ruby
|
118
132
|
Listen.to('path/to/app') do |modified, added, removed|
|
@@ -127,7 +141,7 @@ end
|
|
127
141
|
|
128
142
|
```
|
129
143
|
|
130
|
-
The second way to register a callback is
|
144
|
+
The second way to register a callback is by calling the `#change` method on a
|
131
145
|
listener passing it a block:
|
132
146
|
|
133
147
|
```ruby
|
@@ -139,7 +153,7 @@ end
|
|
139
153
|
listener = Listen.to('dir')
|
140
154
|
listener.change(&callback) # convert the callback to a block and register it
|
141
155
|
|
142
|
-
listener.start
|
156
|
+
listener.start
|
143
157
|
```
|
144
158
|
|
145
159
|
### Paths in callbacks
|
@@ -168,7 +182,7 @@ Listen.to('/home/user/app/css', :relative_paths => true) do |modified, added, re
|
|
168
182
|
end
|
169
183
|
```
|
170
184
|
|
171
|
-
Passing the `:relative_paths => true` option won't work when
|
185
|
+
Passing the `:relative_paths => true` option won't work when listening to multiple
|
172
186
|
directories:
|
173
187
|
|
174
188
|
```ruby
|
@@ -181,29 +195,33 @@ end
|
|
181
195
|
|
182
196
|
## Options
|
183
197
|
|
184
|
-
|
198
|
+
All the following options can be set through the `Listen.to`/`Listen.to!` params
|
199
|
+
or via ["Object" API](#object-api) methods:
|
185
200
|
|
186
201
|
```ruby
|
187
|
-
:
|
188
|
-
|
202
|
+
:ignore => %r{app/CMake/}, /\.pid$/ # Ignore a list of paths (root directory or sub-dir)
|
203
|
+
# default: See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::DirectoryRecord
|
204
|
+
|
205
|
+
:filter => /\.rb$/, /\.coffee$/ # Filter files to listen to via a regexps list.
|
206
|
+
# default: none
|
189
207
|
|
190
|
-
:
|
191
|
-
|
208
|
+
:latency => 0.5 # Set the delay (**in seconds**) between checking for changes
|
209
|
+
# default: 0.25 sec (1.0 sec for polling)
|
192
210
|
|
193
|
-
:
|
194
|
-
|
211
|
+
:force_adapter => Listen::Adapters::Linux # Force the use of a particular adapter class
|
212
|
+
# default: none
|
195
213
|
|
196
|
-
:
|
197
|
-
|
214
|
+
:force_polling => true # Force the use of the polling adapter
|
215
|
+
# default: none
|
198
216
|
|
199
|
-
:
|
200
|
-
|
217
|
+
:polling_fallback_message => 'custom message' # Set a custom polling fallback message (or disable it with false)
|
218
|
+
# default: "Listen will be polling for changes. Learn more at https://github.com/guard/listen#polling-fallback."
|
201
219
|
|
202
|
-
:
|
203
|
-
|
220
|
+
:relative_paths => true # Enable the use of relative paths in the callback.
|
221
|
+
# default: false
|
204
222
|
```
|
205
223
|
|
206
|
-
###
|
224
|
+
### Note on the patterns for ignoring and filtering paths
|
207
225
|
|
208
226
|
Just like the unix convention of beginning absolute paths with the
|
209
227
|
directory-separator (forward slash `/` in unix) and with no prefix for relative paths,
|
@@ -217,53 +235,68 @@ and not `%r{/build/}`.
|
|
217
235
|
|
218
236
|
Use `#filter!` and `#ignore!` methods to overwrites default patterns.
|
219
237
|
|
220
|
-
|
238
|
+
## Blocking listening to changes
|
221
239
|
|
222
|
-
|
223
|
-
|
240
|
+
Calling `Listen.to` with a block doesn't block the current thread. If you want
|
241
|
+
to block the current thread instead until the listener is stopped (which needs
|
242
|
+
to be done from another thread), you can use `Listen.to!`.
|
224
243
|
|
225
|
-
|
226
|
-
|
227
|
-
the listener (be it `Listener` or `MultiListener`) needs to be called with `false` as a parameter.
|
244
|
+
Similarly, if you're using the "Object" API, you can use `#start!` instead of `#start` to block the
|
245
|
+
current thread until the listener is stopped.
|
228
246
|
|
229
|
-
Here is an example of using a listener in the
|
247
|
+
Here is an example of using a listener in the blocking mode:
|
248
|
+
|
249
|
+
```ruby
|
250
|
+
Listen.to!('dir/path/to/listen') # block execution
|
251
|
+
|
252
|
+
# Code here will not run until the listener is stopped
|
253
|
+
|
254
|
+
```
|
255
|
+
|
256
|
+
Here is an example of using a listener started with the "Object" API in blocking mode:
|
230
257
|
|
231
258
|
```ruby
|
232
259
|
listener = Listen.to('dir/path/to/listen')
|
233
|
-
listener.start
|
260
|
+
listener.start! # block execution
|
234
261
|
|
235
|
-
# Code here will run
|
262
|
+
# Code here will not run until the listener is stopped
|
236
263
|
|
237
264
|
```
|
238
265
|
|
239
|
-
**
|
240
|
-
|
266
|
+
**Note**: Using the `Listen.to!` helper-method with or without a callback-block
|
267
|
+
will always start the listener right away and block execution of the current thread.
|
241
268
|
|
242
269
|
## Listen adapters
|
243
270
|
|
244
271
|
The Listen gem has a set of adapters to notify it when there are changes.
|
245
|
-
There are
|
246
|
-
as they use some system-calls to implement the notifying function.
|
272
|
+
There are 4 OS-specific adapters to support Mac, Linux, *BSD and Windows.
|
273
|
+
These adapters are fast as they use some system-calls to implement the notifying function.
|
247
274
|
|
248
275
|
There is also a polling adapter which is a cross-platform adapter and it will
|
249
276
|
work on any system. This adapter is unfortunately slower than the rest of the adapters.
|
250
277
|
|
251
278
|
The Listen gem will choose the best and working adapter for your machine automatically. If you
|
252
279
|
want to force the use of the polling adapter, either use the `:force_polling` option
|
253
|
-
while initializing the listener or call the
|
280
|
+
while initializing the listener or call the `#force_polling` method on your listener
|
254
281
|
before starting it.
|
255
282
|
|
283
|
+
It is also possible to force the use of a particular adapter, by using the `:force_adapter`
|
284
|
+
option. This option skips the usual adapter choosing mechanism and uses the given
|
285
|
+
adapter class instead. The adapter choosing mechanism requires write permission
|
286
|
+
to your watched directories and will needlessly load code, which isn't always desirable.
|
287
|
+
|
256
288
|
## Polling fallback
|
257
289
|
|
258
290
|
When a OS-specific adapter doesn't work the Listen gem automatically falls back to the polling adapter.
|
259
291
|
Here are some things you could try to avoid the polling fallback:
|
260
292
|
|
261
293
|
* [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)
|
294
|
+
* Increase latency. (Please [open an issue](https://github.com/guard/listen/issues/new)
|
295
|
+
if you think that default is too low.)
|
263
296
|
* Move or rename the listened folder.
|
264
297
|
* Update/reboot your OS.
|
265
298
|
|
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).
|
299
|
+
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](https://github.com/guard/listen/blob/master/CONTRIBUTING.md)).
|
267
300
|
|
268
301
|
## Development [![Dependency Status](https://gemnasium.com/guard/listen.png?branch=master)](https://gemnasium.com/guard/listen)
|
269
302
|
|
@@ -273,16 +306,16 @@ If your application keeps using the polling-adapter and you can't figure out why
|
|
273
306
|
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
274
307
|
|
275
308
|
* Please create a topic branch for every separate change you make.
|
276
|
-
* Make sure your patches are well tested. All specs
|
309
|
+
* Make sure your patches are well tested. All specs must pass on [Travis CI](https://travis-ci.org/guard/listen).
|
277
310
|
* Update the [Yard](http://yardoc.org/) documentation.
|
278
|
-
* Update the README.
|
279
|
-
* Update the CHANGELOG for noteworthy changes
|
311
|
+
* Update the [README](https://github.com/guard/listen/blob/master/README.md).
|
312
|
+
* Update the [CHANGELOG](https://github.com/guard/listen/blob/master/CHANGELOG.md) for noteworthy changes (don't forget to run `bundle exec pimpmychangelog` and watch the magic happen)!
|
280
313
|
* Please **do not change** the version number.
|
281
314
|
|
282
315
|
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
283
316
|
`#guard` (irc.freenode.net).
|
284
317
|
|
285
|
-
##
|
318
|
+
## Acknowledgments
|
286
319
|
|
287
320
|
* [Michael Kessler (netzpirat)][] for having written the [initial specs](https://github.com/guard/listen/commit/1e457b13b1bb8a25d2240428ce5ed488bafbed1f).
|
288
321
|
* [Travis Tilley (ttilley)][] for this awesome work on [fssm][] & [rb-fsevent][].
|
@@ -311,5 +344,6 @@ For questions please join us in our [Google group](http://groups.google.com/grou
|
|
311
344
|
[rb-inotify]: https://github.com/nex3/rb-inotify
|
312
345
|
[stereobooster]: https://github.com/stereobooster
|
313
346
|
[rb-fchange]: https://github.com/stereobooster/rb-fchange
|
347
|
+
[rb-kqueue]: https://github.com/mat813/rb-kqueue
|
314
348
|
[Yehuda Katz (wycats)]: https://github.com/wycats
|
315
349
|
[vigilo]: https://github.com/wycats/vigilo
|
data/vendor/listen/Rakefile
CHANGED
@@ -3,45 +3,3 @@ require 'rspec/core/rake_task'
|
|
3
3
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
5
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
|