While Rulid currently has a single implementation, nothing is stopping you from making another one and interoperating with us. After all, nothing is better than standards.

Rulid support dependencies from local directories, and local package files. Use cases for this include development, monorepos and network shares with internal packages.

The web is inherently decentralized. Rulid lets you take full advantage of that by being able to fetch packages from any URL.

Centralized package managers have problems with deleted packages. Once you pin an IPFS package with Rulid, it should be available from any peer that has it in the cache.

Rulid has experimental support for package distribution over IPFS. This means once you pin a package, you can securely fetch it in a P2P fashion.

Rulid has first-class support for decentralized packages. Compared to traditional package managers that fetch their packages from a central repository; Rulid lets you download and distribute packages from any repository.

If you have installed Rulid correctly, you should be able to build this program by typing rulid build .

Here's an example to get you going with Rulid. We'll build a program that generates numbers using a PRNG. Create an empty directory and put two files in it.

Adding dependencies

You can install dependencies to your package by adding a line to your pkgmeta file. Dependency lines are made up of three main parts; name, method and locator. Let's head back to the previous section and and take a closer look at the dependency there.

dep lcg index lcg_rand

This can be read roughly as; using the index, find the package called lcg_rand and add it to my project as lcg. Even though the actual package name is lcg_rand, we can use it in our Rust code under a different name. While this sounds like it can get really messy, it is actually a really powerful construct that lets you swap libraries that implement the same interface.

Let's take a closer look at the various methods we can use to resolve our dependencies.

Path

This one is used mostly for local development. It references an un-packaged local path as a dependency.

dep random path ../test-random-generator

This line will build the library on the directory you specify, and import it to your project under the name random.

Local

This method references a packaged dependency on the local filesystem. It needs the dependency to be packaged in a tar.gz file, but it is otherwise similar to the Path method.

dep random local /home/leo/deps/enterprise-random.tar.gz

This line imports the package enterprise-random.tar.gz as random.

URL

The URL method downloads a package from a given URL, unpacks it to a temporary folder, and imports it to your project after building it.

dep random url https://gkbrk.com/packages/super-random.tar.gz

IPFS

The future is here. The IPFS method can fetch packages over the P2P IPFS network, and transparently import them to your project. While this method is currently experimental, it is not expected to be too unstable.

dep random ipfs Qmaz5Foih95PyW3DRobzqEtReNd2CiVEtXDK12BMjy6PNH

Remember the example project you built on Getting Started? That dependency actually came from IPFS.

Index

This method finds a package name in the Package Index. The index is basically a text file that point to other methods. A package can be referred to by a common name in the index, but the package can be updated, moved or load balanced.

dep random index lcg_rand