Babel - Nimrod's package manager
written on 24/06/2014 17:40
I recently released Babel version 0.4.0 on Github. Babel is the official package manager for the Nimrod programming language. With this release I decided it's time to talk about how far Babel has come since its initial release. Myself and the rest of the Nimrod community have been working very hard on getting the design of Babel just right, it took us 3 iterations and a lot of hard work to get to where we are now. Package managers are notoriously hard to get right but they are very important tools and I am happy with the results!
Babel is a very lightweight package manager that uses your filesystem to determine the packages that are installed already. It focuses on ease of implementation, so even if something goes wrong it's easy to circumvent. It supports the 3 major operating systems and likely works on the lesser known ones also.
You can build it from source by simply cloning the repository and using the Nimrod compiler to compile it, like so:
$ git clone https://github.com/nimrod-code/babel.git $ cd babel $ nimrod c src/babel
It's important to note that Babel requires Nimrod and git to be in your PATH. As well as mercurial if you wish to use packages hosted on mercurial repositories.
All Babel packages must currently be hosted on a git or mercurial repository and must contain a ini-formatted file named after your package with the
.babel extension. These files contain information about your package: including its name, author name, license, dependencies and more.
Registering packages in the Babel package repository allows you to install the package by name. If a package is not registered in this package repository then it can still be installed via its git or hg URL. This is useful if you wish to keep your package private, or if its not suited for the package repository.
Babel determines package versions by the tags present in the git and hg repositories. In addition to being able to specify a version range when installing a package (
babel install commandeer@"> 0.1"), you can also specify a commit hash (
babel install commandeer@#26b6c035b6c). This is of course more useful when specifying dependencies for your package and is done in a similar matter. An example .babel file follows:
[Package] name = "foobar" version = "0.1.0" author = "Your Name" description = "Example .babel file." license = "MIT" [Deps] Requires: "nimrod >= 0.9.4, commandeer > 0.1, https://github.com/runvnc/bcryptnim.git#head"
Babel ensures these dependencies are met when installing the package.
Babel also makes sure that these dependencies are not deleted with the use of
babel uninstall as long as a package which depends on them is installed. Attempting to uninstall commandeer after installing
foobar will be met with an error.
I also hope that you will use this as an excuse to try out the Nimrod programming language if you haven't done so already! Exciting things are happening in the world of Nimrod and you should definitely give it a spin!