This is the basic configuration of Cask.Toml
.
[package]
name = "github.com/<username>/<repo>"
bin = "gpm"
repository = "https://github.com/<username>/<repo>"
description = """
description of package.
"""
[darwin]
x86_64 = "{package.repository}/releases/download/v{version}/{package.bin}_darwin_amd64.tar.gz"
[windows]
x86_64 = "{package.repository}/releases/download/v{version}/{package.bin}_windows_amd64.tar.gz"
[linux]
x86_64 = "{package.repository}/releases/download/v{version}/{package.bin}_linux_amd64.tar.gz"
Full configuration example
[package]
name = "github.com/<username>/<repo>"
bin = "gpm"
repository = "https://github.com/<username>/<repo>"
description = """
description of package.
"""
[context]
foo = "bar"
hello = "world"
[darwin]
x86_64 = "{package.repository}/releases/download/v{version}/{package.bin}_darwin_amd64.tar.gz"
[windows]
x86_64 = "{package.repository}/releases/download/v{version}/{package.bin}_windows_amd64.tar.gz"
[linux]
x86_64 = "{package.repository}/releases/download/v{version}/{package.bin}_linux_amd64.tar.gz"
[hook.windows.cmd]
postinstall = """
echo "hello postinstall from cmd"
echo "{context.foo}"
"""
[hook.unix.sh]
postinstall = """
echo "hello postinstall from sh"
echo "{context.bar}"
"""
As you can see, it only contains a few top-level fields:
Field | Description | required |
---|---|---|
package | Defined the information of package | true |
darwin | The information of macOS platform | |
linux | The information of Linux platform | |
windows | The information of Windows platform | |
freebsd | The information of FreeBSD platform | |
hook.windows | The hook for windows | |
hook.unix | The hook for unix | |
hook.linux | The hook for linux | |
hook.macos | The hook for macos | |
hook.freebsd | The hook for freebsd |
Field | Description | type | required | example |
---|---|---|---|---|
name | The name of package | string | true | "github.com/axetroy/gpm.rs" |
description | The description information of package | string | true | "The description" |
bin | The non-extension binary name of package | string | true | "gpm" |
repository | The repository url of package | string | true | "https://github.com/axetroy/gpm.rs.git" |
versions | The versions without 'v' prefix of package. The latest version at the head. Cask will get versions from repository tags if not provide. |
Array<string> | ["0.1.12", "0.1.11"] |
|
authors | The authors of package package | Array<string> | ["Axetroy <axetroy.dev@gmail.com>"] |
|
keywords | The keywords of package | Array<string> | ["foo", "bar"] |
|
license | The license of package | string | "MIT" |
|
homepage | The homepage of package | string | "https://example.com" |
Current Support the arch:
- x86
- x86_64
- arm
- armv7
- aarch64
- mips
- mips64
- mips64el
- riscv64
Every arch got a Resource Target Object
The target resource can be one of following types:
- String: tarball URL
The resource URL that will be download and extract. The tarball format support .tar
/.tgz
/.tar.gz
/.tar.bz2
/.zip
[darwin]
x86_64 = "https://github.com/<username>/<repo>/releases/download/v{version}/darwin_amd64.tar.gz"
- Object: tarball URL detail with more information
Field | Description | type | required | example |
---|---|---|---|---|
url | The url of resource that will be download | string | true | |
checksum | The checksum(SHA256) of resource. Check checksum if provided. | string | ||
extension | The resource extension. Specify the extension of resource | string | ".tar.gz" | |
path | The folder that binary file locate in the tarball | string | "/sub-folder" |
The extension support .tar
/.tgz
/.tar.gz
/.tar.bz2
/.zip
[darwin]
x86_64 = { url = "https://github.com/<username>/<repo>/releases/download/v{version}/darwin_amd64.tar.gz", checksum = "15f841b9b8f60033528dfdce5883e622145911ede1f59d1f302042ded4c565a4", extension = ".tar.gz" }
- Object: executable file URL
Field | Description | type | required | example |
---|---|---|---|---|
executable | The url of resource of executable that will be download | string | true | |
checksum | The checksum(SHA256) of resource. Check checksum if provided. | string |
[darwin]
x86_64 = { executable = "https://github.com/<username>/<repo>/releases/download/v{version}/executable" }
Terminal | Description | type | required | example |
---|---|---|---|---|
cmd | cmd.exe | Hook | ||
powershell | PowerShell | Hook | ||
sh | sh | Hook | ||
bash | bash | Hook |
Hook | Description | type | required | example |
---|---|---|---|---|
preinstall | The script will run before install package | string | ||
postinstall | The script will run after install package | string |
[hook.windows.cmd]
preinstall = """
echo "running preinstall hook"
"""
postinstall = """
echo "running postinstall hook"
"""