moonscript icon indicating copy to clipboard operation
moonscript copied to clipboard

Refactor & overhaul moonc and watchers

Open Shados opened this issue 6 years ago • 3 comments

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:

  1. The code handling input paths and --output-to has been unified across moonc and the watchers, previously the behaviour differed with/without -w, and various issues have been resolved with --output-to, including:
    1. It now actually works...
    2. 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)
  2. Watch mode will now remove "orphaned" .lua output files, if and when their corresponding .moon source files are deleted
    1. It will not remove .lua files that had no corresponding .moon file to begin with; this prevents it from doing things like inadvertantly removing vendored Lua modules
  3. Both watcher implementations should properly handle the creation of new subdirectories now
  4. Both watcher implementations now have tests
  5. Everything works OK with absolute paths now; I think there were a couple of edge cases before
  6. The implementation of moonc was 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

Shados avatar Feb 18 '19 10:02 Shados

Force-pushed to fix some compatibility issues

Shados avatar Feb 18 '19 12:02 Shados

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.

Shados avatar Feb 20 '19 23:02 Shados

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

leafo avatar Feb 21 '19 07:02 leafo