Binary dependency management that's easy to pick-up!
brew tap mazyod/homebrew-truck
brew install truck
# or ...
brew install mazyod/homebrew-truck/truck
# upgrade truck after initial installation
brew upgrade truck
As iOS developers using Carthage for dependency management, we quickly hit a roadblock trying to distribute pre-built binaries with our repo. Even when trying to use Carthage binary specification, Carthage complained when the pre-built binary was a static framework.
Regardless, we wanted something simple, straight-forward, and mostly automated for our team to use.
The way Truck aims to solve this problem is by having a versions specification file somewhere in the cloud, pointing to different compressed archives, which clients can download based on their version requirements. Done.
Currently, Truck supports Github releases as a hosting service. To configure truck for publishing, two things are required:
~/.truckrc
file that contains Github access token (with repo access).truck-author.json
in a local directory where you want to manage your Truck "targets".- Only if using Github, create a
truck
tag on your hosting repo, which we will upload the files under.
// .truckrc blueprint
{
"GITHUB_TOKEN": "(access token with repo access)"
}
You can simply do truck add Blah whatever
, and truck should create a stub .truckrc
configuration file for you to fill in. Then, you can use truck init
to prepare the truck-author.json
file:
$ truck init # creates truck-author.json
# in truck-author.json, specify the github user and repo that will host the files.
To publish a "Target", you'll need a Truck configuration file and a Target spec file..
$ truck add MyTarget some/path/
$ truck add MyTarget some/file.ext
# we just authored MyTarget-spec.json with some/path/ folder and some/file.ext
$ truck release MyTarget "3.2.5"
# this pushes MyTarget.json to the basepath, and the specified files as a zip to some predefined path
# MyTarget.json will contain an entry "3.2.5" pointing to the zip file location for clients to download
For clients consuming your dependencies, it is as simple as creating a truck.json
file with the following format:
[
{
"url": "https://github.com/user/repo/releases/download/truck/target.json",
"version": "3.2.5"
}
]
... Then, running truck sync
!
This will download dependencies into Truck/Tmp
, then extract the archives into Truck/TARGET_NAME
.