檢視原始碼 mix archive.install (Mix v1.16.2)

在本地安裝封存檔。

如果沒有提供參數,但專案根目錄中有封存檔(使用 mix archive.build 建立),則封存檔將會在本地安裝。例如

$ mix do archive.build + archive.install

如果提供了參數,則參數應為預先建立的封存檔、Git 儲存庫、GitHub 儲存庫或 Hex 套件的本地路徑。

$ mix archive.install archive.ez
$ mix archive.install path/to/archive.ez
$ mix archive.install git https://path/to/git/repo
$ mix archive.install git https://path/to/git/repo branch git_branch
$ mix archive.install git https://path/to/git/repo tag git_tag
$ mix archive.install git https://path/to/git/repo ref git_ref
$ mix archive.install github user/project
$ mix archive.install github user/project branch git_branch
$ mix archive.install github user/project tag git_tag
$ mix archive.install github user/project ref git_ref
$ mix archive.install hex hex_package
$ mix archive.install hex hex_package 1.2.3

安裝後,封存檔中的任務將在本地可用

$ mix some_task

請注意,透過 Git、GitHub 或 Hex 安裝會擷取封存檔的原始碼並建立封存檔,而使用本地路徑則會使用預先建立的封存檔。

命令列選項

  • --sha512 - 檢查封存檔是否與指定的 SHA-512 校驗碼相符。僅適用於透過本地路徑安裝

  • --force - 強制安裝,不會顯示 shell 提示;主要用於 Make 等建置系統中的自動化

  • --submodules - 從 Git 或 GitHub 建立封存檔前,擷取儲存庫子模組

  • --sparse - 檢出 Git 儲存庫中的單一目錄,並將其用作封存檔根目錄

  • --app - 指定自訂應用程式名稱,用於從 Git、GitHub 或 Hex 建立封存檔

  • --organization - 設定為屬於組織的 Hex 私人套件

  • --repo - 設定為自架 Hex 執行個體,預設為 hexpm