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
feat: support installing git scripts from non-root folders #911
Conversation
👍 for manifest.json |
Codecov Report
@@ Coverage Diff @@
## main #911 +/- ##
============================================
+ Coverage 26.43% 26.72% +0.29%
- Complexity 12240 12370 +130
============================================
Files 1028 1028
Lines 159692 159705 +13
Branches 35132 35132
============================================
+ Hits 42221 42688 +467
+ Misses 109710 109144 -566
- Partials 7761 7873 +112
Continue to review full report at Codecov.
|
Would you be up for adding more tests to GitManager? |
I think it's feasible to add some, with downside that:
I would be looking to go through the CLI and ASH commands, instead of testing the manager, because I don't want to be tied to the current public interface. |
I wouldn't mind keeping an example git repo in the tests directory
Yeah I guess alternatively we mock the filesystem layer but I appreciate that's tedious.
Mocking the fs I suppose this would be doable. |
If I were to avoid the remote network, I think the way would be:
As an increment, though, I think I can create some branches on my test repo and use that. |
c3cecd4
to
f467166
Compare
FWIW, DebugDatabaseTest mocks a "simple" and "complex" file system. I'm not sure how relevant it is because the focus is in files and attributes. To test git commands you'd also need file contents, but maybe this would be extendable? MoodManagerTest mocks reading a text file. Probably irrelevant but sometimes even a bad example can be inspirational. |
I saw that: that creates a fake
Mocking any of these would be extremely fragile and tightly coupled to the implementation, and wouldn't give high confidence the code actually worked. I feel like it's a non-starter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thank you
Certain existing scripts, such as ChIT install from a folder one level lower than the base directory when using SVN. It is desirable to support this from git as well, to avoid breaking existing installations.
Introduce a file
manifest.json
with a keyroot_directory
to specify the directory that contains the other files Mafia is interested in: those under the permissible folders (e.g.scripts
), and thedependencies.txt
file.Removed comment about not supporting local changes because local changes are supported implicitly without me having to write any code, which is nice. It seems that
git update
will handle unstaged changes -- I thought asking people to commit changes was a good halfway house, but even this isn't necessary. Merge conflicts will probably error, though.To install ChIT locally, a user could:
git checkout https://github.com/Loathing-Associates-Scripting-Society/ChIT.git
to install ChIT, but not copy any filesmanifest.json
file underMAFIA_ROOT/git/Loathing-Associates-Scripting-Society-ChIT
containinggit sync
This file could be added to the remote git repo, after this feature is released, to avoid the need for local changes.
I'm not certain I want the configuration to be json or to be named as it is -- arguments for / against welcomed.