Skip to content

Commit 93ca4a7

Browse files
authored
Merge pull request #341 from lets-cli/codex/implement-issue-121
Update install script for home-directory defaults
2 parents 96c2fb2 + abcbd1b commit 93ca4a7

9 files changed

Lines changed: 812 additions & 152 deletions

File tree

docs/docs/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ title: Changelog
55

66
## [Unreleased](https://github.com/lets-cli/lets/releases/tag/v0.0.X)
77

8+
* `[Changed]` Install script now installs to `$HOME/.lets/bin`, exposes `lets` through a user PATH symlink, and stops on old non-Homebrew `/usr/local/bin/lets` installs. Issue [#121](https://github.com/lets-cli/lets/issues/121)
89
* `[Fixed]` Prevent `lets self upgrade` from overwriting Homebrew-managed installs. Issue [#338](https://github.com/lets-cli/lets/issues/338)
10+
* `[Fixed]` `lets self upgrade` now updates symlink targets and refuses common system-managed install paths.
911

1012
## [0.0.60](https://github.com/lets-cli/lets/releases/tag/v0.0.60)
1113

docs/docs/development.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,26 @@ have stable `lets` version untouched.
1111
To build a binary:
1212

1313
```bash
14-
go build -o lets-dev *.go
14+
go build -o lets-dev ./cmd/lets
1515
```
1616

17-
To install in system
17+
To install in your user `PATH`:
1818

1919
```bash
20-
go build -o lets-dev *.go && sudo mv ./lets-dev /usr/local/bin/lets-dev
20+
mkdir -p "$HOME/.local/bin"
21+
go build -o "$HOME/.local/bin/lets-dev" ./cmd/lets
2122
```
2223

2324
Or if you already have `lets` installed in your system:
2425

2526
```bash
2627
lets build-and-install [--path=<path>]
2728
```
28-
`path` - your custom executable $PATH, defaults to `/usr/local/bin`
29+
`path` - your custom executable $PATH, defaults to `$HOME/.local/bin`
2930

3031
After install - check version of lets - `lets-dev --version` - it should be development
3132

32-
It will install `lets-dev` to /usr/local/bin/lets-dev, or wherever you`ve specified in path, and set version to development with current tag and timestamp
33+
It will install `lets-dev` to `$HOME/.local/bin/lets-dev`, or wherever you`ve specified in path, and set version to development with current tag and timestamp
3334

3435
## Test
3536

docs/docs/installation.mdx

Lines changed: 119 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -4,159 +4,197 @@ title: Installation
44
sidebar_label: Installation
55
---
66

7+
## Homebrew
78

8-
### Binary
9+
```bash
10+
brew tap lets-cli/tap
11+
brew install lets-cli/tap/lets
12+
```
13+
14+
## Arch
915

10-
import Tabs from '@theme/Tabs';
11-
import TabItem from '@theme/TabItem';
16+
Install the latest binary release from [AUR lets-bin](https://aur.archlinux.org/packages/lets-bin/).
1217

13-
<Tabs
14-
defaultValue="shell"
15-
values={[
16-
{ label: 'Shell', value: 'shell', },
17-
{ label: 'Binary', value: 'binary', },
18-
]}
19-
>
20-
<TabItem value="shell">
18+
If you use `yay` as your AUR helper:
2119

2220
```bash
23-
curl --proto '=https' --tlsv1.2 -sSf https://lets-cli.org/install.sh | sh -s -- -b ~/bin
21+
yay -S lets-bin
2422
```
2523

26-
This will install **latest** `lets` binary to `~/bin` directory.
24+
You can also install the bleeding edge version from [AUR lets-git](https://aur.archlinux.org/packages/lets-git/).
2725

28-
To be able to run `lets` from any place in system add `$HOME/bin` to your `PATH`
26+
```bash
27+
yay -S lets-git
28+
```
2929

30-
Open one of these files
30+
## Shell Script
3131

3232
```bash
33-
vim ~/.profile # or vim ~/.bashrc or ~/.zshrc
33+
curl -fsSL https://lets-cli.org/install.sh | bash
3434
```
3535

36-
Add the following line at the end of file, save file and restart the shell.
36+
This installs the **latest** `lets` binary to `$HOME/.lets/bin/lets`.
37+
38+
The installer will make `lets` available in your `PATH` by creating a symlink in the first existing preferred
39+
directory from this list:
40+
41+
* `$HOME/.local/bin`
42+
* `$HOME/bin`
43+
* `$HOME/.bin`
44+
45+
If none of these directories are in `PATH`, the installer creates `$HOME/.local/bin`, links `lets` there, and adds
46+
`$HOME/.local/bin` to your shell profile.
47+
48+
For CI and other non-interactive installs, set `LETS_INSTALL_NO_PROMPT=1` to skip shell profile prompts. When PATH
49+
setup is needed, the installer will use the same non-interactive behavior and update the detected shell profile.
3750

3851
```bash
39-
export PATH=$PATH:$HOME/bin
52+
curl -fsSL https://lets-cli.org/install.sh | LETS_INSTALL_NO_PROMPT=1 bash
4053
```
4154

42-
You can change install location to any directory you want, probably to directory that is in your $PATH
43-
4455
To install a specific version of `lets` (for example `v0.0.21`):
4556

4657
```bash
47-
curl --proto '=https' --tlsv1.2 -sSf https://lets-cli.org/install.sh | sh -s -- v0.0.21
58+
curl -fsSL https://lets-cli.org/install.sh | bash -s -- v0.0.21
4859
```
4960

50-
To use `lets` globally in system you may want to install `lets` to `/usr/local/bin`
61+
You can also use `LETS_VERSION`. If both `LETS_VERSION` and a positional version are provided, `LETS_VERSION` wins.
62+
63+
```bash
64+
curl -fsSL https://lets-cli.org/install.sh | LETS_VERSION=v0.0.21 bash
65+
```
5166

52-
> May require `sudo`
67+
To install into a custom lets home directory, set `LETS_HOME`. The binary will be installed to `$LETS_HOME/bin/lets`.
5368

5469
```bash
55-
curl --proto '=https' --tlsv1.2 -sSf https://lets-cli.org/install.sh | sh -s -- -b /usr/local/bin
70+
curl -fsSL https://lets-cli.org/install.sh | LETS_HOME=$HOME/tools/lets bash
5671
```
5772

58-
</TabItem>
59-
<TabItem value='binary'>
73+
## Binary (Manual)
6074

6175
Download the version you need for your platform from [Lets Releases](https://github.com/lets-cli/lets/releases).
6276

6377
Once downloaded, the binary can be run from anywhere.
6478

65-
Ideally, you should install it somewhere in your PATH for easy use. `/usr/local/bin` is the most probable location.
79+
Ideally, install it somewhere in your user `PATH`, such as `$HOME/.local/bin`.
6680

67-
</TabItem>
68-
</Tabs>
81+
## GitHub Action
6982

83+
Use [lets-cli/lets-action](https://github.com/lets-cli/lets-action) in a GitHub Actions workflow:
7084

71-
### Package managers
85+
```yaml
86+
- name: Install Lets
87+
uses: lets-cli/lets-action@v1.1
88+
with:
89+
version: latest
90+
```
91+
92+
## Update
7293
73-
<Tabs
74-
defaultValue="snap"
75-
values={[
76-
{ label: 'Snap', value: 'snap', },
77-
{ label: 'Homebrew', value: 'homebrew', },
78-
{ label: 'Arch', value: 'arch', },
79-
]}
80-
>
81-
<TabItem value="arch">
94+
### Self Upgrade
8295
83-
You can get binary release from https://aur.archlinux.org/packages/lets-bin/
96+
Starting from version `0.0.30`, lets has a built-in self-upgrade command.
8497

85-
If you are using `yay` as AUR helper:
98+
It updates the binary located at `which lets`.
8699

87100
```bash
88-
yay -S lets-bin
101+
lets self upgrade
89102
```
90103

91-
Also you can get bleeding edge version from https://aur.archlinux.org/packages/lets-git/
104+
Self upgrade is intended for installer-managed and manual user-owned installs. If `lets` was installed by Homebrew,
105+
Arch, or another package manager, use that package manager instead.
106+
107+
If your `lets` version is below `0.0.30`, use the shell script and specify the latest version.
108+
109+
### Homebrew
92110

93111
```bash
94-
yay -S lets-git
112+
brew upgrade lets-cli/tap/lets
113+
```
114+
115+
### Arch
116+
117+
AUR packages provide the latest version.
118+
119+
```bash
120+
yay -Syu lets-bin
95121
```
96122

97-
</TabItem>
98-
<TabItem value="snap">
123+
For the bleeding edge package:
124+
125+
```bash
126+
yay -Syu lets-git
127+
```
99128

100-
TODO
129+
### Shell Script
101130

102-
</TabItem>
103-
<TabItem value="homebrew">
131+
Run the install script again to update `lets` to the latest version.
104132

105133
```bash
106-
brew tap lets-cli/tap
134+
curl -fsSL https://lets-cli.org/install.sh | bash
107135
```
108136

137+
To update to a specific version:
138+
109139
```bash
110-
brew install lets-cli/tap/lets
140+
curl -fsSL https://lets-cli.org/install.sh | LETS_VERSION=v0.0.21 bash
111141
```
112142

113-
</TabItem>
114-
</Tabs>
143+
### Binary
115144

116-
## Update
145+
Download the latest version from [Lets Releases](https://github.com/lets-cli/lets/releases) and replace your existing
146+
`lets` binary.
117147

118-
<Tabs
119-
defaultValue="self"
120-
values={[
121-
{ label: 'Self upgrade', value: 'self', },
122-
{ label: 'Shell script', value: 'shell', },
123-
{ label: 'Binary', value: 'binary', },
124-
{ label: 'Arch', value: 'arch', },
125-
]}
126-
>
127-
<TabItem value="self">
148+
## Uninstall Lets
128149

129-
Starting from version `0.0.30` lets has a built-in self-upgrade command.
150+
### Self Upgrade
130151

131-
It updates binary located at `which lets`
152+
Self upgrade is not a separate install source. If your current binary came from Homebrew or Arch, use the package
153+
manager uninstall instructions below. Otherwise, use the Shell Script or Binary instructions.
132154

155+
### Homebrew
133156

134157
```bash
135-
lets self upgrade
158+
brew uninstall lets-cli/tap/lets
136159
```
137160

138-
If your `lets` version is below `0.0.30` - use shell script and specify the latest version.
161+
Optionally remove the tap after uninstalling:
139162

140-
</TabItem>
141-
<TabItem value="shell">
163+
```bash
164+
brew untap lets-cli/tap
165+
```
142166

143-
To update `lets` you can use shell script
167+
### Arch
144168

169+
```bash
170+
yay -R lets-bin
145171
```
146-
curl --proto '=https' --tlsv1.2 -sSf https://lets-cli.org/install.sh | sh -s -- -b $(dirname $(which lets))
172+
173+
For the bleeding edge package:
174+
175+
```bash
176+
yay -R lets-git
147177
```
148178

149-
Running script will update `lets` to **latest** version.
179+
### Shell Script
150180

151-
</TabItem>
152-
<TabItem value="binary">
181+
Remove the install script binary and common PATH symlinks:
153182

154-
You can download latest version from [Lets Releases](https://github.com/lets-cli/lets/releases).
183+
```bash
184+
rm -f "$HOME/.local/bin/lets" "$HOME/bin/lets" "$HOME/.bin/lets"
185+
rm -rf "$HOME/.lets"
186+
```
155187

156-
</TabItem>
157-
<TabItem value="arch">
188+
If you installed with a custom `LETS_HOME`, remove that directory instead of `$HOME/.lets`.
158189

159-
AUR repository always provides **latest** version.
190+
If the installer added `$HOME/.local/bin` to your shell profile, remove the `# lets` block from that profile.
160191

161-
</TabItem>
162-
</Tabs>
192+
### Binary
193+
194+
Remove the binary from the location where you installed it.
195+
196+
For example, if it is the active `lets` on your `PATH` and is not managed by Homebrew or Arch:
197+
198+
```bash
199+
rm -f "$(command -v lets)"
200+
```

0 commit comments

Comments
 (0)