Browse Source

Implement watch

master
Dylan Baker 5 years ago
parent
commit
d65f4003c9
5 changed files with 445 additions and 2 deletions
  1. 407
    0
      Cargo.lock
  2. 1
    0
      Cargo.toml
  3. 12
    0
      README.md
  4. 19
    0
      src/commands.rs
  5. 6
    2
      src/main.rs

+ 407
- 0
Cargo.lock View File

@@ -24,11 +24,30 @@ dependencies = [
24 24
  "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
25 25
 ]
26 26
 
27
+[[package]]
28
+name = "bitflags"
29
+version = "0.7.0"
30
+source = "registry+https://github.com/rust-lang/crates.io-index"
31
+
27 32
 [[package]]
28 33
 name = "bitflags"
29 34
 version = "1.0.4"
30 35
 source = "registry+https://github.com/rust-lang/crates.io-index"
31 36
 
37
+[[package]]
38
+name = "byteorder"
39
+version = "1.2.7"
40
+source = "registry+https://github.com/rust-lang/crates.io-index"
41
+
42
+[[package]]
43
+name = "bytes"
44
+version = "0.4.11"
45
+source = "registry+https://github.com/rust-lang/crates.io-index"
46
+dependencies = [
47
+ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
48
+ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
49
+]
50
+
32 51
 [[package]]
33 52
 name = "cfg-if"
34 53
 version = "0.1.6"
@@ -72,16 +91,52 @@ dependencies = [
72 91
  "unicode_categories 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
73 92
 ]
74 93
 
94
+[[package]]
95
+name = "crossbeam-utils"
96
+version = "0.6.1"
97
+source = "registry+https://github.com/rust-lang/crates.io-index"
98
+dependencies = [
99
+ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
100
+]
101
+
75 102
 [[package]]
76 103
 name = "entities"
77 104
 version = "1.0.1"
78 105
 source = "registry+https://github.com/rust-lang/crates.io-index"
79 106
 
107
+[[package]]
108
+name = "filetime"
109
+version = "0.2.4"
110
+source = "registry+https://github.com/rust-lang/crates.io-index"
111
+dependencies = [
112
+ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
113
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
114
+ "redox_syscall 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
115
+]
116
+
80 117
 [[package]]
81 118
 name = "fs_extra"
82 119
 version = "1.1.0"
83 120
 source = "registry+https://github.com/rust-lang/crates.io-index"
84 121
 
122
+[[package]]
123
+name = "fsevent"
124
+version = "0.2.17"
125
+source = "registry+https://github.com/rust-lang/crates.io-index"
126
+dependencies = [
127
+ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
128
+ "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
129
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
130
+]
131
+
132
+[[package]]
133
+name = "fsevent-sys"
134
+version = "0.1.6"
135
+source = "registry+https://github.com/rust-lang/crates.io-index"
136
+dependencies = [
137
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
138
+]
139
+
85 140
 [[package]]
86 141
 name = "fuchsia-zircon"
87 142
 version = "0.3.3"
@@ -96,16 +151,83 @@ name = "fuchsia-zircon-sys"
96 151
 version = "0.3.3"
97 152
 source = "registry+https://github.com/rust-lang/crates.io-index"
98 153
 
154
+[[package]]
155
+name = "futures"
156
+version = "0.1.25"
157
+source = "registry+https://github.com/rust-lang/crates.io-index"
158
+
159
+[[package]]
160
+name = "inotify"
161
+version = "0.6.1"
162
+source = "registry+https://github.com/rust-lang/crates.io-index"
163
+dependencies = [
164
+ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
165
+ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
166
+ "inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
167
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
168
+ "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
169
+ "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
170
+ "tokio-reactor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
171
+]
172
+
173
+[[package]]
174
+name = "inotify-sys"
175
+version = "0.1.3"
176
+source = "registry+https://github.com/rust-lang/crates.io-index"
177
+dependencies = [
178
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
179
+]
180
+
181
+[[package]]
182
+name = "iovec"
183
+version = "0.1.2"
184
+source = "registry+https://github.com/rust-lang/crates.io-index"
185
+dependencies = [
186
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
187
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
188
+]
189
+
190
+[[package]]
191
+name = "kernel32-sys"
192
+version = "0.2.2"
193
+source = "registry+https://github.com/rust-lang/crates.io-index"
194
+dependencies = [
195
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
196
+ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
197
+]
198
+
99 199
 [[package]]
100 200
 name = "lazy_static"
101 201
 version = "1.2.0"
102 202
 source = "registry+https://github.com/rust-lang/crates.io-index"
103 203
 
204
+[[package]]
205
+name = "lazycell"
206
+version = "1.2.0"
207
+source = "registry+https://github.com/rust-lang/crates.io-index"
208
+
104 209
 [[package]]
105 210
 name = "libc"
106 211
 version = "0.2.43"
107 212
 source = "registry+https://github.com/rust-lang/crates.io-index"
108 213
 
214
+[[package]]
215
+name = "lock_api"
216
+version = "0.1.5"
217
+source = "registry+https://github.com/rust-lang/crates.io-index"
218
+dependencies = [
219
+ "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
220
+ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
221
+]
222
+
223
+[[package]]
224
+name = "log"
225
+version = "0.4.6"
226
+source = "registry+https://github.com/rust-lang/crates.io-index"
227
+dependencies = [
228
+ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
229
+]
230
+
109 231
 [[package]]
110 232
 name = "memchr"
111 233
 version = "2.1.1"
@@ -116,6 +238,111 @@ dependencies = [
116 238
  "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
117 239
 ]
118 240
 
241
+[[package]]
242
+name = "mio"
243
+version = "0.6.16"
244
+source = "registry+https://github.com/rust-lang/crates.io-index"
245
+dependencies = [
246
+ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
247
+ "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
248
+ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
249
+ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
250
+ "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
251
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
252
+ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
253
+ "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
254
+ "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
255
+ "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
256
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
257
+]
258
+
259
+[[package]]
260
+name = "mio-extras"
261
+version = "2.0.5"
262
+source = "registry+https://github.com/rust-lang/crates.io-index"
263
+dependencies = [
264
+ "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
265
+ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
266
+ "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
267
+ "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
268
+]
269
+
270
+[[package]]
271
+name = "miow"
272
+version = "0.2.1"
273
+source = "registry+https://github.com/rust-lang/crates.io-index"
274
+dependencies = [
275
+ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
276
+ "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
277
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
278
+ "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
279
+]
280
+
281
+[[package]]
282
+name = "net2"
283
+version = "0.2.33"
284
+source = "registry+https://github.com/rust-lang/crates.io-index"
285
+dependencies = [
286
+ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
287
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
288
+ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
289
+]
290
+
291
+[[package]]
292
+name = "notify"
293
+version = "4.0.6"
294
+source = "registry+https://github.com/rust-lang/crates.io-index"
295
+dependencies = [
296
+ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
297
+ "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
298
+ "fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
299
+ "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
300
+ "inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
301
+ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
302
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
303
+ "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
304
+ "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
305
+ "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
306
+ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
307
+]
308
+
309
+[[package]]
310
+name = "num_cpus"
311
+version = "1.8.0"
312
+source = "registry+https://github.com/rust-lang/crates.io-index"
313
+dependencies = [
314
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
315
+]
316
+
317
+[[package]]
318
+name = "owning_ref"
319
+version = "0.4.0"
320
+source = "registry+https://github.com/rust-lang/crates.io-index"
321
+dependencies = [
322
+ "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
323
+]
324
+
325
+[[package]]
326
+name = "parking_lot"
327
+version = "0.6.4"
328
+source = "registry+https://github.com/rust-lang/crates.io-index"
329
+dependencies = [
330
+ "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
331
+ "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
332
+]
333
+
334
+[[package]]
335
+name = "parking_lot_core"
336
+version = "0.3.1"
337
+source = "registry+https://github.com/rust-lang/crates.io-index"
338
+dependencies = [
339
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
340
+ "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
341
+ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
342
+ "smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
343
+ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
344
+]
345
+
119 346
 [[package]]
120 347
 name = "pest"
121 348
 version = "1.0.6"
@@ -194,11 +421,63 @@ dependencies = [
194 421
  "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
195 422
 ]
196 423
 
424
+[[package]]
425
+name = "rustc_version"
426
+version = "0.2.3"
427
+source = "registry+https://github.com/rust-lang/crates.io-index"
428
+dependencies = [
429
+ "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
430
+]
431
+
432
+[[package]]
433
+name = "same-file"
434
+version = "1.0.4"
435
+source = "registry+https://github.com/rust-lang/crates.io-index"
436
+dependencies = [
437
+ "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
438
+]
439
+
440
+[[package]]
441
+name = "scopeguard"
442
+version = "0.3.3"
443
+source = "registry+https://github.com/rust-lang/crates.io-index"
444
+
445
+[[package]]
446
+name = "semver"
447
+version = "0.9.0"
448
+source = "registry+https://github.com/rust-lang/crates.io-index"
449
+dependencies = [
450
+ "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
451
+]
452
+
453
+[[package]]
454
+name = "semver-parser"
455
+version = "0.7.0"
456
+source = "registry+https://github.com/rust-lang/crates.io-index"
457
+
197 458
 [[package]]
198 459
 name = "serde"
199 460
 version = "1.0.80"
200 461
 source = "registry+https://github.com/rust-lang/crates.io-index"
201 462
 
463
+[[package]]
464
+name = "slab"
465
+version = "0.4.1"
466
+source = "registry+https://github.com/rust-lang/crates.io-index"
467
+
468
+[[package]]
469
+name = "smallvec"
470
+version = "0.6.6"
471
+source = "registry+https://github.com/rust-lang/crates.io-index"
472
+dependencies = [
473
+ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
474
+]
475
+
476
+[[package]]
477
+name = "stable_deref_trait"
478
+version = "1.1.1"
479
+source = "registry+https://github.com/rust-lang/crates.io-index"
480
+
202 481
 [[package]]
203 482
 name = "strsim"
204 483
 version = "0.7.0"
@@ -256,11 +535,47 @@ dependencies = [
256 535
  "comrak 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
257 536
  "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
258 537
  "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
538
+ "notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
259 539
  "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
260 540
  "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
261 541
  "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
262 542
 ]
263 543
 
544
+[[package]]
545
+name = "tokio-executor"
546
+version = "0.1.5"
547
+source = "registry+https://github.com/rust-lang/crates.io-index"
548
+dependencies = [
549
+ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
550
+]
551
+
552
+[[package]]
553
+name = "tokio-io"
554
+version = "0.1.10"
555
+source = "registry+https://github.com/rust-lang/crates.io-index"
556
+dependencies = [
557
+ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
558
+ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
559
+ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
560
+]
561
+
562
+[[package]]
563
+name = "tokio-reactor"
564
+version = "0.1.7"
565
+source = "registry+https://github.com/rust-lang/crates.io-index"
566
+dependencies = [
567
+ "crossbeam-utils 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
568
+ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
569
+ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
570
+ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
571
+ "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
572
+ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
573
+ "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
574
+ "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
575
+ "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
576
+ "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
577
+]
578
+
264 579
 [[package]]
265 580
 name = "toml"
266 581
 version = "0.4.8"
@@ -302,6 +617,14 @@ name = "unicode_categories"
302 617
 version = "0.1.1"
303 618
 source = "registry+https://github.com/rust-lang/crates.io-index"
304 619
 
620
+[[package]]
621
+name = "unreachable"
622
+version = "1.0.0"
623
+source = "registry+https://github.com/rust-lang/crates.io-index"
624
+dependencies = [
625
+ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
626
+]
627
+
305 628
 [[package]]
306 629
 name = "utf8-ranges"
307 630
 version = "1.0.2"
@@ -325,6 +648,26 @@ name = "version_check"
325 648
 version = "0.1.5"
326 649
 source = "registry+https://github.com/rust-lang/crates.io-index"
327 650
 
651
+[[package]]
652
+name = "void"
653
+version = "1.0.2"
654
+source = "registry+https://github.com/rust-lang/crates.io-index"
655
+
656
+[[package]]
657
+name = "walkdir"
658
+version = "2.2.7"
659
+source = "registry+https://github.com/rust-lang/crates.io-index"
660
+dependencies = [
661
+ "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
662
+ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
663
+ "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
664
+]
665
+
666
+[[package]]
667
+name = "winapi"
668
+version = "0.2.8"
669
+source = "registry+https://github.com/rust-lang/crates.io-index"
670
+
328 671
 [[package]]
329 672
 name = "winapi"
330 673
 version = "0.3.6"
@@ -334,32 +677,78 @@ dependencies = [
334 677
  "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
335 678
 ]
336 679
 
680
+[[package]]
681
+name = "winapi-build"
682
+version = "0.1.1"
683
+source = "registry+https://github.com/rust-lang/crates.io-index"
684
+
337 685
 [[package]]
338 686
 name = "winapi-i686-pc-windows-gnu"
339 687
 version = "0.4.0"
340 688
 source = "registry+https://github.com/rust-lang/crates.io-index"
341 689
 
690
+[[package]]
691
+name = "winapi-util"
692
+version = "0.1.1"
693
+source = "registry+https://github.com/rust-lang/crates.io-index"
694
+dependencies = [
695
+ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
696
+]
697
+
342 698
 [[package]]
343 699
 name = "winapi-x86_64-pc-windows-gnu"
344 700
 version = "0.4.0"
345 701
 source = "registry+https://github.com/rust-lang/crates.io-index"
346 702
 
703
+[[package]]
704
+name = "ws2_32-sys"
705
+version = "0.2.1"
706
+source = "registry+https://github.com/rust-lang/crates.io-index"
707
+dependencies = [
708
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
709
+ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
710
+]
711
+
347 712
 [metadata]
348 713
 "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
349 714
 "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
350 715
 "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
716
+"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
351 717
 "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
718
+"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d"
719
+"checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa"
352 720
 "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
353 721
 "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
354 722
 "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
355 723
 "checksum comrak 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a9bd60be8877a3343d25b9a3dadbaf7f02f9ac843b54e663ecef73e29e8b9c6b"
724
+"checksum crossbeam-utils 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c55913cc2799171a550e307918c0a360e8c16004820291bf3b638969b4a01816"
356 725
 "checksum entities 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca"
726
+"checksum filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2df5c1a8c4be27e7707789dc42ae65976e60b394afd293d1419ab915833e646"
357 727
 "checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674"
728
+"checksum fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "c4bbbf71584aeed076100b5665ac14e3d85eeb31fdbb45fbd41ef9a682b5ec05"
729
+"checksum fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a772d36c338d07a032d5375a36f15f9a7043bf0cb8ce7cee658e037c6032874"
358 730
 "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
359 731
 "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
732
+"checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b"
733
+"checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718"
734
+"checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0"
735
+"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
736
+"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
360 737
 "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
738
+"checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0"
361 739
 "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
740
+"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
741
+"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
362 742
 "checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16"
743
+"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432"
744
+"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40"
745
+"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
746
+"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
747
+"checksum notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "873ecfd8c174964ae30f401329d140142312c8e5590719cf1199d5f1717d8078"
748
+"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
749
+"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
750
+"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
751
+"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c"
363 752
 "checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc"
364 753
 "checksum pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3294f437119209b084c797604295f40227cffa35c57220b1e99a6ff3bf8ee4"
365 754
 "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
@@ -370,13 +759,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
370 759
 "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
371 760
 "checksum regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ee84f70c8c08744ea9641a731c7fadb475bf2ecc52d7f627feb833e0b3990467"
372 761
 "checksum regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fbc557aac2b708fe84121caf261346cc2eed71978024337e42eb46b8a252ac6e"
762
+"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
763
+"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"
764
+"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
765
+"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
766
+"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
373 767
 "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef"
768
+"checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d"
769
+"checksum smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "622df2d454c29a4d89b30dc3b27b42d7d90d6b9e587dbf8f67652eb7514da484"
770
+"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
374 771
 "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
375 772
 "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
376 773
 "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
377 774
 "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
378 775
 "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
379 776
 "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
777
+"checksum tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c117b6cf86bb730aab4834f10df96e4dd586eff2c3c27d3781348da49e255bde"
778
+"checksum tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7392fe0a70d5ce0c882c4778116c519bd5dbaa8a7c3ae3d04578b3afafdcda21"
779
+"checksum tokio-reactor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "502b625acb4ee13cbb3b90b8ca80e0addd263ddacf6931666ef751e610b07fb5"
380 780
 "checksum toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4a2ecc31b0351ea18b3fe11274b8db6e4d82bce861bbb22e6dbed40417902c65"
381 781
 "checksum twoway 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1"
382 782
 "checksum typed-arena 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6c06a92aef38bb4dc5b0df00d68496fc31307c5344c867bb61678c6e1671ec5"
@@ -384,10 +784,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
384 784
 "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
385 785
 "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
386 786
 "checksum unicode_categories 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
787
+"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
387 788
 "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
388 789
 "checksum uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dab5c5526c5caa3d106653401a267fed923e7046f35895ffcb5ca42db64942e6"
389 790
 "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
390 791
 "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
792
+"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
793
+"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1"
794
+"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
391 795
 "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
796
+"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
392 797
 "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
798
+"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab"
393 799
 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
800
+"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"

+ 1
- 0
Cargo.toml View File

@@ -8,6 +8,7 @@ clap = "2.32.0"
8 8
 comrak = "0.3"
9 9
 fs_extra = "1.1.0"
10 10
 lazy_static = "1.2.0"
11
+notify = "4.0.0"
11 12
 regex = "1"
12 13
 toml = "0.4.8"
13 14
 uuid = { version = "0.7", features = ["v4"] }

+ 12
- 0
README.md View File

@@ -0,0 +1,12 @@
1
+# Tlon
2
+
3
+Tlon is a static site generator written in Rust. I had very specific goals in mind when writing Tlon and it is not meant to be all things for all people. Tlon does what it is intended to do and no more.
4
+
5
+Goals
6
+- Convention over configuration
7
+- Learn Rust
8
+- Fast compile times
9
+
10
+Non-goals
11
+- Extensibility
12
+- Flexibility

+ 19
- 0
src/commands.rs View File

@@ -1,6 +1,9 @@
1
+use std::sync::mpsc::channel;
2
+use std::time::Duration;
1 3
 use std::{env, fs};
2 4
 
3 5
 use fs_extra::dir;
6
+use notify::{RecommendedWatcher, RecursiveMode, Watcher};
4 7
 use toml::Value;
5 8
 
6 9
 use config::Config;
@@ -97,6 +100,22 @@ pub fn new(name: &str) {
97 100
     }
98 101
 }
99 102
 
103
+pub fn watch() -> notify::Result<()> {
104
+    let cwd = env::current_dir().expect("Couldn't read current directory");
105
+    let (tx, rx) = channel();
106
+    let mut watcher: RecommendedWatcher = try!(Watcher::new(tx, Duration::from_secs(2)));
107
+    try!(watcher.watch(&cwd.join("posts"), RecursiveMode::Recursive));
108
+    println!("Watching {}/posts", cwd.to_str().unwrap());
109
+    loop {
110
+        match rx.recv() {
111
+            Ok(_) => {
112
+                build();
113
+            }
114
+            Err(e) => println!("watch error: {:?}", e),
115
+        }
116
+    }
117
+}
118
+
100 119
 #[cfg(test)]
101 120
 mod tests {
102 121
     #[allow(unused_imports)]

+ 6
- 2
src/main.rs View File

@@ -3,13 +3,14 @@ extern crate comrak;
3 3
 extern crate fs_extra;
4 4
 #[macro_use]
5 5
 extern crate lazy_static;
6
+extern crate notify;
6 7
 extern crate regex;
7 8
 extern crate toml;
8 9
 extern crate uuid;
9 10
 
10 11
 use clap::{App, Arg};
11 12
 
12
-use commands::{build, new};
13
+use commands::{build, new, watch};
13 14
 
14 15
 mod commands;
15 16
 mod config;
@@ -25,7 +26,7 @@ fn main() {
25 26
         .arg(
26 27
             Arg::with_name("command")
27 28
                 .required(true)
28
-                .possible_values(&["build", "new"])
29
+                .possible_values(&["build", "new", "watch"])
29 30
                 .index(1),
30 31
         ).arg(
31 32
             Arg::with_name("name")
@@ -38,5 +39,8 @@ fn main() {
38 39
         build();
39 40
     } else if command == "new" {
40 41
         new(&matches.value_of("name").unwrap());
42
+    } else if command == "watch" {
43
+        build();
44
+        watch().expect("Error while watching posts directory");
41 45
     }
42 46
 }

Loading…
Cancel
Save