-
Notifications
You must be signed in to change notification settings - Fork 792
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
Use a git repository for installing plugins. #183
Conversation
lib/utils.sh
Outdated
|
||
if [ -d $repository_path ]; then | ||
echo "updating plugin repository..." | ||
(cd $repository_path && git pull) |
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.
For these this of update I think git fetch && git reset --hard origin/master
is more predictable than git pull
.
lib/utils.sh
Outdated
local repository_url=$(asdf_repository_url) | ||
local repository_path=$(asdf_dir)/repository | ||
|
||
if [ -d $repository_path ]; then |
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 will probably fail if $asdf_dir
contains spaces. Adding quotes should do the job.
Thank you very much for the PR, and sorry for the late reply. |
Thanks for the review, I've addressed the feedback and run shellcheck. There are many warnings produced by code I didn't touch; I've only removed all warnings from the code I added or modified. I'd also like to add tests to make sure this works as expected, but I'm not familiar with bats... How hard is it to test this, given that it relies on git? |
Sorry for the delay and thanks for updating! Our tests are not really pure unit tests, and some already rely on git and even on cloning remote repository, so I think it's fine to do the same thing for the parts of this feature that rely on git. If you could just at least maybe add a test for the @asdf-vm/maintainers Thoughts? |
Hm, interesting idea. Yes, please add some tests for this :), I like the idea in general, so I guess the list of available plugins would be inside the main asdf repo ? or shall we have another repo for that?. On my recent dockerized asdf project asdf-alpine I'm holding the plugin url in a simple file like this that gets read by a tiny script. |
@vic The idea would be to create a separate repo to list all available "official" plugins. Contributors could open PRs to that repo to add new plugins. Anyone wanting to add a not-yet-listed plugin could still use the |
@vic @tuvistavie added a simple test for plugin-add with no URL provided. Is that good enough? It does rely on actually cloning the plugins repo and installing a real plugin, rather than a dummy plugin like the other tests. |
@doughsay nice! Code looks ok :) no problem on actually clonning the asdf-repository and the real elixir plugin afterwards. I'm 👍 on this. Would you mind adding the current list of repo urls to the asdf-repository? Also please update the We could move your repository to the asdf-vm org just before releasing this. |
Oh forgot to mention, just add another test for the case where I dont provide the url and the plugin is not registered on the repository. It should just show the error message and exit 1. :) |
Just wondering, once this gets merged, would it be possible to tell people, to just install asdf and afterwards go directly with |
@vic I've added all the current plugins to the plugins repo here: https://github.com/doughsay/asdf-plugins. (I left out the I've also added the extra test and documentation updates you suggested. As for your other comments, it does make sense that all plugin commands could automatically attempt to add a plugin if the plugin doesn't yet exist. Consider typos though, would you want |
@doughsay awesome! Thank you very much. I guess this PR is close to ready. The plugins repo looks nice, no problem on leaving I'd say if only the So I guess it's up to you, if you'd like to implement this, for Anyways, work on this branch looks like done to me, I've downloaded @doughsay asdf to give it a try and the new @doughsay would you mind transferring the asdf-plugins repo to the asdf org? and then just update the url in the code? I guess that would be all for being able to merge this branch. Thank you :) @tuvistavie @asdf-vm/maintainers anything I might be missing? |
People, this is awesome work ~! ❤️ 💚 💙 |
Thanks a lot everyone, for making this awesome tool and for letting me contribute. It's been fun! @vic I tried transferring the ownership of the repository but apparently it won't let me unless I have permission to create new repositories under the organization. If you'd like, you could just create a new empty repository and I'll copy-paste everything I've done into a PR for the new repo. Also, I like your ideas for the As soon as a new repo exists where I can upload the plugin configs, I'll change the URL in this PR. Thanks! |
Ah, I read the fine print a bit more carefully: "Transfer this repository to another user or to an organization where you have the ability to create repositories." That means I could transfer the repo to a user easily, just not an org. Would you like me to transfer it to you @vic, and then you can transfer to the org? |
@doughsay here's the new repo :) https://github.com/asdf-vm/asdf-plugins |
Thanks for working on this, it looks great and will be super useful as we are having more and more plugins. |
URL has been updated, should be ready to go! 👍 |
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.
Looks good! Left comments on a few minor things.
@@ -1,5 +1,5 @@ | |||
MANAGE PLUGINS | |||
asdf plugin-add <name> <git-url> Add git repo as plugin | |||
asdf plugin-add <name> [<git-url>] Add a plugin |
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.
I think the help message here should be a little more detailed. Perhaps something like Add a plugin from the plugin repo OR add a Git repo as a plugin by specifying name and repo url
?
|
||
asdf_repository_url() { | ||
echo "https://github.com/asdf-vm/asdf-plugins.git" | ||
} |
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.
Maybe move this to the top of the file under the asdf_version
function since it's basically a constant.
No need to address those two comments I left during the review. I went and updated master with those changes. Thanks @doughsay ! |
This is my attempt at the proposal I opened: #181
It's using a temporary repository under my account for now: https://github.com/doughsay/asdf-plugins.
Thoughts? Feedback?