haml-edge 2.3.162 → 2.3.163

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/EDGE_GEM_VERSION +1 -1
  2. data/VERSION +1 -1
  3. data/lib/sass/environment.rb +8 -2
  4. data/lib/sass/script.rb +2 -2
  5. data/test/haml/spec/README.md +97 -0
  6. data/test/haml/spec/lua_haml_spec.lua +30 -0
  7. data/test/haml/spec/ruby_haml_test.rb +19 -0
  8. data/test/haml/spec/tests.json +534 -0
  9. data/test/sass/engine_test.rb +45 -0
  10. data/vendor/fssm/LICENSE +20 -0
  11. data/vendor/fssm/README.markdown +55 -0
  12. data/vendor/fssm/Rakefile +59 -0
  13. data/vendor/fssm/VERSION.yml +5 -0
  14. data/vendor/fssm/example.rb +9 -0
  15. data/vendor/fssm/fssm.gemspec +77 -0
  16. data/vendor/fssm/lib/fssm/backends/fsevents.rb +36 -0
  17. data/vendor/fssm/lib/fssm/backends/inotify.rb +26 -0
  18. data/vendor/fssm/lib/fssm/backends/polling.rb +25 -0
  19. data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +131 -0
  20. data/vendor/fssm/lib/fssm/monitor.rb +26 -0
  21. data/vendor/fssm/lib/fssm/path.rb +91 -0
  22. data/vendor/fssm/lib/fssm/pathname.rb +502 -0
  23. data/vendor/fssm/lib/fssm/state/directory.rb +57 -0
  24. data/vendor/fssm/lib/fssm/state/file.rb +24 -0
  25. data/vendor/fssm/lib/fssm/support.rb +63 -0
  26. data/vendor/fssm/lib/fssm/tree.rb +176 -0
  27. data/vendor/fssm/lib/fssm.rb +33 -0
  28. data/vendor/fssm/profile/prof-cache.rb +40 -0
  29. data/vendor/fssm/profile/prof-fssm-pathname.html +1231 -0
  30. data/vendor/fssm/profile/prof-pathname.rb +68 -0
  31. data/vendor/fssm/profile/prof-plain-pathname.html +988 -0
  32. data/vendor/fssm/profile/prof.html +2379 -0
  33. data/vendor/fssm/spec/path_spec.rb +75 -0
  34. data/vendor/fssm/spec/root/duck/quack.txt +0 -0
  35. data/vendor/fssm/spec/root/file.css +0 -0
  36. data/vendor/fssm/spec/root/file.rb +0 -0
  37. data/vendor/fssm/spec/root/file.yml +0 -0
  38. data/vendor/fssm/spec/root/moo/cow.txt +0 -0
  39. data/vendor/fssm/spec/spec_helper.rb +14 -0
  40. metadata +37 -2
@@ -0,0 +1,534 @@
1
+ {
2
+ "headers" : {
3
+
4
+ "an XHTML XML prolog" : {
5
+ "haml" : "!!! XML",
6
+ "html" : "<?xml version='1.0' encoding='utf-8' ?>"
7
+ },
8
+
9
+ "an XHTML default (transitional) doctype" : {
10
+ "haml" : "!!!",
11
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
12
+ },
13
+
14
+ "an XHTML 1.1 doctype" : {
15
+ "haml" : "!!! 1.1",
16
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">"
17
+ },
18
+
19
+ "an XHTML 1.2 mobile doctype" : {
20
+ "haml" : "!!! mobile",
21
+ "html" : "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\">"
22
+ },
23
+
24
+ "an XHTML 1.1 basic doctype" : {
25
+ "haml" : "!!! basic",
26
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd\">"
27
+ },
28
+
29
+ "an XHTML 1.0 frameset doctype" : {
30
+ "haml" : "!!! frameset",
31
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">"
32
+ },
33
+
34
+ "an HTML 5 doctype with XHTML syntax" : {
35
+ "haml" : "!!! 5",
36
+ "html" : "<!DOCTYPE html>"
37
+ },
38
+
39
+ "an HTML 5 XML prolog (silent)" : {
40
+ "haml" : "!!! XML",
41
+ "html" : "",
42
+ "config" : {
43
+ "format" : "html5"
44
+ }
45
+ },
46
+
47
+ "an HTML 5 doctype" : {
48
+ "haml" : "!!!",
49
+ "html" : "<!DOCTYPE html>",
50
+ "config" : {
51
+ "format" : "html5"
52
+ }
53
+ },
54
+
55
+ "an HTML 4 XML prolog (silent)" : {
56
+ "haml" : "!!! XML",
57
+ "html" : "",
58
+ "config" : {
59
+ "format" : "html4"
60
+ }
61
+ },
62
+
63
+ "an HTML 4 default (transitional) doctype" : {
64
+ "haml" : "!!!",
65
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
66
+ "config" : {
67
+ "format" : "html4"
68
+ }
69
+ },
70
+
71
+ "an HTML 4 frameset doctype" : {
72
+ "haml" : "!!! frameset",
73
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
74
+ "config" : {
75
+ "format" : "html4"
76
+ }
77
+ },
78
+
79
+ "an HTML 4 strict doctype" : {
80
+ "haml" : "!!! strict",
81
+ "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">",
82
+ "config" : {
83
+ "format" : "html4"
84
+ }
85
+ }
86
+
87
+ },
88
+
89
+ "basic Haml tags and CSS": {
90
+
91
+ "a simple Haml tag" : {
92
+ "haml" : "%p",
93
+ "html" : "<p></p>"
94
+ },
95
+
96
+ "a self-closing tag (XHTML)" : {
97
+ "haml" : "%meta",
98
+ "html" : "<meta />"
99
+ },
100
+
101
+ "a self-closing tag (HTML4)" : {
102
+ "haml" : "%meta",
103
+ "html" : "<meta>",
104
+ "config" : {
105
+ "format" : "html4"
106
+ }
107
+ },
108
+
109
+ "a self-closing tag (HTML5)" : {
110
+ "haml" : "%meta",
111
+ "html" : "<meta>",
112
+ "config" : {
113
+ "format" : "html5"
114
+ }
115
+ },
116
+
117
+ "a tag with a CSS class" : {
118
+ "haml" : "%p.class1",
119
+ "html" : "<p class='class1'></p>"
120
+ },
121
+
122
+ "a tag with multiple CSS classes" : {
123
+ "haml" : "%p.class1.class2",
124
+ "html" : "<p class='class1 class2'></p>"
125
+ },
126
+
127
+ "a tag with a CSS id" : {
128
+ "haml" : "%p#id1",
129
+ "html" : "<p id='id1'></p>"
130
+ },
131
+
132
+ "a tag with multiple CSS id's" : {
133
+ "haml" : "%p#id1#id2",
134
+ "html" : "<p id='id2'></p>"
135
+ },
136
+
137
+ "a tag with a class followed by an id" : {
138
+ "haml" : "%p.class1#id1",
139
+ "html" : "<p class='class1' id='id1'></p>"
140
+ },
141
+
142
+ "a tag with an id followed by a class" : {
143
+ "haml" : "%p#id1.class1",
144
+ "html" : "<p class='class1' id='id1'></p>"
145
+ },
146
+
147
+ "an implicit div with a CSS id" : {
148
+ "haml" : "#id1",
149
+ "html" : "<div id='id1'></div>"
150
+ },
151
+
152
+ "an implicit div with a CSS class" : {
153
+ "haml" : ".class1",
154
+ "html" : "<div class='class1'></div>"
155
+ },
156
+
157
+ "multiple simple Haml tags" : {
158
+ "haml" : "%div\n %div\n %p",
159
+ "html" : "<div>\n <div>\n <p></p>\n </div>\n</div>"
160
+ }
161
+ },
162
+
163
+ "tags with unusual HTML characters" : {
164
+
165
+ "a tag with colons" : {
166
+ "haml" : "%ns:tag",
167
+ "html" : "<ns:tag></ns:tag>"
168
+ },
169
+
170
+ "a tag with underscores" : {
171
+ "haml" : "%snake_case",
172
+ "html" : "<snake_case></snake_case>"
173
+ },
174
+
175
+ "a tag with dashes" : {
176
+ "haml" : "%dashed-tag",
177
+ "html" : "<dashed-tag></dashed-tag>"
178
+ },
179
+
180
+ "a tag with camelCase" : {
181
+ "haml" : "%camelCase",
182
+ "html" : "<camelCase></camelCase>"
183
+ },
184
+
185
+ "a tag with PascalCase" : {
186
+ "haml" : "%PascalCase",
187
+ "html" : "<PascalCase></PascalCase>"
188
+ }
189
+ },
190
+
191
+ "tags with unusual CSS identifiers" : {
192
+
193
+ "an all-numeric class" : {
194
+ "haml" : ".123",
195
+ "html" : "<div class='123'></div>"
196
+ },
197
+
198
+ "a class with underscores" : {
199
+ "haml" : ".__",
200
+ "html" : "<div class='__'></div>"
201
+ },
202
+
203
+ "a class with dashes" : {
204
+ "haml" : ".--",
205
+ "html" : "<div class='--'></div>"
206
+ }
207
+
208
+ },
209
+
210
+ "tags with inline content" : {
211
+
212
+ "a simple tag" : {
213
+ "haml" : "%p hello",
214
+ "html" : "<p>hello</p>"
215
+ },
216
+
217
+ "a tag with CSS" : {
218
+ "haml" : "%p.class1 hello",
219
+ "html" : "<p class='class1'>hello</p>"
220
+ },
221
+
222
+ "multiple simple tags" : {
223
+ "haml" : "%div\n %div\n %p text",
224
+ "html" : "<div>\n <div>\n <p>text</p>\n </div>\n</div>"
225
+ }
226
+ },
227
+
228
+ "tags with nested content" : {
229
+
230
+ "a simple tag" : {
231
+ "haml" : "%p\n hello",
232
+ "html" : "<p>\n hello\n</p>"
233
+ },
234
+
235
+ "a tag with CSS" : {
236
+ "haml" : "%p.class1\n hello",
237
+ "html" : "<p class='class1'>\n hello\n</p>"
238
+ },
239
+
240
+ "multiple simple tags" : {
241
+ "haml" : "%div\n %div\n %p\n text",
242
+ "html" : "<div>\n <div>\n <p>\n text\n </p>\n </div>\n</div>"
243
+ }
244
+
245
+ },
246
+
247
+ "tags with HTML-style attributes": {
248
+
249
+ "one attribute" : {
250
+ "haml" : "%p(a='b')",
251
+ "html" : "<p a='b'></p>"
252
+ },
253
+
254
+ "multiple attributes" : {
255
+ "haml" : "%p(a='b' c='d')",
256
+ "html" : "<p a='b' c='d'></p>"
257
+ },
258
+
259
+ "attributes separated with newlines" : {
260
+ "haml" : "%p(a='b'\n c='d')",
261
+ "html" : "<p a='b' c='d'></p>"
262
+ },
263
+
264
+ "an interpolated attribute" : {
265
+ "haml" : "%p(a=\"#{var}\")",
266
+ "html" : "<p a='value'></p>",
267
+ "locals" : {
268
+ "var" : "value"
269
+ }
270
+ },
271
+
272
+ "'class' as an attribute" : {
273
+ "haml" : "%p(class='class1')",
274
+ "html" : "<p class='class1'></p>"
275
+ },
276
+
277
+ "a tag with a CSS class and 'class' as an attribute" : {
278
+ "haml" : "%p.class2(class='class1')",
279
+ "html" : "<p class='class1 class2'></p>"
280
+ },
281
+
282
+ "a tag with 'id' as an attribute" : {
283
+ "haml" : "%p(id='1')",
284
+ "html" : "<p id='1'></p>"
285
+ },
286
+
287
+ "a tag with a CSS id and 'id' as an attribute" : {
288
+ "haml" : "%p#id(id='1')",
289
+ "html" : "<p id='id_1'></p>"
290
+ },
291
+
292
+ "a tag with a variable attribute" : {
293
+ "haml" : "%p(class=var)",
294
+ "html" : "<p class='hello'></p>",
295
+ "locals" : {
296
+ "var" : "hello"
297
+ }
298
+ },
299
+
300
+ "a tag with a CSS class and 'class' as a variable attribute" : {
301
+ "haml" : ".hello(class=var)",
302
+ "html" : "<div class='hello world'></div>",
303
+ "locals" : {
304
+ "var" : "world"
305
+ }
306
+ },
307
+
308
+ "a tag multiple CSS classes (sorted correctly)" : {
309
+ "haml" : ".z(class=var)",
310
+ "html" : "<div class='a z'></div>",
311
+ "locals" : {
312
+ "var" : "a"
313
+ }
314
+ }
315
+
316
+ },
317
+
318
+ "tags with Ruby-style attributes": {
319
+
320
+ "one attribute" : {
321
+ "haml" : "%p{:a => 'b'}",
322
+ "html" : "<p a='b'></p>"
323
+ },
324
+
325
+ "attributes hash with whitespace" : {
326
+ "haml" : "%p{ :a => 'b' }",
327
+ "html" : "<p a='b'></p>"
328
+ },
329
+
330
+ "an interpolated attribute" : {
331
+ "haml" : "%p{:a =>\"#{var}\"}",
332
+ "html" : "<p a='value'></p>",
333
+ "locals" : {
334
+ "var" : "value"
335
+ }
336
+ },
337
+
338
+ "multiple attributes" : {
339
+ "haml" : "%p{ :a => 'b', 'c' => 'd' }",
340
+ "html" : "<p a='b' c='d'></p>"
341
+ },
342
+
343
+ "attributes separated with newlines" : {
344
+ "haml" : "%p{ :a => 'b',\n 'c' => 'd' }",
345
+ "html" : "<p a='b' c='d'></p>"
346
+ },
347
+
348
+ "'class' as an attribute" : {
349
+ "haml" : "%p{:class => 'class1'}",
350
+ "html" : "<p class='class1'></p>"
351
+ },
352
+
353
+ "a tag with a CSS class and 'class' as an attribute" : {
354
+ "haml" : "%p.class2{:class => 'class1'}",
355
+ "html" : "<p class='class1 class2'></p>"
356
+ },
357
+
358
+ "a tag with 'id' as an attribute" : {
359
+ "haml" : "%p{:id => '1'}",
360
+ "html" : "<p id='1'></p>"
361
+ },
362
+
363
+ "a tag with a CSS id and 'id' as an attribute" : {
364
+ "haml" : "%p#id{:id => '1'}",
365
+ "html" : "<p id='id_1'></p>"
366
+ },
367
+
368
+ "a tag with a CSS id and a numeric 'id' as an attribute" : {
369
+ "haml" : "%p#id{:id => 1}",
370
+ "html" : "<p id='id_1'></p>"
371
+ },
372
+
373
+ "a tag with a variable attribute" : {
374
+ "haml" : "%p{:class => var}",
375
+ "html" : "<p class='hello'></p>",
376
+ "locals" : {
377
+ "var" : "hello"
378
+ }
379
+ },
380
+
381
+ "a tag with a CSS class and 'class' as a variable attribute" : {
382
+ "haml" : ".hello{:class => var}",
383
+ "html" : "<div class='hello world'></div>",
384
+ "locals" : {
385
+ "var" : "world"
386
+ }
387
+ },
388
+
389
+ "a tag multiple CSS classes (sorted correctly)" : {
390
+ "haml" : ".z{:class => var}",
391
+ "html" : "<div class='a z'></div>",
392
+ "locals" : {
393
+ "var" : "a"
394
+ }
395
+ }
396
+
397
+ },
398
+
399
+ "silent comments" : {
400
+
401
+ "an inline comment" : {
402
+ "haml" : "-# hello",
403
+ "html" : ""
404
+ },
405
+
406
+ "a nested comment" : {
407
+ "haml" : "-#\n hello",
408
+ "html" : ""
409
+ }
410
+
411
+ },
412
+
413
+ "markup comments" : {
414
+
415
+ "an inline comment" : {
416
+ "haml" : "/ comment",
417
+ "html" : "<!-- comment -->"
418
+ },
419
+
420
+ "a nested comment" : {
421
+ "haml" : "/\n comment\n comment2",
422
+ "html" : "<!--\n comment\n comment2\n-->"
423
+ }
424
+ },
425
+
426
+ "conditional comments": {
427
+ "a conditional comment" : {
428
+ "haml" : "/[if IE]\n %p a",
429
+ "html" : "<!--[if IE]>\n <p>a</p>\n<![endif]-->"
430
+ }
431
+ },
432
+
433
+ "internal filters": {
434
+
435
+ "content in an 'escaped' filter" : {
436
+ "haml" : ":escaped\n <&\">",
437
+ "html" : "&lt;&amp;&quot;&gt;"
438
+ },
439
+
440
+ "content in a 'preserve' filter" : {
441
+ "haml" : ":preserve\n hello\n\n%p",
442
+ "html" : "hello&#x000A;\n<p></p>"
443
+ },
444
+
445
+ "content in a 'plain' filter" : {
446
+ "haml" : ":plain\n hello\n\n%p",
447
+ "html" : "hello\n<p></p>"
448
+ },
449
+
450
+ "content in a 'javascript' filter" : {
451
+ "haml" : ":javascript\n a();\n%p",
452
+ "html" : "<script type='text/javascript'>\n //<![CDATA[\n a();\n //]]>\n</script>\n<p></p>"
453
+ }
454
+
455
+ },
456
+
457
+ "interpolation": {
458
+
459
+ "interpolation inside inline content" : {
460
+ "haml" : "%p #{var}",
461
+ "html" : "<p>value</p>",
462
+ "locals" : {
463
+ "var" : "value"
464
+ }
465
+ },
466
+
467
+ "no interpolation when escaped" : {
468
+ "haml" : "%p \\#{var}",
469
+ "html" : "<p>#{var}</p>"
470
+ },
471
+
472
+ "interpolation when the escape character is escaped" : {
473
+ "haml" : "%p \\\\#{var}",
474
+ "html" : "<p>\\value</p>",
475
+ "locals" : {
476
+ "var" : "value"
477
+ }
478
+ },
479
+
480
+ "interpolation inside filtered content" : {
481
+ "haml" : ":plain\n #{var} interpolated: #{var}",
482
+ "html" : "value interpolated: value",
483
+ "locals" : {
484
+ "var" : "value"
485
+ }
486
+ }
487
+
488
+ },
489
+
490
+ "HTML escaping" : {
491
+
492
+ "code following '&='" : {
493
+ "haml" : "&= '<\"&>'",
494
+ "html" : "&lt;&quot;&amp;&gt;"
495
+ },
496
+
497
+ "code following '=' when escape_haml is set to true" : {
498
+ "haml" : "= '<\"&>'",
499
+ "html" : "&lt;&quot;&amp;&gt;",
500
+ "config" : {
501
+ "escape_html" : "true"
502
+ }
503
+ },
504
+
505
+ "code following '!=' when escape_haml is set to true" : {
506
+ "haml" : "!= '<\"&>'",
507
+ "html" : "<\"&>",
508
+ "config" : {
509
+ "escape_html" : "true"
510
+ }
511
+ }
512
+
513
+ },
514
+
515
+ "Boolean attributes" : {
516
+
517
+ "boolean attribute with XHTML" : {
518
+ "haml" : "%input(checked=true)",
519
+ "html" : "<input checked='checked' />",
520
+ "config" : {
521
+ "format" : "xhtml"
522
+ }
523
+ },
524
+
525
+ "boolean attribute with HTML" : {
526
+ "haml" : "%input(checked=true)",
527
+ "html" : "<input checked>",
528
+ "config" : {
529
+ "format" : "html5"
530
+ }
531
+ }
532
+ }
533
+
534
+ }
@@ -63,6 +63,8 @@ MSG
63
63
  "foo\n @import #{File.dirname(__FILE__)}/templates/basic" => "Import directives may only be used at the root of a document.",
64
64
  %Q{!foo = "bar" "baz" !} => %Q{Syntax error in '"bar" "baz" !' at character 20.},
65
65
  "=foo\n :color red\n.bar\n +bang" => "Undefined mixin 'bang'.",
66
+ "=foo\n :color red\n.bar\n +bang_bop" => "Undefined mixin 'bang_bop'.",
67
+ "=foo\n :color red\n.bar\n +bang-bop" => "Undefined mixin 'bang-bop'.",
66
68
  ".bar\n =foo\n :color red\n" => ["Mixins may only be defined at the root of a document.", 2],
67
69
  "=foo\n :color red\n.bar\n +foo\n :color red" => "Illegal nesting: Nothing may be nested beneath mixin directives.",
68
70
  " a\n b: c" => ["Indenting at the beginning of the document is illegal.", 1],
@@ -90,6 +92,8 @@ MSG
90
92
  "@if false\n@else if " => "Invalid else directive '@else if': expected 'if <expr>'.",
91
93
  "a\n !b = 12\nc\n d = !b" => 'Undefined variable: "!b".',
92
94
  "=foo\n !b = 12\nc\n +foo\n d = !b" => 'Undefined variable: "!b".',
95
+ "c\n d = !b-foo" => 'Undefined variable: "!b-foo".',
96
+ "c\n d = !b_foo" => 'Undefined variable: "!b_foo".',
93
97
  '@for !a from "foo" to 1' => '"foo" is not an integer.',
94
98
  '@for !a from 1 to "2"' => '"2" is not an integer.',
95
99
  '@for !a from 1 to "foo"' => '"foo" is not an integer.',
@@ -738,6 +742,24 @@ three
738
742
  SASS
739
743
  end
740
744
 
745
+ def test_hyphen_underscore_insensitive_mixins
746
+ assert_equal(<<CSS, render(<<SASS))
747
+ a {
748
+ b: 12;
749
+ c: foo; }
750
+ CSS
751
+ =mixin-hyphen
752
+ b: 12
753
+
754
+ =mixin_under
755
+ c: foo
756
+
757
+ a
758
+ +mixin_hyphen
759
+ +mixin-under
760
+ SASS
761
+ end
762
+
741
763
  def test_interpolation
742
764
  assert_equal("a-1 {\n b-2-3: c-3; }\n", render(<<SASS))
743
765
  !a = 1
@@ -900,6 +922,29 @@ b
900
922
  SASS
901
923
  end
902
924
 
925
+ def test_hyphen_underscore_insensitive_variables
926
+ assert_equal(<<CSS, render(<<SASS))
927
+ a {
928
+ b: c; }
929
+
930
+ d {
931
+ e: 13;
932
+ f: foobar; }
933
+ CSS
934
+ !var-hyphen = 12
935
+ !var_under = "foo"
936
+
937
+ a
938
+ !var_hyphen = 1 + !var_hyphen
939
+ !var-under = !var-under + "bar"
940
+ b: c
941
+
942
+ d
943
+ e = !var-hyphen
944
+ f = !var_under
945
+ SASS
946
+ end
947
+
903
948
  def test_argument_error
904
949
  assert_raise(Sass::SyntaxError) { render("a\n b = hsl(1)") }
905
950
  end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Travis Tilley
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,55 @@
1
+ Monitor API
2
+ ===========
3
+
4
+ There are three ways you can run the monitor.
5
+
6
+ 1. call monitor with a path parameter, and define callbacks in a block
7
+ 2. call monitor with a block to configure multiple paths and callbacks
8
+ 3. create a monitor object and run each step manually
9
+
10
+ Monitor with path
11
+ -----------------
12
+
13
+ This form watches one path, and enters the run loop automatically. The first parameter is the path to watch, and the second parameter is an optional glob pattern or array of glob patterns that a file must match in order to trigger a callback. The default glob, if ommitted, is `'**/*'`.
14
+
15
+ FSSM.monitor('/some/directory/', '**/*') do
16
+ update {|base, relative|}
17
+ delete {|base, relative|}
18
+ create {|base, relative|}
19
+ end
20
+
21
+ Monitor with block
22
+ ------------------
23
+
24
+ This form watches one or more paths, and enters the run loop automatically. The glob configuration call can be ommitted, and defaults to `'**/*'`.
25
+
26
+ FSSM.monitor do
27
+ path '/some/directory/' do
28
+ glob '**/*.yml'
29
+
30
+ update {|base, relative|}
31
+ delete {|base, relative|}
32
+ create {|base, relative|}
33
+ end
34
+
35
+ path '/some/other/directory/' do
36
+ update {|base, relative|}
37
+ delete {|base, relative|}
38
+ create {|base, relative|}
39
+ end
40
+ end
41
+
42
+ Monitor object
43
+ --------------
44
+
45
+ This form doesn't enter the run loop automatically.
46
+
47
+ monitor = FSSM::Monitor.new
48
+
49
+ monitor.path '/some/directory/' do
50
+ update {|base, relative|}
51
+ delete {|base, relative|}
52
+ create {|base, relative|}
53
+ end
54
+
55
+ monitor.run