gh-cli-for-education / gh-edu

A pluggable extension of gh-cli to assist educators and students using GitHub Education
https://github.com/gh-cli-for-education/TFG-2122-Cristo-Garcia-Gonzalez
3 stars 0 forks source link

troubles with config.json #13

Open crguezl opened 2 years ago

crguezl commented 2 years ago

I pulled the repo (27/06/2022) and installed using a link (gh extension install .)

Then I did:

➜  gh-edu git:(main) ✗ gh edu -h
No configuration file detected
Remote config file detected
Configuration file dowloaded
All commands must have a lastCommit field

Which is because I had already a tuned profile repo, but not compatible with the gh-edu current version. That leads to a couple of questions:

I noticed the file config.json is a plain file downloaded from my gh-edu repo, but there is no way to track from what repo was obtained. I prefer you make a folder config/config.json that is an image of the config repo (i.e. is a local repo from user/gh-edu-profile).

So I decided to remove my gh-edu-profile user repo at GitHub and try it again, remove the extension

➜  gh-edu git:(casiano) ✗ gh extension remove gh-edu
✓ Removed extension edu

and install gh-edu again, this time without the link:

➜  gh-edu git:(casiano) ✗ gh extension install gh-cli-for-education/gh-edu

Clonando en '/Users/casianorodriguezleon/.local/share/gh/extensions/gh-edu'...
remote: Enumerating objects: 5645, done.
remote: Counting objects: 100% (40/40), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 5645 (delta 16), reused 28 (delta 12), pack-reused 5605
Recibiendo objetos: 100% (5645/5645), 5.13 MiB | 5.41 MiB/s, listo.
Resolviendo deltas: 100% (1802/1802), listo.
✓ Installed extension gh-cli-for-education/gh-edu

but the problem repeats:

➜  gh-edu git:(casiano) ✗ gh edu -h
No configuration file detected
Remote config file detected
Internal error: runCommand:  gh repo clone gh-edu-profile /var/folders/t8/zb7yv2x968537k4bjzrm189m0000gn/T/tmp-22371-hkF0yLyvycyd
GraphQL: Could not resolve to a Repository with the name 'crguezl/gh-edu-profile'. (repository)
Internal error: runCommand:  mv /var/folders/t8/zb7yv2x968537k4bjzrm189m0000gn/T/tmp-22371-hkF0yLyvycyd/config.json /Users/casianorodriguezleon/.local/share/gh/extensions/gh-edu/config.json

It says Remote config file detected but I have deleted my config repo and also the error says Could not resolve to a Repository with the name 'crguezl/gh-edu-profile' that I guess is normal, since the repo no longer exists. It does not creates the repo in case it doesn't exist?

GGCristo commented 2 years ago
Compatibility between different versions of the config file?

I am going to do a backward compatibility promise when we reach 1.X version, this means that after that release we will be able to do changes as long as they don't break something. I think this is the best approach for me as the developer and for the plugin developers. With a unique configuration file, it is too easy to fall into a diamond dependency problem.

I prefer you make a folder config/config.json that is an image of the config repo (i.e. is a local repo from user/gh-edu-profile).

I am sorry you are right, we have already talked about this. I will notify you when it is finished.

It says Remote config file detected but I have deleted my config repo

I will look into it, thanks for the issue

GGCristo commented 2 years ago

Since I am changing the configuration file system, what do you think(@crguezl ) if the configuration file is renamed: config.json -> data.json If we think about, it is no longer just a mere configuration file, but it also has cache and data from plugins.

crguezl commented 2 years ago

Agree 👍

GGCristo commented 2 years ago

You can try now the new system, but "view" and "data" plugins are not updated yet, and I have to include this changes in the documentation Now it creates a directory called "data" which is under version control with git. inside of it there is data.json

crguezl commented 2 years ago

Cuando lo pruebe te digo