Skip to content

How to create a Provider

Yann Stepienik edited this page Jul 17, 2019 · 5 revisions

How to create a Provider

Creating a GuPM provider, will add the support to any possible repository out there, for you to install packages. And it is a lot easier than it sound!

You can check the official repository for examples: https://github.com/azukaar/GuPM-official

First, let's setup our folder. Use this command at the root of a new Git repo:

git init
g pl create

This will create a folder for your provider. By default, this provider will publish itself in the docs/ folder of your repo (Using GitHub pages as a repo).

The Install command for you plugin will be :

g plugin install https://yourRepo:yourPackage

But for now, we do not need to install it, simply link it.

cd provider-NameOfTheProvider
g pl link

This will create a symlink between the current folder and the plugin folder. In order to "hook" into GuPM, all you have to do is to create .gs files in this folder based on the hook list.

The only one that is necessary to implement is resolveDependencyLocation (By default it will only use the name as a url). You can alternatively implement getDependency if your repo doesn't support grabbing package by HTTP.

// resolveDependencyLocation.g

Dependency.url = "http://someServer.com/" + Dependency.name + "/" + Dependency.version

Dependency;

Finally, when your plugin is ready, simply publish it. In the provider's folder, execute :

g publish

Go back to the root of the git repo, and push your branch. Don't forget to write a friendly Readme, and let us know you created a plugin!

Clone this wiki locally