Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor & overhaul moonc and watchers #380

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Commits on May 12, 2021

  1. Configuration menu
    Copy the full SHA
    6eaccf2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a8e2bd4 View commit details
    Browse the repository at this point in the history
  3. Remove unused code.

    Shados committed May 12, 2021
    Configuration menu
    Copy the full SHA
    925dc38 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    36596eb View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    011e3ec View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    d87acd2 View commit details
    Browse the repository at this point in the history
  7. Move all path-related functions out from moonscript.cmd.moonc

    - By 'path-related', I mean ones that purely manipulate or work on
      paths, with no actual filesystem accesses involved
    - A few new functions are also added
    Shados committed May 12, 2021
    Configuration menu
    Copy the full SHA
    e1acafc View commit details
    Browse the repository at this point in the history
  8. Improve and refactor bin/moonc code into moonscript.cmd.moonc

    Benefits and changes:
    - Implemented the rsync-like exclusive/inclusive directory behaviour
      brought up in issue leafo#342
    - Unified CLI file/directory input handling across watch and non-watch
      code paths
    - Everything works OK with absolute paths now, although I can't
      guarantee that it won't violate some user's expectations -- but the
      behaviour is all consistent
    - By converting moonc to Moonscript and breaking it up into smaller
      functions, it should be easier to read, and its component parts could
      also now be covered by the Busted tests
    - Also replaces the existing test filesystem stubs/mocks with some more
      expansive ones, in preparation for increasing test coverage
    Shados committed May 12, 2021
    Configuration menu
    Copy the full SHA
    42100ba View commit details
    Browse the repository at this point in the history
  9. Refactor moonc and overhaul watchers

    - Essentially rewrote both SleepWatcher and InotifyWatcher
    - Added test suites for both, including an expanded set of filesystem
      stubs in order to test them in isolation from the underlying
      filesystem
        - The filesystem stubs have their own tests, kek
    
    Improvements as a result of these changes:
    - Watch mode will remove "orphaned" .lua output files if/when their
      corresponding .moon input files are deleted
        - But it will not remove .lua files that have no corresponding .moon
          file to begin with, in order to avoid e.g. removing vendored Lua
          modules
    - Both Watcher types will properly handle creation of new subdirectories
        - There *shouldn't* be any problematic races with this, although
          inotify's lack of recursive directory watching makes it difficult
          to know for sure
    - More of the code is tested, and more of the code now *could* be tested
      (but isn't yet)
    - Some bugs were fixed
    
    Downsides:
    - Somewhat gnarlier tests
    - Moar lines of code
    Shados committed May 12, 2021
    Configuration menu
    Copy the full SHA
    4764b21 View commit details
    Browse the repository at this point in the history