Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/.vitepress/cli_commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ export const commands: { [key: string]: Command } = {
hide: false,
subcommands: {
bootstrap: {
hide: false,
hide: true,
},
config: {
hide: false,
Expand All @@ -429,6 +429,9 @@ export const commands: { [key: string]: Command } = {
"github-action": {
hide: false,
},
"install-script": {
hide: false,
},
"task-docs": {
hide: false,
},
Expand Down
5 changes: 1 addition & 4 deletions docs/cli/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
- **Source code**: [`src/cli/generate/mod.rs`](https://github.com/jdx/mise/blob/main/src/cli/generate/mod.rs)

Generate files for various tools/services

## Subcommands

- [`mise generate bootstrap [FLAGS]`](/cli/generate/bootstrap.md)
- [`mise generate config [FLAGS] [PATH]`](/cli/generate/config.md)
- [`mise generate devcontainer [FLAGS]`](/cli/generate/devcontainer.md)
- [`mise generate git-pre-commit [FLAGS] [-- MISE_ARG]…`](/cli/generate/git-pre-commit.md)
- [`mise generate github-action [FLAGS]`](/cli/generate/github-action.md)
- [`mise generate install-script [FLAGS]`](/cli/generate/install-script.md)
- [`mise generate task-docs [FLAGS]`](/cli/generate/task-docs.md)
- [`mise generate task-stubs [-d --dir <DIR>] [-m --mise-bin <MISE_BIN>]`](/cli/generate/task-stubs.md)
- [`mise generate tool-stub [FLAGS] <OUTPUT>`](/cli/generate/tool-stub.md)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!-- @generated by usage-cli from usage spec -->
# `mise generate bootstrap`
# `mise generate install-script`

- **Usage**: `mise generate bootstrap [FLAGS]`
- **Usage**: `mise generate install-script [FLAGS]`
- **Effect**: modifies state
- **Source code**: [`src/cli/generate/bootstrap.rs`](https://github.com/jdx/mise/blob/main/src/cli/generate/bootstrap.rs)
- **Source code**: [`src/cli/generate/install_script.rs`](https://github.com/jdx/mise/blob/main/src/cli/generate/install_script.rs)

Generate a script to download+execute mise

Expand Down Expand Up @@ -45,10 +45,10 @@ carry two files.
Examples:

```
$ mise generate bootstrap --write ./bin/mise
$ mise generate install-script --write ./bin/mise
$ ./bin/mise install # downloads mise to .mise if not already installed

# add a launcher for contributors who clone the project on Windows
$ mise generate bootstrap --write ./bin/mise --windows # also writes bin/mise.cmd
$ mise generate install-script --write ./bin/mise --windows # also writes bin/mise.cmd
$ .\bin\mise.cmd install
```
4 changes: 2 additions & 2 deletions docs/cli/generate/task-stubs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Generates shims to run mise tasks

By default, this will build shims like ./bin/&lt;task>. These can be paired with `mise generate bootstrap`
By default, this will build shims like ./bin/&lt;task>. These can be paired with `mise generate install-script`
so contributors to a project can execute mise tasks without installing mise into their system.
When a parent and nested task both exist, the parent stub is written to `<parent>/_default`.

Expand All @@ -23,7 +23,7 @@ Directory to create task stubs inside of

Path to a mise bin to use when running the task stub.

Use `--mise-bin=./bin/mise` to use a mise bin generated from `mise generate bootstrap`
Use `--mise-bin=./bin/mise` to use a mise bin generated from `mise generate install-script`

**Default:** `mise`

Expand Down
2 changes: 1 addition & 1 deletion docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ Can also use `MISE_NO_HOOKS=1`
- [`mise exec [FLAGS] [TOOL@VERSION]… [-- COMMAND]…`](/cli/exec.md)
- [`mise fmt [FLAGS]`](/cli/fmt.md)
- [`mise generate <SUBCOMMAND>`](/cli/generate.md)
- [`mise generate bootstrap [FLAGS]`](/cli/generate/bootstrap.md)
- [`mise generate config [FLAGS] [PATH]`](/cli/generate/config.md)
- [`mise generate devcontainer [FLAGS]`](/cli/generate/devcontainer.md)
- [`mise generate git-pre-commit [FLAGS] [-- MISE_ARG]…`](/cli/generate/git-pre-commit.md)
- [`mise generate github-action [FLAGS]`](/cli/generate/github-action.md)
- [`mise generate install-script [FLAGS]`](/cli/generate/install-script.md)
- [`mise generate task-docs [FLAGS]`](/cli/generate/task-docs.md)
- [`mise generate task-stubs [-d --dir <DIR>] [-m --mise-bin <MISE_BIN>]`](/cli/generate/task-stubs.md)
- [`mise generate tool-stub [FLAGS] <OUTPUT>`](/cli/generate/tool-stub.md)
Expand Down
8 changes: 4 additions & 4 deletions docs/continuous-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Alternatively, you can add the [shims](/dev-tools/shims.md) directory to your `P

### Bootstrapping

An alternative to calling `curl https://mise.run | sh` is to use [`mise generate bootstrap`](/cli/generate/bootstrap.html) to generate a script that runs and install `mise`.
An alternative to calling `curl https://mise.run | sh` is to use [`mise generate install-script`](/cli/generate/install-script.html) to generate a script that runs and install `mise`.
Comment thread
jdx marked this conversation as resolved.
Resolved
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

```shell
mise generate bootstrap -l -w
mise generate install-script -l -w
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
```

Add the `.mise/` to your `.gitignore` and commit the generated `./bin/mise` file. You can now use `./bin/mise` to install and run `mise` directly in CI.
Expand Down Expand Up @@ -134,10 +134,10 @@ build-job:

### Example with the bootstrap script

An alternative is to use [`mise generate bootstrap`](/cli/generate/bootstrap.html) to easily [bootstrap](#bootstrapping) `mise` on GitLab CI.
An alternative is to use [`mise generate install-script`](/cli/generate/install-script.html) to easily [bootstrap](#bootstrapping) `mise` on GitLab CI.

```
mise generate bootstrap -l -w
mise generate install-script -l -w
```

You can now use a generic docker image such as this one to run and install `mise` in CI.
Expand Down
4 changes: 2 additions & 2 deletions docs/public/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@
- [mise env](https://mise.jdx.dev/cli/env.html): Exports env vars to activate mise a single time
- [mise exec](https://mise.jdx.dev/cli/exec.html): Execute a command with tool(s) set
- [mise fmt](https://mise.jdx.dev/cli/fmt.html): Formats mise.toml
- [mise generate](https://mise.jdx.dev/cli/generate.html): Generate files for various tools/services
- [mise generate bootstrap](https://mise.jdx.dev/cli/generate/bootstrap.html): Generate a script to download+execute mise
- [mise generate](https://mise.jdx.dev/cli/generate.html): Generate files for various tools/services - mise generate config [FLAGS] [PATH] - mise generate devcontainer [FLAGS] - mise generate git-pre-commit [FLAGS] [-- MISEARG]… - mise generate github-action…
- [mise generate config](https://mise.jdx.dev/cli/generate/config.html): Generate a mise.toml file
- [mise generate devcontainer](https://mise.jdx.dev/cli/generate/devcontainer.html): Generate a devcontainer to execute mise
- [mise generate git-pre-commit](https://mise.jdx.dev/cli/generate/git-pre-commit.html): Generate a git pre-commit hook
- [mise generate github-action](https://mise.jdx.dev/cli/generate/github-action.html): Generate a GitHub Action workflow file
- [mise generate install-script](https://mise.jdx.dev/cli/generate/install-script.html): Generate a script to download+execute mise
- [mise generate task-docs](https://mise.jdx.dev/cli/generate/task-docs.html): Generate documentation for tasks in a project
- [mise generate task-stubs](https://mise.jdx.dev/cli/generate/task-stubs.html): Generates shims to run mise tasks
- [mise generate tool-stub](https://mise.jdx.dev/cli/generate/tool-stub.html): Generate a tool stub for HTTP-based tools
Expand Down
6 changes: 3 additions & 3 deletions docs/tips-and-tricks.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ the version of mise that was current when the script was created.
## Project-local task entrypoints

If you want contributors to run project tasks without installing mise first, pair
[`mise generate bootstrap`](/cli/generate/bootstrap.html) with
[`mise generate install-script`](/cli/generate/install-script.html) with
[`mise generate task-stubs`](/cli/generate/task-stubs.html):

```sh
mkdir -p bin
mise generate bootstrap --localize --write bin/mise
mise generate install-script --localize --write bin/mise
mise generate task-stubs --mise-bin ./bin/mise
./bin/test
```
Expand All @@ -75,7 +75,7 @@ The generated task stubs behave like small project commands, while `bin/mise`
downloads and runs the pinned mise binary for the project.

If contributors work on Windows, add `--windows`. Windows cannot execute a shebang script, so
`mise generate bootstrap --write ./bin/mise --windows` writes `bin/mise.cmd` alongside it and they
`mise generate install-script --write ./bin/mise --windows` writes `bin/mise.cmd` alongside it and they
run `.\bin\mise.cmd`. The launcher downloads the standalone `mise.exe` for the release and checks it
against a checksum embedded when the script was generated, so it needs nothing beyond what Windows
already ships.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Describe 'generate bootstrap' {
Describe 'generate install-script' {
BeforeAll {
$script:originalPath = Get-Location
# The workflow sets these for the whole job and Pester runs every suite in one process, so
Expand All @@ -18,21 +18,21 @@ Describe 'generate bootstrap' {
Set-Location $script:testDir
$env:MISE_TRUSTED_CONFIG_PATHS = $script:testDir

mise generate bootstrap --localize --write bin/mise --windows | Out-Null
mise generate install-script --localize --write bin/mise --windows | Out-Null
# Without this a generation failure surfaces as every `It` failing on a missing file,
# which says nothing about the cause.
if ($LASTEXITCODE -ne 0) {
throw "mise generate bootstrap failed with exit code $LASTEXITCODE"
throw "mise generate install-script failed with exit code $LASTEXITCODE"
}

# A second project generated without the flag, for the default-off assertion below.
$script:plainDir = Join-Path $TestDrive ([System.Guid]::NewGuid().ToString())
New-Item -ItemType Directory -Path $script:plainDir | Out-Null
Push-Location $script:plainDir
try {
mise generate bootstrap --localize --write bin/mise | Out-Null
mise generate install-script --localize --write bin/mise | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "mise generate bootstrap (no --windows) failed with exit code $LASTEXITCODE"
throw "mise generate install-script (no --windows) failed with exit code $LASTEXITCODE"
}
} finally {
Pop-Location
Expand All @@ -54,7 +54,7 @@ Describe 'generate bootstrap' {
# Windows cannot execute the shebang script, so without this there is nothing to run.
Test-Path 'bin\mise' | Should -BeTrue
Test-Path 'bin\mise.cmd' | Should -BeTrue
(Get-Content 'bin\mise.cmd' -Raw) | Should -BeLike '*rem generated by mise generate bootstrap*'
(Get-Content 'bin\mise.cmd' -Raw) | Should -BeLike '*rem generated by mise generate install-script*'
}

It 'writes only the bash script without --windows' {
Expand All @@ -66,7 +66,7 @@ Describe 'generate bootstrap' {

It 'rejects --windows without --write' {
# stdout cannot carry two files, and a silently ignored flag would read as success.
mise generate bootstrap --windows 2>&1 | Out-Null
mise generate install-script --windows 2>&1 | Out-Null
$LASTEXITCODE | Should -Not -Be 0
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

assert "mise generate bootstrap -w"
assert "mise generate install-script -w"
# shellcheck disable=SC2016
assert_contains "cat ./bin/mise" 'exec -a "$0" "$MISE_INSTALL_PATH" "$@"'
assert "./bin/mise version"
Expand All @@ -11,20 +11,20 @@ assert_fail "test -f ./bin/mise.cmd"

# `--windows` requires `--write`: stdout cannot carry two files, and silently ignoring the flag
# would look like it worked.
assert_fail "mise generate bootstrap --windows"
assert_fail "mise generate install-script --windows"

# `C:foo` is an ordinary directory name here and unrepresentable on Windows, so there is no value
# the launcher could carry. Refused at generate time rather than on the contributor's machine.
assert_fail "mise generate bootstrap -l --localized-dir C:foo -w ./bin/mise-drive --windows" "cannot be carried to Windows"
assert_fail "mise generate install-script -l --localized-dir C:foo -w ./bin/mise-drive --windows" "cannot be carried to Windows"
# The control: without --windows the same directory is still fine, because only the launcher cares.
assert "mise generate bootstrap -l --localized-dir C:foo -w ./bin/mise-drive"
assert "mise generate install-script -l --localized-dir C:foo -w ./bin/mise-drive"

# Windows cannot execute the shebang script, so `--windows` writes a `.cmd` beside it. Generated
# here too, not only on Windows: this file is committed, and whoever runs it on Windows is not the
# person who generated it.
assert "mise generate bootstrap -w --windows"
assert "mise generate install-script -w --windows"
assert_succeed "test -f ./bin/mise.cmd"
assert_contains "cat ./bin/mise.cmd" "rem generated by mise generate bootstrap"
assert_contains "cat ./bin/mise.cmd" "rem generated by mise generate install-script"
# Both architectures, for the same reason -- the generating host does not decide the running one.
assert_contains "cat ./bin/mise.cmd" 'set "sum_x64='
assert_contains "cat ./bin/mise.cmd" 'set "sum_arm64='
Expand All @@ -45,7 +45,7 @@ assert "mise tasks add xxx -- echo 'running xxx'"
assert "mise generate task-stubs --mise-bin ./bin/mise"
assert "./bin/xxx" "running xxx"

assert "mise generate bootstrap -l -w"
assert "mise generate install-script -l -w"
# shellcheck disable=SC2016
assert_contains "cat ./bin/mise" 'exec -a "$0" "$MISE_INSTALL_PATH" "$@"'

Expand Down Expand Up @@ -73,7 +73,7 @@ assert_contains "./bin/mise run my_task" "running other_task"
PATH="$OLD_PATH"

# ./bin/mise is the localized script at this point, so generate a plain one too
assert "mise generate bootstrap -w ./bin/mise-plain"
assert "mise generate install-script -w ./bin/mise-plain"

# a stub at the resolved install path proves which path the script picked: it finds
# a binary there, skips the install, and execs it. Nothing is downloaded.
Expand Down Expand Up @@ -102,6 +102,13 @@ assert "MISE_VERSION=v9999.1.2 ./bin/mise hello" "localized-version-stub hello"
# Shell metacharacters in the path must also stay literal in the generated script.
absolute_localized_dir="$PWD/localized \$dir's cache"
printf -v absolute_localized_dir_arg '%q' "$absolute_localized_dir"
assert "mise generate bootstrap -l --localized-dir $absolute_localized_dir_arg -w ./bin/mise-absolute"
assert "mise generate install-script -l --localized-dir $absolute_localized_dir_arg -w ./bin/mise-absolute"
stub "$absolute_localized_dir/mise-9999.1.2" absolute-localized-stub
assert "MISE_VERSION=v9999.1.2 ./bin/mise-absolute hello" "absolute-localized-stub hello"

# The old name keeps working until it is removed: it was renamed because `mise generate bootstrap`
# read as a form of `mise bootstrap` (machine setup), not because the command changed, and CI
# scripts calling the old spelling must not break.
assert "mise generate bootstrap -w ./bin/mise-old-name"
# shellcheck disable=SC2016
assert_contains "cat ./bin/mise-old-name" 'exec -a "$0" "$MISE_INSTALL_PATH" "$@"'
Loading
Loading