sass 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +58 -50
- data/Rakefile +1 -4
- 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/lib/sass/cache_stores/filesystem.rb +6 -2
- data/lib/sass/css.rb +1 -3
- data/lib/sass/engine.rb +37 -46
- data/lib/sass/environment.rb +13 -17
- data/lib/sass/error.rb +6 -9
- data/lib/sass/exec/base.rb +187 -0
- data/lib/sass/exec/sass_convert.rb +264 -0
- data/lib/sass/exec/sass_scss.rb +424 -0
- data/lib/sass/exec.rb +5 -771
- data/lib/sass/features.rb +7 -0
- data/lib/sass/importers/base.rb +7 -2
- data/lib/sass/importers/filesystem.rb +9 -25
- data/lib/sass/importers.rb +0 -1
- data/lib/sass/media.rb +1 -4
- data/lib/sass/plugin/compiler.rb +200 -83
- data/lib/sass/plugin/staleness_checker.rb +1 -1
- data/lib/sass/plugin.rb +3 -3
- data/lib/sass/script/css_lexer.rb +1 -1
- data/lib/sass/script/functions.rb +622 -268
- data/lib/sass/script/lexer.rb +99 -34
- data/lib/sass/script/parser.rb +24 -23
- data/lib/sass/script/tree/funcall.rb +1 -1
- data/lib/sass/script/tree/interpolation.rb +20 -2
- data/lib/sass/script/tree/selector.rb +26 -0
- data/lib/sass/script/tree/string_interpolation.rb +1 -1
- data/lib/sass/script/tree.rb +1 -0
- data/lib/sass/script/value/base.rb +7 -5
- data/lib/sass/script/value/bool.rb +0 -5
- data/lib/sass/script/value/color.rb +39 -21
- data/lib/sass/script/value/helpers.rb +107 -0
- data/lib/sass/script/value/list.rb +0 -15
- data/lib/sass/script/value/null.rb +0 -5
- data/lib/sass/script/value/number.rb +62 -14
- data/lib/sass/script/value/string.rb +59 -11
- data/lib/sass/script/value.rb +0 -1
- data/lib/sass/scss/css_parser.rb +8 -2
- data/lib/sass/scss/parser.rb +190 -328
- data/lib/sass/scss/rx.rb +15 -6
- data/lib/sass/scss/static_parser.rb +298 -1
- data/lib/sass/selector/abstract_sequence.rb +28 -13
- data/lib/sass/selector/comma_sequence.rb +92 -13
- data/lib/sass/selector/pseudo.rb +256 -0
- data/lib/sass/selector/sequence.rb +94 -24
- data/lib/sass/selector/simple.rb +14 -25
- data/lib/sass/selector/simple_sequence.rb +97 -33
- data/lib/sass/selector.rb +57 -194
- data/lib/sass/shared.rb +1 -1
- data/lib/sass/source/map.rb +26 -12
- data/lib/sass/stack.rb +0 -6
- data/lib/sass/supports.rb +2 -3
- data/lib/sass/tree/at_root_node.rb +1 -0
- data/lib/sass/tree/charset_node.rb +1 -1
- data/lib/sass/tree/directive_node.rb +8 -2
- data/lib/sass/tree/error_node.rb +18 -0
- data/lib/sass/tree/extend_node.rb +1 -1
- data/lib/sass/tree/function_node.rb +4 -0
- data/lib/sass/tree/keyframe_rule_node.rb +15 -0
- data/lib/sass/tree/prop_node.rb +1 -1
- data/lib/sass/tree/rule_node.rb +12 -7
- data/lib/sass/tree/visitors/check_nesting.rb +38 -10
- data/lib/sass/tree/visitors/convert.rb +16 -18
- data/lib/sass/tree/visitors/cssize.rb +29 -29
- data/lib/sass/tree/visitors/deep_copy.rb +5 -0
- data/lib/sass/tree/visitors/perform.rb +45 -33
- data/lib/sass/tree/visitors/set_options.rb +14 -0
- data/lib/sass/tree/visitors/to_css.rb +15 -14
- data/lib/sass/util/subset_map.rb +1 -1
- data/lib/sass/util.rb +222 -99
- data/lib/sass/version.rb +5 -5
- data/lib/sass.rb +0 -5
- data/test/sass/cache_test.rb +62 -20
- data/test/sass/callbacks_test.rb +1 -1
- data/test/sass/compiler_test.rb +19 -10
- data/test/sass/conversion_test.rb +58 -1
- data/test/sass/css2sass_test.rb +23 -4
- data/test/sass/encoding_test.rb +219 -0
- data/test/sass/engine_test.rb +136 -199
- data/test/sass/exec_test.rb +2 -2
- data/test/sass/extend_test.rb +236 -19
- data/test/sass/functions_test.rb +295 -253
- data/test/sass/importer_test.rb +31 -21
- data/test/sass/logger_test.rb +1 -1
- data/test/sass/more_results/more_import.css +1 -1
- data/test/sass/plugin_test.rb +14 -13
- 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 +3 -3
- data/test/sass/results/scss_import.css +1 -1
- data/test/sass/script_conversion_test.rb +10 -7
- data/test/sass/script_test.rb +288 -74
- data/test/sass/scss/css_test.rb +141 -24
- data/test/sass/scss/rx_test.rb +4 -4
- data/test/sass/scss/scss_test.rb +457 -18
- data/test/sass/source_map_test.rb +115 -25
- data/test/sass/superselector_test.rb +191 -0
- data/test/sass/templates/scss_import.scss +2 -1
- data/test/sass/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +1 -1
- data/test/sass/util/normalized_map_test.rb +1 -1
- data/test/sass/util/subset_map_test.rb +2 -2
- data/test/sass/util_test.rb +31 -1
- data/test/sass/value_helpers_test.rb +5 -7
- data/test/test_helper.rb +2 -2
- 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 +25 -22
- data/ext/mkrf_conf.rb +0 -27
- data/lib/sass/importers/deprecated_path.rb +0 -51
- data/lib/sass/script/value/deprecated_false.rb +0 -55
- 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/CHANGELOG.md
CHANGED
@@ -1,228 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
### Bug fix
|
4
|
-
|
5
|
-
- [#88] Update wdm dependency. (fixed by [@mrbinky3000][])
|
6
|
-
- [#78] Depend on latest rb-inotify. (fixed by [@mbj][])
|
7
|
-
|
8
|
-
## 0.7.2 - January 11, 2013
|
9
|
-
|
10
|
-
### Bug fix
|
11
|
-
|
12
|
-
- [#76] Exception on filename which is not in UTF-8. (fixed by [@piotr-sokolowski][])
|
13
|
-
|
14
|
-
## 0.7.1 - January 6, 2013
|
15
|
-
|
16
|
-
### Bug fix
|
17
|
-
|
18
|
-
- [#75] Default high precision off if the mtime call fails. (fixed by [@zanker][])
|
19
|
-
|
20
|
-
## 0.7.0 - December 29, 2012
|
21
|
-
|
22
|
-
### Bug fixes
|
23
|
-
|
24
|
-
- [#73] Rescue Errno::EOPNOTSUPP on sha1_checksum generation. (fixed by [@thibaudgg][])
|
25
|
-
|
26
|
-
### New feature
|
27
|
-
|
28
|
-
- Add support for *BSD with rb-kqueue. ([@mat813][])
|
29
|
-
|
30
|
-
## 0.6.0 - November 21, 2012
|
31
|
-
|
32
|
-
### New feature
|
33
|
-
|
34
|
-
- Add bang versions for filter and ignore listener methods. ([@tarsolya][])
|
35
|
-
|
36
|
-
## 0.5.3 - October 3, 2012
|
37
|
-
|
38
|
-
### Bug fixes
|
39
|
-
|
40
|
-
- [#65] Fix ruby warning in adapter.rb. (fixed by [@vongruenigen][])
|
41
|
-
- [#64] ENXIO raised when hashing UNIX domain socket file. (fixed by [@sunaku][])
|
42
|
-
|
43
|
-
## 0.5.2 - Septemper 23, 2012
|
44
|
-
|
45
|
-
### Bug fix
|
46
|
-
|
47
|
-
- [#62] Fix double change callback with polling adapter. (fixed by [@thibaudgg][])
|
48
|
-
|
49
|
-
## 0.5.1 - Septemper 18, 2012
|
50
|
-
|
51
|
-
### Bug fix
|
52
|
-
|
53
|
-
- [#61] Fix a synchronisation bug that caused constant fallback to polling. (fixed by [@Maher4Ever][])
|
54
|
-
|
55
|
-
## 0.5.0 - Septemper 1, 2012
|
56
|
-
|
57
|
-
### New features
|
58
|
-
|
59
|
-
- Add a dependency manager to handle platform-specific gems. So there is no need anymore to install
|
60
|
-
extra gems which will never be used on the user system. ([@Maher4Ever][])
|
61
|
-
- Add a manual reporting mode to the adapters. ([@Maher4Ever][])
|
62
|
-
|
63
|
-
### Improvements
|
64
|
-
|
65
|
-
- [#28] Enhance the speed of detecting changes on Windows by using the [WDM][] library. ([@Maher4Ever][])
|
66
|
-
|
67
|
-
## 0.4.7 - June 27, 2012
|
68
|
-
|
69
|
-
### Bug fixes
|
70
|
-
|
71
|
-
- Increase latency to 0.25, to avoid useless polling fallback. (fixed by [@thibaudgg][])
|
72
|
-
- Change watched inotify events, to avoid duplication callback. (fixed by [@thibaudgg][])
|
73
|
-
- [#41](https://github.com/guard/listen/issues/41) Use lstat instead of stat when calculating mtime. (fixed by [@ebroder][])
|
74
|
-
|
75
|
-
## 0.4.6 - June 20, 2012
|
76
|
-
|
77
|
-
### Bug fix
|
78
|
-
|
79
|
-
- [#39](https://github.com/guard/listen/issues/39) Fix digest race condition. (fixed by [@dkubb][])
|
80
|
-
|
81
|
-
## 0.4.5 - June 13, 2012
|
82
|
-
|
83
|
-
### Bug fix
|
84
|
-
|
85
|
-
- [#39](https://github.com/guard/listen/issues/39) Rescue Errno::ENOENT when path inserted doesn't exist. (reported by [@textgoeshere][], fixed by [@thibaudgg][] and [@rymai][])
|
86
|
-
|
87
|
-
## 0.4.4 - June 8, 2012
|
88
|
-
|
89
|
-
### Bug fixes
|
90
|
-
|
91
|
-
- ~~[#39](https://github.com/guard/listen/issues/39) Non-existing path insertion bug. (reported by [@textgoeshere][], fixed by [@thibaudgg][])~~
|
92
|
-
- Fix relative path for directories containing special characters. (reported by [@napcs][], fixed by [@netzpirat][])
|
93
|
-
|
94
|
-
## 0.4.3 - June 6, 2012
|
95
|
-
|
96
|
-
### Bug fixes
|
97
|
-
|
98
|
-
- [#24](https://github.com/guard/listen/issues/24) Fail gracefully when the inotify limit is not enough for Listen to function. (reported by [@daemonza][], fixed by [@Maher4Ever][])
|
99
|
-
- [#32](https://github.com/guard/listen/issues/32) Fix a crash when trying to calculate the checksum of unreadable files. (reported by [@nex3][], fixed by [@Maher4Ever][])
|
100
|
-
|
101
|
-
### Improvements
|
102
|
-
|
103
|
-
- Add `#relative_paths` method to listeners. ([@Maher4Ever][])
|
104
|
-
- Add `#started?` query-method to adapters. ([@Maher4Ever][])
|
105
|
-
- Dynamically detect the mtime precision used on a system. ([@Maher4Ever][] with help from [@nex3][])
|
106
|
-
|
107
|
-
## 0.4.2 - May 1, 2012
|
108
|
-
|
109
|
-
### Bug fixes
|
110
|
-
|
111
|
-
- [#21](https://github.com/guard/listen/issues/21) Issues when listening to changes in relative paths. (reported by [@akerbos][], fixed by [@Maher4Ever][])
|
112
|
-
- [#27](https://github.com/guard/listen/issues/27) Wrong reports for files modifications. (reported by [@cobychapple][], fixed by [@Maher4Ever][])
|
113
|
-
- Fix segmentation fault when profiling on Windows. ([@Maher4Ever][])
|
114
|
-
- Fix redundant watchers on Windows. ([@Maher4Ever][])
|
115
|
-
|
116
|
-
### Improvements
|
117
|
-
|
118
|
-
- [#17](https://github.com/guard/listen/issues/17) Use regexp-patterns with the `ignore` method instead of supplying paths. (reported by [@fny][], added by [@Maher4Ever][])
|
119
|
-
- Speed improvement when listening to changes in directories with ignored paths. ([@Maher4Ever][])
|
120
|
-
- Added `.rbx` and `.svn` to ignored directories. ([@Maher4Ever][])
|
121
|
-
|
122
|
-
## 0.4.1 - April 15, 2012
|
123
|
-
|
124
|
-
### Bug fix
|
125
|
-
|
126
|
-
- [#18](https://github.com/guard/listen/issues/18) Listener crashes when removing directories with nested paths. (reported by [@daemonza][], fixed by [@Maher4Ever][])
|
127
|
-
|
128
|
-
## 0.4.0 - April 9, 2012
|
129
|
-
|
130
|
-
### New features
|
131
|
-
|
132
|
-
- Add `wait_for_callback` method to all adapters. ([@Maher4Ever][])
|
133
|
-
- Add `Listen::MultiListener` class to listen to multiple directories at once. ([@Maher4Ever][])
|
134
|
-
- Allow passing multiple directories to the `Listen.to` method. ([@Maher4Ever][])
|
135
|
-
- Add `blocking` option to `Listen#start` which can be used to disable blocking the current thread upon starting. ([@Maher4Ever][])
|
136
|
-
- Use absolute-paths in callbacks by default instead of relative-paths. ([@Maher4Ever][])
|
137
|
-
- Add `relative_paths` option to `Listen::Listener` to retain the old functionality. ([@Maher4Ever][])
|
138
|
-
|
139
|
-
### Improvements
|
140
|
-
|
141
|
-
- Encapsulate thread spawning in the linux-adapter. ([@Maher4Ever][])
|
142
|
-
- Encapsulate thread spawning in the darwin-adapter. ([@Maher4Ever][] with [@scottdavis][] help)
|
143
|
-
- Encapsulate thread spawning in the windows-adapter. ([@Maher4Ever][])
|
144
|
-
- Fix linux-adapter bug where Listen would report file-modification events on the parent-directory. ([@Maher4Ever][])
|
145
|
-
|
146
|
-
### Change
|
147
|
-
|
148
|
-
- Remove `wait_until_listening` as adapters doesn't need to run inside threads anymore ([@Maher4Ever][])
|
149
|
-
|
150
|
-
## 0.3.3 - March 6, 2012
|
151
|
-
|
152
|
-
### Improvement
|
153
|
-
|
154
|
-
- Improve pause/unpause. ([@thibaudgg][])
|
155
|
-
|
156
|
-
## 0.3.2 - March 4, 2012
|
157
|
-
|
158
|
-
### New feature
|
159
|
-
|
160
|
-
- Add pause/unpause listener's methods. ([@thibaudgg][])
|
161
|
-
|
162
|
-
## 0.3.1 - February 22, 2012
|
163
|
-
|
164
|
-
### Bug fix
|
165
|
-
|
166
|
-
- [#9](https://github.com/guard/listen/issues/9) Ignore doesn't seem to work. (reported by [@markiz][], fixed by [@thibaudgg][])
|
167
|
-
|
168
|
-
## 0.3.0 - February 21, 2012
|
169
|
-
|
170
|
-
### New features
|
171
|
-
|
172
|
-
- Add automatic fallback to polling if system adapter doesn't work (like a DropBox folder). ([@thibaudgg][])
|
173
|
-
- Add latency and force_polling options. ([@Maher4Ever][])
|
174
|
-
|
175
|
-
## 0.2.0 - February 13, 2012
|
176
|
-
|
177
|
-
### New features
|
178
|
-
|
179
|
-
- Add checksum comparaison support for detecting consecutive file modifications made during the same second. ([@thibaudgg][])
|
180
|
-
- Add rb-fchange support. ([@thibaudgg][])
|
181
|
-
- Add rb-inotify support. ([@thibaudgg][] with [@Maher4Ever][] help)
|
182
|
-
- Add rb-fsevent support. ([@thibaudgg][])
|
183
|
-
- Add non-recursive diff with multiple directories support. ([@thibaudgg][])
|
184
|
-
- Ignore .DS_Store by default. ([@thibaudgg][])
|
185
|
-
|
186
|
-
## 0.1.0 - January 28, 2012
|
187
|
-
|
188
|
-
- First version with only a polling adapter and basic features set (ignore & filter). ([@thibaudgg][])
|
189
|
-
|
190
|
-
<!--- The following link definition list is generated by PimpMyChangelog --->
|
191
|
-
[#9]: https://github.com/guard/listen/issues/9
|
192
|
-
[#17]: https://github.com/guard/listen/issues/17
|
193
|
-
[#18]: https://github.com/guard/listen/issues/18
|
194
|
-
[#21]: https://github.com/guard/listen/issues/21
|
195
|
-
[#24]: https://github.com/guard/listen/issues/24
|
196
|
-
[#27]: https://github.com/guard/listen/issues/27
|
197
|
-
[#28]: https://github.com/guard/listen/issues/28
|
198
|
-
[#32]: https://github.com/guard/listen/issues/32
|
199
|
-
[#41]: https://github.com/guard/listen/issues/41
|
200
|
-
[#61]: https://github.com/guard/listen/issues/61
|
201
|
-
[#62]: https://github.com/guard/listen/issues/62
|
202
|
-
[#64]: https://github.com/guard/listen/issues/64
|
203
|
-
[#65]: https://github.com/guard/listen/issues/65
|
204
|
-
[#73]: https://github.com/guard/listen/issues/73
|
205
|
-
[#75]: https://github.com/guard/listen/issues/75
|
206
|
-
[#76]: https://github.com/guard/listen/issues/76
|
207
|
-
[@Maher4Ever]: https://github.com/Maher4Ever
|
208
|
-
[@dkubb]: https://github.com/dkubb
|
209
|
-
[@ebroder]: https://github.com/ebroder
|
210
|
-
[@akerbos]: https://github.com/akerbos
|
211
|
-
[@cobychapple]: https://github.com/cobychapple
|
212
|
-
[@daemonza]: https://github.com/daemonza
|
213
|
-
[@fny]: https://github.com/fny
|
214
|
-
[@markiz]: https://github.com/markiz
|
215
|
-
[@mat813]: https://github.com/mat813
|
216
|
-
[@napcs]: https://github.com/napcs
|
217
|
-
[@netzpirat]: https://github.com/netzpirat
|
218
|
-
[@nex3]: https://github.com/nex3
|
219
|
-
[@piotr-sokolowski]: https://github.com/piotr-sokolowski
|
220
|
-
[@rymai]: https://github.com/rymai
|
221
|
-
[@scottdavis]: https://github.com/scottdavis
|
222
|
-
[@sunaku]: https://github.com/sunaku
|
223
|
-
[@textgoeshere]: https://github.com/textgoeshere
|
224
|
-
[@thibaudgg]: https://github.com/thibaudgg
|
225
|
-
[@tarsolya]: https://github.com/tarsolya
|
226
|
-
[@vongruenigen]: https://github.com/vongruenigen
|
227
|
-
[@zanker]: https://github.com/zanker
|
228
|
-
[WDM]: https://github.com/Maher4Ever/wdm
|
1
|
+
# Moved to [Github releases](https://github.com/guard/listen/releases) page.
|
data/vendor/listen/Gemfile
CHANGED
@@ -1,30 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
source :rubygems
|
1
|
+
source 'https://rubygems.org'
|
4
2
|
|
5
3
|
gemspec
|
6
4
|
|
7
5
|
gem 'rake'
|
8
6
|
|
9
|
-
|
10
|
-
gem '
|
11
|
-
gem 'rb-inotify', '~> 0.9.0' if RbConfig::CONFIG['target_os'] =~ /linux/i
|
12
|
-
gem 'wdm', '~> 0.0.3' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
7
|
+
require 'rbconfig'
|
8
|
+
gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
13
9
|
|
14
10
|
group :development do
|
15
|
-
platform :ruby do
|
16
|
-
gem 'coolline'
|
17
|
-
end
|
18
|
-
|
19
|
-
gem 'guard'
|
20
11
|
gem 'guard-rspec'
|
21
12
|
gem 'yard'
|
22
13
|
gem 'redcarpet'
|
23
|
-
gem '
|
24
|
-
|
25
|
-
gem 'vagrant'
|
14
|
+
gem 'pimpmychangelog'
|
26
15
|
end
|
27
16
|
|
28
17
|
group :test do
|
29
18
|
gem 'rspec'
|
19
|
+
gem 'coveralls', :require => false
|
30
20
|
end
|
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
|