nest 是一个包管理器,用于安装使用 Swift 构建的可执行二进制文件。
$ nest install realm/SwiftLint
📦 Found an artifact bundle, SwiftLintBinary-macos.artifactbundle.zip, for SwiftLint.
🌐 Downloading the artifact bundle of SwiftLint...
✅ Success to download the artifact bundle of SwiftLint.
🪺 Success to install swiftlint.
$ nest install XcodesOrg/xcodes
🪹 No artifact bundles in the repository.
🔄 Cloning xcodes...
🔨 Building xcodes for 1.4.1...
🪺 Success to install xcodes.
nest 尚未达到 1.0.0 版本。它可能会破坏向后兼容性。
nest 的灵感很大程度上来源于 mint 和 scipio。
mint 是一个用于安装和运行可执行 Swift 包的工具。这个工具非常出色,但是它需要首先构建包。在像 Xcode Cloud 这样缓存不可用的 CI 环境中,构建时间不可忽略。
scipio 是一个用于生成和重用 xcframeworks 的工具。该工具通过从远程存储获取 XCFrameworks 并重用它们,大幅缩短了预构建框架的构建时间。
nest 采纳了这些工具的概念,并重用 artifact bundle 以减少构建时间。如果 GitHub 发布版本中存在 artifact bundle,nest 会下载 artifact bundle 并安装 bundle 中的可执行二进制文件。否则,nest 会克隆并构建包,然后安装可执行二进制文件。
运行此命令。此脚本会下载此仓库的最新 artifact bundle,并使用 artifact bundle 中的 nest 安装 nest。
curl -s https://raw.githubusercontent.com/mtj0928/nest/main/Scripts/install.sh | bash
$ nest install realm/SwiftLint
$ nest install realm/SwiftLint 0.55.0 # A version can be specified.
$ nest install https://github.com/realm/SwiftLint 0.55.0
$ nest uninstall swiftlint # All versions of swiftlint are uninstalled.
$ nest uninstall swiftlint 0.55.0 # A verision can be specified.
$ nest list
如果安装了命令的多个版本,您可以切换链接的版本。
$ nest switch swiftlint 0.55.0 // swiftlint 0.55.0 are selected.
nest
支持使用名为 nestfile 的配置文件一次性安装多个包,该文件需要以 YAML 格式编写。
generate-nestfile
命令会在当前目录中生成基本的 nestfile。
$ nest generate-nestfile
然后添加对目标的引用。
nestPath: ./.nest
targets:
# Example 1: Specify a repository
- reference: mtj0928/nest # or htpps://github.com/mtj0928/nest
version: 0.1.0 # (Optional) When a version is not specified, the latest release will be used.
assetName: nest-macos.artifactbundle.zip # (Optional) When a name is not specified, it will be resolved by GitHub API.
checksum: adcc2e3b4d48606cba7787153b0794f8a87e5289803466d63513f04c4d7661fb # (Optional) This is recommended to add it.
# Example 2 Specify zip URL directly
- zipURL: https://github.com/mtj0928/nest/releases/download/0.1.0/nest-macos.artifactbundle.zip
checksum: adcc2e3b4d48606cba7787153b0794f8a87e5289803466d63513f04c4d7661fb # (Optional) This is recommended to add it.
registries:
github:
- host: my-github-enterprise.example.com
tokenEnvironmentVariable: "MY_GHE_TOKEN"
最后运行 bootstrap
命令。该命令会一次性安装 nestfile 中的所有 artifact bundle。
$ nest bootstrap nestfile.yaml
nest 提供了两个实用程序命令:update-nestfile
和 resolve-nestfile
。
update-nestfile
命令通过更新版本并填写校验和以及 asset 名称来覆盖 nestfile。
$ nest update-nestfile nestfile.yaml
resolve-nestfile
是一个类似的命令,但当指定版本时,它不会更新版本。
nest
默认将 artifact 存储在 ~/.nest
中。如果您想更改目录,请更新 $NEST_PATH
或在配置文件中指定 nestPath
(仅限 bootstrap
)。
由于 API 限制,获取发布版本有时会失败,因此我们建议传递 GitHub API 令牌。
最简单的方法是传递 GH_TOKEN
或 GHE_TOKEN
环境变量。nest 将使用此令牌用于 GitHub.com 或任何其他 GitHub Enterprise 服务器。
如果您想为 GitHub Enterprise 使用令牌,则可以在 Nestfile 的 registries
部分中指定环境变量的名称。
nest 将自动解析环境变量以从每个服务器获取。
registries:
github:
- host: github.com
tokenEnvironmentVariable: "MY_GH_TOKEN"
- host: my-github-enterprise.example.com
tokenEnvironmentVariable: "MY_GHE_TOKEN"
如果未设置该值,则在可用时改用 GH_TOKEN
。
鸟巢是雨燕存放它们作品的地方。