Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overengineer the installer #61

Merged
merged 28 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3c3a223
Overengineer the installer
pschmitt Nov 14, 2021
c4d3049
Fix #60: Move the installer to scripts/
pschmitt Nov 15, 2021
e7a007a
Add NO_EDIT and NO_TUTORIAL to skip resp. the zshrc edits or the tuto…
pschmitt Nov 15, 2021
ac89282
Update default paths
pschmitt Nov 15, 2021
32d67c4
Move mod-install.sh to scripts/
pschmitt Nov 15, 2021
0742fe9
Only chmod +x the git output script if it was downloaded
pschmitt Nov 15, 2021
c27252c
Remove the last remaining inline color escape sequences
pschmitt Nov 15, 2021
dd70413
We need more emojis.
pschmitt Nov 15, 2021
5253de6
Update scripts/install.sh
alichtman Nov 15, 2021
4c2b461
Update tutorial section
pschmitt Nov 15, 2021
3d8ac20
XDG-ify ZINIT_HOME
pschmitt Nov 15, 2021
52ab2fc
XDG-ify ZINIT_HOME in manpage
pschmitt Nov 15, 2021
0c425c6
🔪 Shorten the tutorial section
pschmitt Nov 15, 2021
428d718
ZPLG -> ZINIT
pschmitt Nov 15, 2021
b9674e2
Add warning about zsh version if < 5.5
pschmitt Nov 15, 2021
6436189
Update zsh version check
pschmitt Nov 15, 2021
fce7912
Add shellcheck
pschmitt Nov 16, 2021
587b540
Fix shellcheck issues
pschmitt Nov 16, 2021
e6c48ac
Fix install.sh URL (don't hardcode the branch name)
pschmitt Nov 16, 2021
6eb36d0
Add new installer section to the CHANGELOG
pschmitt Nov 16, 2021
5f6a254
Fix typo
alichtman Nov 16, 2021
f4588c8
zinit installs on windows (cygwin)
pschmitt Nov 16, 2021
efb25ce
Add FIXME notice in regards to windows artifacts
pschmitt Nov 16, 2021
cd4f759
Merge remote-tracking branch 'upstream/master' into installer-ng
pschmitt Nov 16, 2021
74ee939
Update git-process-output.zsh url
pschmitt Nov 16, 2021
7bbeb17
Enable macOS checks
pschmitt Nov 16, 2021
e099e23
Leverage tilde expansion for artifact files
pschmitt Nov 16, 2021
437b071
Sort steps
pschmitt Nov 16, 2021
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
126 changes: 126 additions & 0 deletions .github/workflows/installer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: zinit installer
on: [push, workflow_dispatch]

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: './scripts'

zinit-installer:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# TODO: macOS (jobs hang...)
# TODO: Windows...
# os: [ubuntu-latest, macos-11]
# os: [ubuntu-latest, macos-latest, windows-latest]
annexes: ["with-annexes", "without-annexes"]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Grab git slugs (short commit id, branch etc.)
uses: rlespinasse/github-slug-action@v3.x

- name: Install dependencies (ubuntu)
if: startsWith(matrix.os, 'ubuntu-latest')
run: |
sudo apt-get update
sudo apt-get install -y curl git zsh

- name: Install dependencies (macOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install curl git zsh

- name: Install zinit (with annexes)
if: matrix.annexes == 'with-annexes'
run: |
export ZINIT_COMMIT="$GITHUB_SHA"
export ZINIT_REPO="$GITHUB_REPOSITORY"
export ZINIT_BRANCH="$GITHUB_REF_SLUG"
export NO_INPUT=true

sh -x ./scripts/install.sh

- name: Install zinit (w/o annexes)
if: matrix.annexes == 'without-annexes'
run: |
export ZINIT_COMMIT="$GITHUB_SHA"
export ZINIT_REPO="$GITHUB_REPOSITORY"
export ZINIT_BRANCH="$GITHUB_REF_SLUG"
export NO_INPUT=true
export NO_ANNEXES=true

sh -x ./scripts/install.sh

- name: Upload zshrc and zinit files
uses: actions/upload-artifact@v2
with:
name: zinit-config-${{ matrix.os }}-${{ matrix.annexes }}
path: |
/home/runner/.zshrc
/home/runner/.local/share/zinit

- name: Test zinit install
run: |
export TERM=xterm
zsh -silc 'zinit --help; exit $?'

# TODO: DRY!
# Re-using steps in GH Actions is a pain though.
zinit-updater:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# TODO: macOS (jobs hang...)
# TODO: Windows...
# os: [ubuntu-latest, macos-11]
# os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Grab git slugs (short commit id, branch etc.)
uses: rlespinasse/github-slug-action@v3.x

- name: Install dependencies (ubuntu)
if: startsWith(matrix.os, 'ubuntu-latest')
run: |
sudo apt-get update
sudo apt-get install -y curl git zsh

- name: Install dependencies (macOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install curl git zsh

- name: Install previous zinit version (${{ github.event.before }})
env:
PREVIOUS_COMMIT: ${{ github.event.before }}
run: |
export ZINIT_COMMIT="$PREVIOUS_COMMIT"
export ZINIT_REPO="$GITHUB_REPOSITORY"
export ZINIT_BRANCH="$GITHUB_REF_SLUG"
export NO_INPUT=true

./scripts/install.sh

- name: Update zinit from ${{ github.event.before }} to ${{ github.sha }}
run: |
export ZINIT_COMMIT="$GITHUB_SHA"
export ZINIT_REPO="$GITHUB_REPOSITORY"
export ZINIT_BRANCH="$GITHUB_REF_SLUG"
export NO_INPUT=true

./scripts/install.sh
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,28 +147,30 @@ read it to get the most out of Zinit.
The easiest way to install Zinit is to execute:

```zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/doc/install.sh)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
```

This will install Zinit in `~/.zinit/bin`.
This will install Zinit in `~/.local/share/zinit/zinit.git`.
`.zshrc` will be updated with three lines of code that will be added to the bottom.
The lines will be sourcing `zinit.zsh` and setting up completion for command `zinit`.

After installing and reloading the shell compile Zinit with `zinit self-update`.

### Manual Installation

To manually install Zinit clone the repo to e.g. `~/.zinit/bin`:
To manually install Zinit clone the repo to e.g. `~/.local/share/zinit/zinit.git`:

```sh
mkdir ~/.zinit
git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
```

and source it from `.zshrc` (above [compinit](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization)):
and source `zinit.zsh` from your `.zshrc` (above [compinit](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization)):

```sh
source ~/.zinit/bin/zinit.zsh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"
```

If you place the `source` below `compinit`, then add those two lines after the `source`:
Expand Down Expand Up @@ -920,7 +922,8 @@ after `compinit` will be called (and the original `compdef` function will become
available), to execute all detected `compdef` calls. To summarize:

```zsh
source ~/.zinit/bin/zinit.zsh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"

zinit load "some/plugin"
...
Expand Down Expand Up @@ -963,7 +966,8 @@ helper functions (`zicompinit`,`zicdreplay` & `zicdclear` – see below for expl
of the last one). To summarize:

```zsh
source ~/.zinit/bin/zinit.zsh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share/zinit}"
source "${ZINIT_HOME}/zinit.zsh"

# Load using the for-syntax
zinit wait lucid for \
Expand All @@ -982,7 +986,9 @@ before commands loading other plugins or snippets, and issue `zinit cdclear` (or
`zicdclear`, designed to be used in hooks like `atload''`):

```zsh
source ~/.zinit/bin/zinit.zsh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"

zinit snippet OMZP::git
zinit cdclear -q # <- forget completions provided by Git plugin

Expand Down Expand Up @@ -1035,7 +1041,7 @@ To install just the binary Zinit module **standalone** (Zinit is not needed, the
other plugin manager), execute:

```zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/doc/mod-install.sh)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/mod-install.sh)"
```

This script will display what to add to `~/.zshrc` (2 lines) and show usage instructions.
Expand Down Expand Up @@ -1081,8 +1087,8 @@ declare -A ZINIT # initial Zinit's hash definition, if configuring before loadi

| Hash Field | Description |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ZINIT\[BIN_DIR\] | Where Zinit code resides, e.g.: "~/.zinit/bin" |
| ZINIT\[HOME_DIR\] | Where Zinit should create all working directories, e.g.: "~/.zinit" |
| ZINIT\[BIN_DIR\] | Where Zinit code resides, e.g.: "~/.local/share/zinit/zinit.git" |
| ZINIT\[HOME_DIR\] | Where Zinit should create all working directories, e.g.: "~/.local/share/zinit" |
| ZINIT\[MAN_DIR\] | Directory where plugins can store their manpages (`atclone"cp -vf myplugin.1 $ZINIT[MAN_DIR]/man1"`). If overridden, this directory will not necessarily be used by `man` (See #8). Default: `$ZPFX/man` |
| ZINIT\[PLUGINS_DIR\] | Override single working directory – for plugins, e.g. "/opt/zsh/zinit/plugins" |
| ZINIT\[COMPLETIONS_DIR\] | As above, but for completion files, e.g. "/opt/zsh/zinit/root_completions" |
Expand All @@ -1092,7 +1098,7 @@ declare -A ZINIT # initial Zinit's hash definition, if configuring before loadi
| ZINIT\[MUTE_WARNINGS\] | If set to `1`, then mutes some of the Zinit warnings, specifically the `plugin already registered` warning |
| ZINIT\[OPTIMIZE_OUT_DISK_ACCESSES\] | If set to `1`, then Zinit will skip checking if a Turbo-loaded object exists on the disk. By default Zinit skips Turbo for non-existing objects (plugins or snippets) to install them before the first prompt – without any delays, during the normal processing of `zshrc`. This option can give a performance gain of about 10 ms out of 150 ms (i.e.: Zsh will start up in 140 ms instead of 150 ms). |

There is also `$ZPFX`, set by default to `~/.zinit/polaris` – a directory
There is also `$ZPFX`, set by default to `~/.local/share/zinit/polaris` – a directory
where software with `Makefile`, etc. can be pointed to, by e.g. `atclone'./configure --prefix=$ZPFX'`.

## Non-GitHub (Local) Plugins
Expand Down Expand Up @@ -1135,7 +1141,7 @@ zinit as"null" wait"1" lucid for \

```

Target directory for installed files is `$ZPFX` (`~/.zinit/polaris` by default).
Target directory for installed files is `$ZPFX` (`~/.local/share/zinit/polaris` by default).

# Supporting

Expand Down
19 changes: 18 additions & 1 deletion doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@
# Changelog
All notable changes to this project will be documented in this file.

* 16-11-2021
- A brand-new installer has been developped. A few new features have been
alichtman marked this conversation as resolved.
Show resolved Hide resolved
added. There are a bunch of new env vars you can set:

- `NO_INPUT=1`: non-interactive mode (`NO_INPUT=1`)
- `NO_EDIT=1`: do not modify `.zshrc`
- `ZSHRC=/home/user01/.config/zsh/zshrc`: custom path to your `.zshrc`
- `ZINIT_REPO=zdharma-continuum/zinit`: Install zinit from a custom GitHub repo
- `ZINIT_BRANCH=master`: zinit branch to install
- `ZINIT_COMMIT=master`: zinit commit to install (takes precedence over `ZINIT_BRANCH`)
- `ZINIT_INSTALL_DIR=~/.local/share/zinit/zinit.git`: Where to install the zinit repo

⚠️ Please note that the download URL for the installer has changed. It is now:
https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh

For more details check out [PR #61](https://github.com/zdharma-continuum/zinit/pull/61)

* 11-11-2021
- The annexes repos have been renamed to improve discoverability. They used to
be called `z-a-${name}` and have been renamed to `zinit-annex-${name}`. You
Expand Down Expand Up @@ -358,7 +375,7 @@ startup. Please note that these directories will not necessarily be part of your

In other words, instead of `wait'1'` you can enter `wait'1a'`,
`wait'1b'` and `wait'1c'` – to this way **impose order** on the loadings
**regardless of the order of `zplugin` commands**.
**regardless of the order of `zplugin` commands**.
* 26-05-2019
- Turbo-Mode now divides the scheduled events (i.e. loadings of plugins or snippets)
into packs of 5. In other words, after loading each series of 5 plugins or snippets
Expand Down
Loading