-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Add possibility to clone KSP installs and create dummy ones #2627
Conversation
That could certainly simplify the validation scripts: |
Added option to choose version Added option to fake DLC too (default = true) Added option to choose path Added option to choose name for KSP instance Add new fake instance to known instances
Added some features, |
General thought here, but would we ever want this capability in GUI or ConsoleUI? If so, it would make sense to migrate the business logic into Core and reduce the CmdLine code to just calling into it. Not sure about the answer to that myself, this might make sense as a text-only utility thing. EDIT: One argument in favor of that idea is that we could write Tests to make sure the command works correctly. |
Thought about this too. Maybe some users want to test mod configurations and dependencies and stuff without manipulating their main KSP directory. |
Ooh, don't suppose you could expand it into a more generic "clone install" command with a "--dummy" option to make the new install a blank one? |
I can see the reason behind a "clone install", but I think it's a bit counter-intuitive to use a flag behind "clone" to create a new (dummy) instance. In "clone" you want to copy an existing one (which is kinda the definition of the word), in "--dummy"/"fake" you create an entirely new one. |
Do we have a "mapVersionToBuild" function somewhere? So is a function that does this already implemented anywhere, or do I have to write a new one? |
Ok. I do think there's sense in generalizing the core modules to perform the task, though. They're both about creating a new KSP installation based on a given image. Just that one image is a virtual one. |
I don't believe a function exists to get build IDs. Looks like it wouldn't be too tough using If the patch portion is missing, we should probably print an error so the user knows they have to choose between 1.5.0 and 1.5.1. |
Thanks. I thought about autocompletion with a 0 if the patch is missing, so "1.5" is parsed to "1.5.0", because 1.5 is a more natural way to say it. |
@politas So you mean moving the new feature to "core" as @HebaruSan proposed, but with the "clone" function and the "fake" function all in one, and running Did I get this right? |
Move most of the feature's code there Add logging Create new AddBuildToVersion in Versioning.KspVersion to get the correct build number for a specific version.
So my last commit moved most of the fake-code to I've decided to split A new Also addded some logging. |
Added CKAN.Utilities class with CopyDirectory() function Added Versioning.KspVersion.IsValid() to ensure a specified version is valid. Added a lot of checks and exceptions and whatsoever. Still needs unit tests.
Sooooo, I changed quite a bit again. Edit: I actually found the |
Will the following command work? |
No, currently it only accepts instance names known in the registry. |
I overlooked that we do check Edit: In my last commit I added @politas suggestion to be able to clone by path. Also added the first two tests. The one for More edit: I found that the error is thrown at the end of the test, when the KSP instance is disposed. More more Edit: I now created a regular
|
Searching build number now reversed in AddBuildToNumber(). Skip buildID.txt and buildID64.txt in FakeInstance() if no build defined. Restructured exception handling in FakeInstance and CloneInstance -> more test-friendly Added first two tests.
Fixed some errors
So, if no one finds something to correct, to change or to add anymore, I would say this is ready to merge. |
The only reason we ask for a BuildID.txt when adding a KSP install is to be able to use the File Selector rather than the directory selector dialogue, because it works way better. |
Cool! Now we just need to add it to the GUI interface. |
@DasSkelett , FYI, the validation scripts are now set up to use this, and working fine! |
As I am a responsible developer and always test my changes on multiple systems before release...Because I am currently out of reach of my PC (christmas, family and useless stuff like this), I tried to work on CKAN a bit from a device with no KSP install.
But CKAN is rather bitchy about having a correct KSP install, and doesn't even let you in the GUI (which is the correct behavior in my opinion).
So to solve this issue, I added the
ckan ksp fake
command to create a dummy KSP directory, containing a GamaData folder, abuildID.txt
, abuildID64.txt
and areadme.txt
.This should also be useful for quick tests of mod related issues.
Following options are implemented:
_fakeKSP
is created inside the folder from which the command is executed)Side effects:
CopyDirectory()
function to properly copy a folder with all subfolders. Implemented as a transaction.FindKnownVersion()
function to find a build number for a ksp versionInBuildMap()
bool to check if a version is in the build map.Right now the command structure is as follows:
ckan ksp fake [commonOptions] name path version dlcVersion
KspVersion.Parse()
(i.e. e.g.1.5.1
)And:
ckan ksp clone [commonOptions] instanceNameOrPath newname newpath
ckan ksp list
) or the path to it