moonscript
moonscript copied to clipboard
Refactor & overhaul moonc and watchers
I've tried to split this up across commits to make it a bit easier to follow, but most of the changes are in the last few, as they're fairly heavily intertwined. Intermediate commits do pass the test suites and some brief manual testing.
Main changes/improvements:
- The code handling input paths and
--output-tohas been unified acrossmooncand the watchers, previously the behaviour differed with/without-w, and various issues have been resolved with--output-to, including:- It now actually works...
- The suggestion for
rsync-like handling of exclusive/inclusive directory path behaviour made in issue #342 is added (and can probably be considered enough to close that issue)
- Watch mode will now remove "orphaned"
.luaoutput files, if and when their corresponding.moonsource files are deleted- It will not remove
.luafiles that had no corresponding.moonfile to begin with; this prevents it from doing things like inadvertantly removing vendored Lua modules
- It will not remove
- Both watcher implementations should properly handle the creation of new subdirectories now
- Both watcher implementations now have tests
- Everything works OK with absolute paths now; I think there were a couple of edge cases before
- The implementation of
mooncwas migrated to Moonscript and broken up into smaller functions, which should hopefully render it more readable -- and also testable, although not yet actually tested
Downsides:
- Gnarlier tests; the expanded filesystem test stubs/mocks/helpers now also have their own tests. Testception D:
- +LOC
Force-pushed to fix some compatibility issues
Rebased against master again to drop my Correct '--output-to' to being an option rather than a bare flag commit, as another source for that fix was merged.
Thanks for the this patch, it's going to take me a bit to go through it, I'll try to get back to you soon. Feel free to bug me on discord too