sass 3.3.0 → 3.4.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -1
  3. data/CODE_OF_CONDUCT.md +10 -0
  4. data/CONTRIBUTING.md +148 -0
  5. data/MIT-LICENSE +1 -1
  6. data/README.md +76 -62
  7. data/Rakefile +104 -24
  8. data/VERSION +1 -1
  9. data/VERSION_DATE +1 -1
  10. data/VERSION_NAME +1 -1
  11. data/bin/sass +1 -1
  12. data/bin/scss +1 -1
  13. data/extra/sass-spec-ref.sh +32 -0
  14. data/extra/update_watch.rb +1 -1
  15. data/lib/sass/cache_stores/filesystem.rb +9 -5
  16. data/lib/sass/cache_stores/memory.rb +4 -5
  17. data/lib/sass/callbacks.rb +2 -2
  18. data/lib/sass/css.rb +12 -13
  19. data/lib/sass/deprecation.rb +55 -0
  20. data/lib/sass/engine.rb +106 -70
  21. data/lib/sass/environment.rb +39 -19
  22. data/lib/sass/error.rb +17 -20
  23. data/lib/sass/exec/base.rb +199 -0
  24. data/lib/sass/exec/sass_convert.rb +283 -0
  25. data/lib/sass/exec/sass_scss.rb +440 -0
  26. data/lib/sass/exec.rb +5 -771
  27. data/lib/sass/features.rb +9 -2
  28. data/lib/sass/importers/base.rb +8 -3
  29. data/lib/sass/importers/filesystem.rb +30 -38
  30. data/lib/sass/logger/base.rb +8 -2
  31. data/lib/sass/logger/delayed.rb +50 -0
  32. data/lib/sass/logger.rb +8 -3
  33. data/lib/sass/media.rb +1 -4
  34. data/lib/sass/plugin/compiler.rb +224 -90
  35. data/lib/sass/plugin/configuration.rb +38 -22
  36. data/lib/sass/plugin/merb.rb +2 -2
  37. data/lib/sass/plugin/rack.rb +3 -3
  38. data/lib/sass/plugin/rails.rb +1 -1
  39. data/lib/sass/plugin/staleness_checker.rb +4 -4
  40. data/lib/sass/plugin.rb +6 -5
  41. data/lib/sass/script/css_lexer.rb +1 -1
  42. data/lib/sass/script/css_parser.rb +2 -3
  43. data/lib/sass/script/css_variable_warning.rb +52 -0
  44. data/lib/sass/script/functions.rb +739 -318
  45. data/lib/sass/script/lexer.rb +134 -54
  46. data/lib/sass/script/parser.rb +252 -56
  47. data/lib/sass/script/tree/funcall.rb +13 -6
  48. data/lib/sass/script/tree/interpolation.rb +127 -4
  49. data/lib/sass/script/tree/list_literal.rb +31 -4
  50. data/lib/sass/script/tree/literal.rb +4 -0
  51. data/lib/sass/script/tree/node.rb +21 -3
  52. data/lib/sass/script/tree/operation.rb +54 -1
  53. data/lib/sass/script/tree/selector.rb +26 -0
  54. data/lib/sass/script/tree/string_interpolation.rb +59 -38
  55. data/lib/sass/script/tree/variable.rb +1 -1
  56. data/lib/sass/script/tree.rb +1 -0
  57. data/lib/sass/script/value/base.rb +17 -14
  58. data/lib/sass/script/value/bool.rb +0 -5
  59. data/lib/sass/script/value/color.rb +78 -42
  60. data/lib/sass/script/value/helpers.rb +119 -2
  61. data/lib/sass/script/value/list.rb +0 -15
  62. data/lib/sass/script/value/map.rb +1 -1
  63. data/lib/sass/script/value/null.rb +0 -5
  64. data/lib/sass/script/value/number.rb +112 -31
  65. data/lib/sass/script/value/string.rb +102 -13
  66. data/lib/sass/script/value.rb +0 -1
  67. data/lib/sass/script.rb +3 -3
  68. data/lib/sass/scss/css_parser.rb +24 -4
  69. data/lib/sass/scss/parser.rb +290 -383
  70. data/lib/sass/scss/rx.rb +17 -9
  71. data/lib/sass/scss/static_parser.rb +306 -4
  72. data/lib/sass/scss.rb +0 -2
  73. data/lib/sass/selector/abstract_sequence.rb +35 -18
  74. data/lib/sass/selector/comma_sequence.rb +114 -19
  75. data/lib/sass/selector/pseudo.rb +266 -0
  76. data/lib/sass/selector/sequence.rb +146 -40
  77. data/lib/sass/selector/simple.rb +22 -33
  78. data/lib/sass/selector/simple_sequence.rb +122 -39
  79. data/lib/sass/selector.rb +57 -197
  80. data/lib/sass/shared.rb +2 -2
  81. data/lib/sass/source/map.rb +31 -14
  82. data/lib/sass/source/position.rb +4 -4
  83. data/lib/sass/stack.rb +2 -8
  84. data/lib/sass/supports.rb +10 -13
  85. data/lib/sass/tree/at_root_node.rb +1 -0
  86. data/lib/sass/tree/charset_node.rb +1 -1
  87. data/lib/sass/tree/comment_node.rb +1 -1
  88. data/lib/sass/tree/css_import_node.rb +9 -1
  89. data/lib/sass/tree/directive_node.rb +8 -2
  90. data/lib/sass/tree/error_node.rb +18 -0
  91. data/lib/sass/tree/extend_node.rb +1 -1
  92. data/lib/sass/tree/function_node.rb +9 -0
  93. data/lib/sass/tree/import_node.rb +6 -5
  94. data/lib/sass/tree/keyframe_rule_node.rb +15 -0
  95. data/lib/sass/tree/node.rb +5 -3
  96. data/lib/sass/tree/prop_node.rb +6 -7
  97. data/lib/sass/tree/rule_node.rb +26 -11
  98. data/lib/sass/tree/visitors/check_nesting.rb +56 -32
  99. data/lib/sass/tree/visitors/convert.rb +59 -44
  100. data/lib/sass/tree/visitors/cssize.rb +34 -30
  101. data/lib/sass/tree/visitors/deep_copy.rb +6 -1
  102. data/lib/sass/tree/visitors/extend.rb +15 -13
  103. data/lib/sass/tree/visitors/perform.rb +87 -50
  104. data/lib/sass/tree/visitors/set_options.rb +15 -1
  105. data/lib/sass/tree/visitors/to_css.rb +72 -43
  106. data/lib/sass/util/multibyte_string_scanner.rb +0 -2
  107. data/lib/sass/util/normalized_map.rb +0 -1
  108. data/lib/sass/util/subset_map.rb +2 -3
  109. data/lib/sass/util.rb +334 -154
  110. data/lib/sass/version.rb +7 -7
  111. data/lib/sass.rb +10 -8
  112. data/test/sass/cache_test.rb +62 -20
  113. data/test/sass/callbacks_test.rb +1 -1
  114. data/test/sass/compiler_test.rb +24 -11
  115. data/test/sass/conversion_test.rb +241 -50
  116. data/test/sass/css2sass_test.rb +73 -5
  117. data/test/sass/css_variable_test.rb +132 -0
  118. data/test/sass/encoding_test.rb +219 -0
  119. data/test/sass/engine_test.rb +343 -260
  120. data/test/sass/exec_test.rb +12 -2
  121. data/test/sass/extend_test.rb +333 -44
  122. data/test/sass/functions_test.rb +353 -260
  123. data/test/sass/importer_test.rb +40 -21
  124. data/test/sass/logger_test.rb +1 -1
  125. data/test/sass/more_results/more_import.css +1 -1
  126. data/test/sass/more_templates/more1.sass +10 -10
  127. data/test/sass/more_templates/more_import.sass +2 -2
  128. data/test/sass/plugin_test.rb +24 -21
  129. data/test/sass/results/compact.css +1 -1
  130. data/test/sass/results/complex.css +4 -4
  131. data/test/sass/results/expanded.css +1 -1
  132. data/test/sass/results/import.css +1 -1
  133. data/test/sass/results/import_charset_ibm866.css +2 -2
  134. data/test/sass/results/mixins.css +17 -17
  135. data/test/sass/results/nested.css +1 -1
  136. data/test/sass/results/parent_ref.css +2 -2
  137. data/test/sass/results/script.css +5 -5
  138. data/test/sass/results/scss_import.css +1 -1
  139. data/test/sass/script_conversion_test.rb +71 -39
  140. data/test/sass/script_test.rb +714 -123
  141. data/test/sass/scss/css_test.rb +213 -30
  142. data/test/sass/scss/rx_test.rb +8 -4
  143. data/test/sass/scss/scss_test.rb +766 -22
  144. data/test/sass/source_map_test.rb +263 -95
  145. data/test/sass/superselector_test.rb +210 -0
  146. data/test/sass/templates/_partial.sass +1 -1
  147. data/test/sass/templates/basic.sass +10 -10
  148. data/test/sass/templates/bork1.sass +1 -1
  149. data/test/sass/templates/bork5.sass +1 -1
  150. data/test/sass/templates/compact.sass +10 -10
  151. data/test/sass/templates/complex.sass +187 -187
  152. data/test/sass/templates/compressed.sass +10 -10
  153. data/test/sass/templates/expanded.sass +10 -10
  154. data/test/sass/templates/import.sass +2 -2
  155. data/test/sass/templates/importee.sass +3 -3
  156. data/test/sass/templates/mixins.sass +22 -22
  157. data/test/sass/templates/multiline.sass +4 -4
  158. data/test/sass/templates/nested.sass +13 -13
  159. data/test/sass/templates/parent_ref.sass +12 -12
  160. data/test/sass/templates/script.sass +70 -70
  161. data/test/sass/templates/scss_import.scss +2 -1
  162. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
  163. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
  164. data/test/sass/templates/subdir/subdir.sass +3 -3
  165. data/test/sass/templates/units.sass +10 -10
  166. data/test/sass/test_helper.rb +1 -1
  167. data/test/sass/util/multibyte_string_scanner_test.rb +11 -3
  168. data/test/sass/util/normalized_map_test.rb +1 -1
  169. data/test/sass/util/subset_map_test.rb +2 -2
  170. data/test/sass/util_test.rb +46 -45
  171. data/test/sass/value_helpers_test.rb +5 -7
  172. data/test/sass-spec.yml +3 -0
  173. data/test/test_helper.rb +7 -6
  174. data/vendor/listen/CHANGELOG.md +1 -228
  175. data/vendor/listen/Gemfile +5 -15
  176. data/vendor/listen/README.md +111 -77
  177. data/vendor/listen/Rakefile +0 -42
  178. data/vendor/listen/lib/listen/adapter.rb +195 -82
  179. data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
  180. data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
  181. data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
  182. data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
  183. data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
  184. data/vendor/listen/lib/listen/directory_record.rb +96 -61
  185. data/vendor/listen/lib/listen/listener.rb +135 -37
  186. data/vendor/listen/lib/listen/turnstile.rb +9 -5
  187. data/vendor/listen/lib/listen/version.rb +1 -1
  188. data/vendor/listen/lib/listen.rb +33 -19
  189. data/vendor/listen/listen.gemspec +6 -0
  190. data/vendor/listen/spec/listen/adapter_spec.rb +43 -77
  191. data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
  192. data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
  193. data/vendor/listen/spec/listen/listener_spec.rb +128 -39
  194. data/vendor/listen/spec/listen_spec.rb +15 -21
  195. data/vendor/listen/spec/spec_helper.rb +4 -0
  196. data/vendor/listen/spec/support/adapter_helper.rb +52 -15
  197. data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
  198. data/vendor/listen/spec/support/listeners_helper.rb +30 -7
  199. metadata +310 -300
  200. data/CONTRIBUTING +0 -3
  201. data/ext/mkrf_conf.rb +0 -27
  202. data/lib/sass/script/value/deprecated_false.rb +0 -55
  203. data/lib/sass/scss/script_lexer.rb +0 -15
  204. data/lib/sass/scss/script_parser.rb +0 -25
  205. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  206. data/vendor/listen/lib/listen/multi_listener.rb +0 -143
  207. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
  208. data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
@@ -1,228 +1 @@
1
- ## 0.7.3 - February 24, 2013
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.
@@ -1,30 +1,20 @@
1
- require 'rbconfig'
2
-
3
- source :rubygems
1
+ source 'https://rubygems.org'
4
2
 
5
3
  gemspec
6
4
 
7
5
  gem 'rake'
8
6
 
9
- gem 'rb-kqueue', '~> 0.2' if RbConfig::CONFIG['target_os'] =~ /freebsd/i
10
- gem 'rb-fsevent', '~> 0.9.1' if RbConfig::CONFIG['target_os'] =~ /darwin(1.+)?$/i
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 'pry'
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
@@ -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
- * Checksum comparison for modifications made under the same second.
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 [travis-ci](http://travis-ci.org/guard/listen).
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
- ``` bash
19
- gem install listen
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` with either a single directory or multiple directories, then define the `change` callback in a block.
27
- 2. Create a `listener` object and use it in an (ARel style) chainable way.
28
-
29
- Feel free to give your feeback via [Listen issues](https://github.com/guard/listen/issues)
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 # blocks execution!
92
+ listener.start
56
93
  ```
57
94
 
58
- ### Chainable
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 # blocks execution!
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(false) # non-blocking mode
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` method or when initializing a listener object:
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 be calling the `change` method on any
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 # blocks execution
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 listeneing to multiple
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
- These options can be set through `Listen.to` params or via methods (see the "Object" API)
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
- :filter => /\.rb$/, /\.coffee$/ # Filter files to listen to via a regexps list.
188
- # default: none
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
- :ignore => %r{app/CMake/}, /\.pid$/ # Ignore a list of paths (root directory or sub-dir)
191
- # default: See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::DirectoryRecord
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
- :latency => 0.5 # Set the delay (**in seconds**) between checking for changes
194
- # default: 0.25 sec (1.0 sec for polling)
211
+ :force_adapter => Listen::Adapters::Linux # Force the use of a particular adapter class
212
+ # default: none
195
213
 
196
- :relative_paths => true # Enable the use of relative paths in the callback.
197
- # default: false
214
+ :force_polling => true # Force the use of the polling adapter
215
+ # default: none
198
216
 
199
- :force_polling => true # Force the use of the polling adapter
200
- # default: none
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
- :polling_fallback_message => 'custom message' # Set a custom polling fallback message (or disable it with `false`)
203
- # default: "WARNING: Listen fallen back to polling, learn more at https://github.com/guard/listen#fallback."
220
+ :relative_paths => true # Enable the use of relative paths in the callback.
221
+ # default: false
204
222
  ```
205
223
 
206
- ### The patterns for filtering and ignoring paths
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
- ### Non-blocking listening to changes
238
+ ## Blocking listening to changes
221
239
 
222
- Starting a listener blocks the current thread by default. That means any code after the
223
- `start` call won't be run until the listener is stopped (which needs to be done from another thread).
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
- For advanced usage there is an option to disable this behavior and have the listener start working
226
- in the background without blocking. To enable non-blocking listening the `start` method of
227
- the listener (be it `Listener` or `MultiListener`) needs to be called with `false` as a parameter.
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 non-blocking mode:
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(false) # doesn't block execution
260
+ listener.start! # block execution
234
261
 
235
- # Code here will run immediately after starting the listener
262
+ # Code here will not run until the listener is stopped
236
263
 
237
264
  ```
238
265
 
239
- **note**: Using the `Listen.to` helper-method with a callback-block will always
240
- block execution. See the "Block API" section for an example.
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 3 OS-specific adapters to support Mac, Linux, *BSD and Windows. These adapters are fast
246
- as they use some system-calls to implement the notifying function.
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 `force_polling` method on your listener
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) if you think that default is too low.)
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 run with `rake spec:portability` must pass.
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
- ## Acknowledgment
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
@@ -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