Creating the project
To create a DUB compatible project, the easiest way is to use the dub executable.
$ dub init myproject will create a new folder
myproject that contains the recommended skeleton and a basic
dub.json file. Running
$ dub from this directory will build and run the empty project.
You should then adjust
dub.json to fit the project. Especially the "authors", "copyright", "license" and "description" fields should be properly filled out before publishing. For details about the format of this file, see the package format page.
Registering with the registry
If you want to publish your project, simply put the contents into a repository and push it to GitHub, GitLab or Bitbucket. You can then register an account and register the package using your GitHub/GitLab/Bitbucket user name (or organization) and the project name. Anyone who adds the name of your project as a dependency to his/her package description will automatically have the contents of your git repository available to his/her project.
The repository will be monitored for changes and new version tags. To add a new version, just create a tag with a name of the form
v1.2.3, where 1.2.3 should be changed to the actual version number. About twice per hour, the repository will be queried for new tags and any detected version will be made available on the registry.
Furthermore, all named branches will be available as special rolling versions of the form
~master (in case of the git "master" branch). However, those should never directly be used to refer to dependencies. Use those only in dub.selections.json or for version overrides (
$ dub add-override).
The DUB registry project can also be used as a private service. The settings file can be configured with credentials for a private repository hosting service instance, so that packages are fetched from the LAN, or from a private cloud based repository. Once a private instance is set up, all DUB clients need to be configured to make use of it by adding a
"registryUrls": ["http://dubregistry.example.com/"] field with the appropriate URL(s) to
AppData/Roaming/dub/settings.json on Windows.