Compare commits

..

2 Commits

Author SHA1 Message Date
snowbldr
278f9affa6 Additions to kind cheatsheet 2021-06-15 15:32:51 -06:00
adithyasunil26
60d40ce098 releases 2021-06-15 17:49:37 +00:00
358 changed files with 1888 additions and 7510 deletions

1
.gitignore vendored
View File

@@ -4,4 +4,3 @@ install-*.sh
install-*.bat
install-*.ps1
.*.sw*
*.bak

View File

@@ -1,23 +0,0 @@
{
"browser": true,
"node": true,
"esversion": 11,
"curly": true,
"sub": true,
"bitwise": true,
"eqeqeq": true,
"forin": true,
"freeze": true,
"immed": true,
"latedef": "nofunc",
"nonbsp": true,
"nonew": true,
"plusplus": true,
"undef": true,
"unused": "vars",
"strict": true,
"maxdepth": 4,
"maxstatements": 100,
"maxcomplexity": 20
}

View File

@@ -1,123 +0,0 @@
# Guidelines for Contributing to Webi
**Before you start**:
- It's a good idea to try [Webi](https://webinstall.dev/) out for installing
developer tools for yourself before creating an installer.
- It's also best if you take on issues for tools that you're familiar with.
**Before you PR**:
- You'll be asked to make changes if you don't run the code formatters and
linters:
- Node / JavaScript:
- [prettier](https://webinstall.dev/prettier)
```sh
npm run prettier
```
- [jshint](https://webinstall.dev/jshint)
```sh
npm run lint
```
- Bash
- [shfmt](https://webinstall.dev/shfmt)
```sh
npm run shfmt
```
Or
```bash
shfmt -w -i 4 -sr -ci -s ./
```
- [shellcheck](https://webinstall.dev/shellcheck) \
To check for all warnings and errors (except the ones we ignore):
```bash
# to check all errors
shellcheck -s sh --exclude=SC2154,SC2034 */*.sh */*/*.sh
```
To check for only specific warnings and errors:
```bash
# to check specific errors
shellcheck -s sh --include=SC2005 */*.sh */*/*.sh
```
Enumerated shellcheck codes:
<https://gist.github.com/nicerobot/53cee11ee0abbdc997661e65b348f375>
- Common exceptions:
```txt
# We make use of `.` (source) to import without exports
SC2034: foo appears unused. Verify it or export it.
SC2154: var is referenced but not assigned.
```
- If you use vim, [vim-essentials](https://webinstall.dev/vim-essentials)
includes everything you need to automatically format and lint on save.
- If you use VS Code, the same plugins are also available in the VS Code store.
**Not strictly mandatory, but we appreciate**:
- [x] [Signed Commits](/git-config-gpg)
- [x] Semantic Commit Messages
- [x] Update `test` psuedo-package
## Signed Commits
Please **enable gpg-signing**.
You can do this **in about 30 seconds**:
1. Run [`git-config-gpg`](https://webinstall.dev/git-config-gpg) from Webi:
```sh
# On Mac & Linux
curl https://webi.sh/git-config-gpg | sh
```
2. Copy the GPG public key (it will be printed to your screen)
3. Add it to your GitHub profile: <https://github.com/settings/gpg/new>
## Semantic Commit Messages
We try to follow "semantic commits" to some degree. Especially since this is a
project with many sub-projects.
The general format is `<type>(<package>): <description>`, using these _types_:
| _type_ | _usage_ |
| :------- | :----------------------------------------------------------------- |
| feat | new feature for the user, not a new feature for build script |
| fix | bug fix for the user, not a fix to a build script |
| docs | changes to the documentation |
| style | formatting, missing semi colons, etc; no production code change |
| refactor | refactoring production code, eg. renaming a variable |
| test | adding missing tests, refactoring tests; no production code change |
| chore | updating grunt tasks etc; no production code change |
Try to write your commit messages (in the present tense) like this:
```txt
fix(node): update install.sh (fix #200)
```
```txt
feat(delta): add cheat sheet and install.sh
```
```txt
docs(ssh-adduser): document that foo does bar
```
See <https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716> for
some more examples.
## Also update the `test` installer (a 3-line change)
Whenever adding a new installer, please also update `test/install.sh`
- `rm -rf ~/.local/opt/YOUR_PACKAGE`
- `rm -f ~/.local/bin/YOUR_PACKAGE`
- `webi YOUR_PACKAGE`
- (and please keep it in alphabetical order)
See
<https://github.com/webinstall/webi-installers/pull/346/files#diff-db3af85ef45ed7ac0d1d9c473cf4d858657c127dc24d931fe18a9961f17e05b1>
for an example.

View File

@@ -2,15 +2,13 @@
> [webi](https://webinstall.dev) is how developers install their tools
[![webinstall-dev-ogimage-github](https://user-images.githubusercontent.com/122831/129465590-136b5a8a-f8f5-4e8d-a010-784eaa9f21bb.png)](https://webinstall.dev)
- no `sudo`
- no package manager
- no messing with system permissions
- in short: no nonsense
```sh
curl https://webi.sh/webi | sh
```bash
curl https://webinstall.dev/webi | bash
```
This repository contains the primary and community-submitted packages for
@@ -32,7 +30,7 @@ More technically:
- common release APIs are in `_common/` (i.e. `_common/github.js`)
2. `_webi/bootstrap.sh` is a template that exchanges system information for a
correct installer
- constructs a user agent with os, cpu, and utility info (i.e. `macos`,
- contructs a user agent with os, cpu, and utility info (i.e. `macos`,
`amd64`, can unpack `tar,zip,xz`)
3. `_webi/template.sh` is the base installer template with common functions for
- checking versions
@@ -41,10 +39,10 @@ More technically:
- (re-)linking directories
4. `<package>/install.sh` may provide functions to override `_webi/template.sh`
5. Recap:
- `curl https://webi.sh/<pkg>` => `bootstrap-<pkg>.sh`
- `sh bootstrap-<pkg>.sh` =>
- `curl https://webinstall.dev/<pkg>` => `bootstrap-<pkg>.sh`
- `bash bootstrap-<pkg>.sh` =>
`https://webinstall.dev/api/installers/<pkg>@<ver>.sh?formats=zip,tar`
- `sh install-<pkg>.sh` => download, unpack, move, link, update PATH
- `bash install-<pkg>.sh` => download, unpack, move, link, update PATH
# Philosophy (for package authors / maintainers publishing with webi)
@@ -73,7 +71,7 @@ An install consists of 5 parts in 4 files:
my-new-package/
- README.md (package info in frontmatter)
- releases.js
- install.sh (POSIX Shell)
- install.sh (bash)
- install.ps1 (PowerShell)
```
@@ -88,7 +86,7 @@ See these **examples**:
- https://github.com/webinstall/packages/blob/master/golang/
The `webinstall.dev` server uses the list of releases returned by
`<your-package>/releases.js` to generate a shell script with most necessary
`<your-package>/releases.js` to generate a bash script with most necessary
variables and functions pre-defined.
You just fill in the blanks.
@@ -97,13 +95,13 @@ You just fill in the blanks.
Just create an empty directory and run the tests until you get a good result.
```sh
```bash
git clone git@github.com:webinstall/packages.git
pushd packages
npm install
```
```sh
```bash
mkdir -p ./new-package/
node _webi/test.js ./new-package/
```
@@ -118,13 +116,12 @@ Just copy the format from any of the existing packages. It's like this:
---
title: Node.js
homepage: https://nodejs.org
tagline: |
JavaScript V8 runtime
tagline: JavaScript V8 runtime
description: |
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine
---
```sh
```bash
node -e 'console.log("Hello, World!")'
> Hello, World!
```
@@ -161,7 +158,7 @@ module.exports = function (request) {
(optional, if needed) Bash variables that you _may_ define:
```sh
```bash
# Define this if the package name is different from the command name (i.e. golang => go)
pkg_cmd_name="foobar"
@@ -178,16 +175,16 @@ pkg_src_cmd="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin/foobar"
(required) A version check function that strips all non-version junk
```sh
```bash
pkg_get_current_version() {
# foobar-v1.1.7 => 1.1.7
echo "$(foobar --version | head -n 1 | sed 's:foobar-v::')"
}
```
For the rest of the functions you can copy/paste from the examples:
For the rest of the functions you can like copy/paste from the examples:
```sh
```bash
pkg_format_cmd_version() {} # Override, pretty prints version
pkg_link # Override, replaces webi_link()
@@ -214,7 +211,7 @@ See `webi/template.sh`
These variables will be set by the server:
```sh
```bash
WEBI_PKG=example@v1
WEBI_TAG=v1
WEBI_HOST=https://webinstall.dev
@@ -231,21 +228,21 @@ WEBI_PKG_URL=https://cdn.example.com/example-macos-amd64.tar.gz
WEBI_PKG_FILE=example-macos-amd64.tar.gz
```
```sh
```bash
PKG_NAME=example
PKG_OSES=macos,linux,windows
PKG_ARCHES=amd64,arm64,x86
PKG_FORMATS=zip,xz
```
```sh
```bash
WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-foobar.XXXXXXXX)"}
WEBI_SINGLE=""
```
```sh
```bash
webi_check # Checks to see if the selected version is already installed (and re-links if so)
webi_download # Downloads the selected release to $HOME/Downloads/webi/<package-name>.tar.gz
webi_download # Downloads the selected release to $HOME/Downloads/<package-name>.tar.gz
webi_extract # Extracts the download to /tmp/<package-name>-<random>/
webi_path_add /new/path # Adds /new/path to PATH for bash, zsh, and fish
webi_pre_install # Runs webi_check, webi_download, and webi_extract
@@ -270,10 +267,10 @@ webi_post_install # Runs `webi_path_add $pkg_dst_bin`
set WEBI_HOST=https://webinstall.dev
```
Windows has curl too!?
Windows 10 has curl too!?
```bat
curl.exe -sL https://webi.ms/node | powershell
curl.exe -sL -A "MS" https://webinstall.dev/node | powershell
```
And it's easy enough to ignore the execution policy
@@ -286,11 +283,11 @@ And if we want something that looks as complicated as we expect Windows to be,
historically, we have options:
```bat
powershell "Invoke-Expression ( Invoke-WebRequest -UseBasicParsing https://webi.ms/node ).Contents"
powershell "Invoke-Expression ( Invoke-WebRequest -UseBasicParsing https://webinstall.dev/node ).Contents"
```
```bat
powershell ( Invoke-WebRequest -UseBasicParsing https://webi.ms/node ).Contents | powershell
powershell ( Invoke-WebRequest -UseBasicParsing https://webinstall.dev/node ).Contents | powershell
```
-->

View File

@@ -15,17 +15,6 @@ tagline: |
To update or switch versions, run `webi example@stable` (or `@v2`, `@beta`,
etc).
### Files
These are the files / directories that are created and/or modified with this
install:
```txt
~/.config/envman/PATH.env
~/.local/bin/foo
~/.local/opt/foo
```
## Cheat Sheet
> `foo` doesn't exist and this text should have been replaced. It doesn't do
@@ -33,7 +22,7 @@ install:
To run foo:
```sh
```bash
foo
```
@@ -41,6 +30,6 @@ foo
To run foo with both bar and baz highlighting turned on:
```sh
```bash
foo --bar=baz
```

View File

@@ -15,12 +15,12 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\foobar-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\foobar-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
# TODO: arch detection
echo "Downloading foobar from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"

View File

@@ -1,9 +1,6 @@
#!/bin/sh
#!/bin/bash
# shellcheck disable=SC2034
# "'pkg_cmd_name' appears unused. Verify it or export it."
__init_foobar() {
function __init_foobar() {
set -e
set -u
@@ -24,21 +21,19 @@ __init_foobar() {
# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/foobar-v0.99.9/bin
mkdir -p "$(dirname "${pkg_src_cmd}")"
mkdir -p "$(dirname $pkg_src_cmd)"
# mv ./foobar-*/foo ~/.local/opt/foobar-v0.99.9/bin/foo
mv ./foobar-*/foo "${pkg_src_cmd}"
mv ./foobar-*/foo "$pkg_src_cmd"
}
# pkg_get_current_version is recommended, but not required
# pkg_get_current_version is recommended, but (soon) not required
pkg_get_current_version() {
# 'foo --version' has output in this format:
# foobar 0.99.9 (rev abcdef0123)
# This trims it down to just the version number:
# 0.99.9
foo --version 2> /dev/null |
head -n 1 |
cut -d ' ' -f 2
echo $(foo --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2)
}
}

View File

@@ -16,7 +16,7 @@ Each example has four files that need to be modified, just slightly:
See [./keypairs/](/keypairs/) as an example.
```sh
```bash
rsync -av ./keypairs/ ./my-project/
```
@@ -26,7 +26,7 @@ Keypairs is packaged for Mac and Linux as `.tar.gz`, and as `.zip` for Windows.
See [./arc/](/arc/) as an example.
```sh
```bash
rsync -av ./arc/ ./my-project/
```

View File

@@ -16,7 +16,7 @@ Each example has four files that need to be modified, just slightly:
See [./gitea/](/gitea/) as an example.
```sh
```bash
rsync -av ./keypairs/ ./my-project/
```

View File

@@ -11,7 +11,7 @@ Effortlessly install developer tools with easy-to-remember URLs.
## Install webi via npm:
```sh
```bash
npm install -g webi
```
@@ -19,14 +19,14 @@ npm install -g webi
Mac & Linux:
```sh
curl -fsS https://webi.sh/node | sh
```bash
curl -fsS https://webinstall.dev/node | bash
```
Windows (includes `curl.exe` and PowerShell by default):
Windows 10 (includes `curl.exe` and PowerShell by default):
```sh
curl.exe -fsSA "MS" https://webi.ms/node | powershell
```bash
curl.exe -fsSA "MS" https://webinstall.dev/node | powershell
```
## Example: Switching node versions
@@ -34,7 +34,7 @@ curl.exe -fsSA "MS" https://webi.ms/node | powershell
Once `webi` is installed, you can then install commands or switch versions with
webi itself:
```sh
```bash
webi node@stable
webi node@lts
webi node@v10

View File

@@ -14,12 +14,18 @@ if (/^win/i.test(os.platform())) {
console.warn("This npm installer doesn't work on windows yet.");
console.warn('Copy and paste this into cmd.exe or PowerShell instead:');
console.warn('');
console.warn(' curl.exe -fsS https://webi.ms/webi | powershell');
console.warn(
" curl.exe -fsSA 'MS' https://webinstall.dev/webi | powershell"
);
console.warn('');
return;
}
exec('curl -fsS https://webi.sh/webi | sh', function(err, stdout, stderr) {
exec('curl -fsS https://webinstall.dev/webi | bash', function (
err,
stdout,
stderr
) {
if (err) {
console.error(err);
}

View File

@@ -26,7 +26,7 @@ If there are some important key bindings, use a table like this:
1. Place EXAMPLE into your `~/.vim/pack/plugins/start`:
```sh
```bash
mkdir -p ~/.vim/pack/plugins/start/
git clone --depth=1 https://github.com/CHANGEME/EXAMPLE.git ~/.vim/pack/plugins/start/example
```

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#!/bin/bash
__init_vim_example() {
function __init_vim_example() {
set -e
set -u

View File

@@ -1,11 +1,5 @@
# Download the latest webi, then install {{ exename }}
# <pre>
############################################################
# <h1>Cheat Sheet at CHEATSHEET_URL</h1>
# <meta http-equiv="refresh" content="3; URL='CHEATSHEET_URL'" />
############################################################
New-Item -Path "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
New-Item -Path "$Env:USERPROFILE\.local\bin" -ItemType Directory -Force | out-null
New-Item -Path .local\bin -ItemType Directory -Force | out-null
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
curl.exe -s -A "windows" "$Env:WEBI_HOST/packages/_webi/webi-pwsh.ps1" -o "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1"
Set-ExecutionPolicy -Scope Process Bypass

View File

@@ -1,28 +1,18 @@
#!/bin/sh
#<pre>
############################################################
# <h1>Cheat Sheet at CHEATSHEET_URL</h1>
# <meta http-equiv="refresh" content="3; URL='CHEATSHEET_URL'" />
############################################################
#!/bin/bash
#set -x
__install_webi() {
function __install_webi() {
#WEBI_PKG=
#WEBI_HOST=https://webinstall.dev
export WEBI_HOST
echo ""
printf "Thanks for using webi to install '\e[32m%s\e[0m' on '\e[31m%s/%s\e[0m'.\n" "${WEBI_PKG:-}" "$(uname -s)" "$(uname -m)"
echo "Thanks for using webi to install '${WEBI_PKG:-}' on '$(uname -s)/$(uname -m)'."
echo "Have a problem? Experience a bug? Please let us know:"
echo " https://github.com/webinstall/webi-installers/issues"
echo " https://github.com/webinstall/packages/issues"
echo ""
printf "\e[31mLovin'\e[0m it? Say thanks with a \e[34mStar on GitHub\e[0m:\n"
printf " \e[32mhttps://github.com/webinstall/webi-installers\e[0m\n"
echo ""
WEBI_WELCOME=true
export WEBI_WELCOME
@@ -32,15 +22,15 @@ __install_webi() {
mkdir -p "$HOME/.local/bin"
cat << EOF > "$HOME/.local/bin/webi"
#!/bin/sh
#!/bin/bash
set -e
set -u
#set -x
__webi_main() {
function __webi_main () {
export WEBI_TIMESTAMP="\$(date +%F_%H-%M-%S)"
export WEBI_TIMESTAMP=\$(date +%F_%H-%M-%S)
export _webi_tmp="\${_webi_tmp:-\$(mktemp -d -t webi-\$WEBI_TIMESTAMP.XXXXXXXX)}"
if [ -n "\${_WEBI_PARENT:-}" ]; then
@@ -96,7 +86,7 @@ __webi_main() {
export WEBI_UA="\$(uname -a)"
webinstall() {
function webinstall() {
my_package="\${1:-}"
if [ -z "\$my_package" ]; then
@@ -122,10 +112,9 @@ __webi_main() {
fi
set -e
(
cd "\$WEBI_BOOT"
sh "\$my_package-bootstrap.sh"
)
pushd "\$WEBI_BOOT" 2>&1 > /dev/null
bash "\$my_package-bootstrap.sh"
popd 2>&1 > /dev/null
rm -rf "\$WEBI_BOOT"
@@ -137,13 +126,14 @@ __webi_main() {
if [ -f "\$_webi_tmp/.PATH.env" ]; then
my_paths=\$(cat "\$_webi_tmp/.PATH.env" | sort -u)
if [ -n "\$my_paths" ]; then
printf 'PATH.env updated with:\\n'
printf "%s\\n" "\$my_paths"
printf '\\n'
printf "\\e[31mTO FINISH\\e[0m: copy, paste & run the following command:\\n"
printf "\\n"
printf " \\e[34msource ~/.config/envman/PATH.env\\e[0m\\n"
printf " (newly opened terminal windows will update automatically)\\n"
echo "IMPORTANT: You must update you PATH to use the installed program(s)"
echo ""
echo "You can either"
echo "A) can CLOSE and REOPEN Terminal or"
echo "B) RUN these exports:"
echo ""
echo "\$my_paths"
echo ""
fi
rm -f "\$_webi_tmp/.PATH.env"
fi
@@ -151,54 +141,6 @@ __webi_main() {
}
version() {
my_version=v1.1.15
printf "\\e[31mwebi\\e[32m %s\\e[0m Copyright 2020+ AJ ONeal\\n" "\${my_version}"
printf " \\e[34mhttps://webinstall.dev/webi\\e[0m\\n"
}
# show help if no params given or help flags are used
usage() {
echo ""
version
echo ""
printf "\\e[1mSUMMARY\\e[0m\\n"
echo " Webi is the best way to install the modern developer tools you love."
echo " It's fast, easy-to-remember, and conflict free."
echo ""
printf "\\e[1mUSAGE\\e[0m\\n"
echo " webi <thing1>[@version] [thing2] ..."
echo ""
printf "\\e[1mUNINSTALL\\e[0m\\n"
echo " Almost everything that is installed with webi is scoped to"
echo " ~/.local/opt/<thing1>, so you can remove it like so:"
echo ""
echo " rm -rf ~/.local/opt/<thing1>"
echo " rm -f ~/.local/bin/<thing1>"
echo ""
echo " Some packages have special uninstall instructions, check"
echo " https://webinstall.dev/<thing1> to be sure."
echo ""
printf "\\e[1mFAQ\\e[0m\\n"
printf " See \\e[34mhttps://webinstall.dev/faq\\e[0m\\n"
echo ""
printf "\\e[1mALWAYS REMEMBER\\e[0m\\n"
echo " Friends don't let friends use brew for simple, modern tools that don't need it."
echo " (and certainly not apt either **shudder**)"
echo ""
}
if [ \$# -eq 0 ] || echo "\$1" | grep -q -E '^(-V|--version|version)$'; then
version
exit 0
fi
if echo "\$1" | grep -q -E '^(-h|--help|help)$'; then
usage "\$@"
exit 0
fi
for pkgname in "\$@"
do
webinstall "\$pkgname"

View File

@@ -1,19 +1,14 @@
#!/bin/sh
set -e
set -u
# For installing from the extracted package tmp directory
pkg_install() {
(
cd "$WEBI_TMP"
pushd "$WEBI_TMP" 2>&1 > /dev/null
if command -v rsync 2> /dev/null | grep -q rsync; then
rsync -Krl ./xmpl*/ "$pkg_src/" 2> /dev/null
else
cp -Hr ./xmpl*/* "$pkg_src/" 2> /dev/null
cp -Hr ./xmpl*/.* "$pkg_src/" 2> /dev/null
fi
rm -rf ./xmpl*
if [ -n "$(command -v rsync 2> /dev/null | grep rsync)" ]; then
rsync -Krl ./xmpl*/ "$pkg_src/" 2> /dev/null
else
cp -Hr ./xmpl*/* "$pkg_src/" 2> /dev/null
cp -Hr ./xmpl*/.* "$pkg_src/" 2> /dev/null
fi
rm -rf ./xmpl*
)
popd 2>&1 > /dev/null
}

View File

@@ -12,6 +12,7 @@ function parseYamlish(txt) {
var block = false;
var lines = txt.trim().split('\n');
var moreRe = /\s+/;
var last;
if (frontmatter !== lines.shift()) {
@@ -79,6 +80,8 @@ module.exports.parse = parseYamlish;
if (require.main === module) {
console.info(
parseYamlish(fs.readFileSync(__dirname + '/../node/README.md', 'utf8'))
parseYamlish(
fs.readFileSync(__dirname + '/../node/README.md', 'utf8')
)
);
}

View File

@@ -28,37 +28,25 @@ formats.forEach(function (name) {
// evaluation order matters
// (i.e. otherwise x86 and x64 can cross match)
var arches = [
// arm 7 cannot be confused with arm64
'armv7l',
// amd64 is more likely than arm64
'amd64',
// arm6 has the same prefix as arm64
'armv6l',
// arm64 is more likely than arm6, and should be the default
'amd64', // first and most likely match
'arm64',
'x86',
'ppc64le',
'ppc64',
'armv7l',
'armv6l',
's390x'
];
// Used for detecting system arch from package download url, for example:
//
// https://git.com/org/foo/releases/v0.7.9/foo-aarch64-linux-musl.tar.gz
// https://git.com/org/foo/releases/v0.7.9/foo-arm-linux-musleabihf.tar.gz
// https://git.com/org/foo/releases/v0.7.9/foo-armv7-linux-musleabihf.tar.gz
// https://git.com/org/foo/releases/v0.7.9/foo-x86_64-linux-musl.tar.gz
//
var archMap = {
armv7l: /(\b|_)(armv?7l?)/i,
//amd64: /(amd.?64|x64|[_\-]64)/i,
amd64:
/(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)64([_\-]?bit)?(\b|_)/i,
amd64: /(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)64([_\-]?bit)?(\b|_)/i,
//x86: /(86)(\b|_)/i,
armv6l: /(\b|_)(aarch32|armv?6l?)(\b|_)/i,
arm64: /(\b|_)((aarch|arm)64|arm)/i,
x86: /(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)(86|32)([_\-]?bit)(\b|_)/i,
ppc64le: /(\b|_)(ppc64le)/i,
ppc64: /(\b|_)(ppc64)(\b|_)/i,
arm64: /(\b|_)((aarch|arm)64|arm)/i,
armv7l: /(\b|_)(armv?7l)/i,
armv6l: /(\b|_)(aarch32|armv?6l)/i,
s390x: /(\b|_)(s390x)/i
};
arches.forEach(function (name) {
@@ -83,13 +71,6 @@ function normalize(all) {
return osMap[regKey].test(rel.name || rel.download);
}) || 'unknown';
}
// Hacky-doo for musl
// TODO some sort of glibc vs musl tag?
if (!rel._musl) {
if (/(\b|\.|_|-)(musl)(\b|\.|_|-)/.test(rel.download)) {
rel._musl = true;
}
}
supported.oses[rel.os] = true;
if (!rel.arch) {
@@ -122,7 +103,7 @@ function normalize(all) {
if ('tar' === exts[1]) {
rel.ext = exts.reverse().join('.');
tarExt = 'tar';
} else if ('tgz' === exts[0]) {
} else if ('tgz' == exts[0]) {
rel.ext = 'tar.gz';
tarExt = 'tar';
} else {

View File

@@ -27,7 +27,7 @@ function padScript(txt) {
Releases.renderBash = function (
pkgdir,
rel,
{ baseurl, pkg, tag, ver, os = '', arch = '', formats }
{ baseurl, pkg, tag, ver, os, arch, formats }
) {
if (!Array.isArray(formats)) {
formats = [];
@@ -53,19 +53,19 @@ Releases.renderBash = function (
return fs.promises
.readFile(path.join(__dirname, 'template.sh'), 'utf8')
.then(function (tplTxt) {
// ex: 'node@lts' or 'node'
var webiPkg = pkg;
if (ver) {
webiPkg += `@${ver}`;
}
return (
tplTxt
.replace(/CHEATSHEET_URL/g, `${baseurl}/${pkg}`)
.replace(/^\s*#?WEBI_PKG=.*/m, `WEBI_PKG='${webiPkg}'`)
.replace(/^\s*#?WEBI_HOST=.*/m, `WEBI_HOST='${baseurl}'`)
.replace(/^\s*#?WEBI_OS=.*/m, `WEBI_OS='${os}'`)
.replace(/^\s*#?WEBI_ARCH=.*/m, `WEBI_ARCH='${arch}'`)
.replace(/^\s*#?WEBI_TAG=.*/m, `WEBI_TAG='${tag}'`)
.replace(
/^\s*#?WEBI_PKG=.*/m,
"WEBI_PKG='" + pkg + '@' + ver + "'"
)
.replace(/^\s*#?WEBI_HOST=.*/m, "WEBI_HOST='" + baseurl + "'")
.replace(/^\s*#?WEBI_OS=.*/m, "WEBI_OS='" + (os || '') + "'")
.replace(
/^\s*#?WEBI_ARCH=.*/m,
"WEBI_ARCH='" + (arch || '') + "'"
)
.replace(/^\s*#?WEBI_TAG=.*/m, "WEBI_TAG='" + tag + "'")
.replace(
/^\s*#?WEBI_RELEASES=.*/m,
"WEBI_RELEASES='" +
@@ -143,11 +143,7 @@ Releases.renderBash = function (
/^\s*#?PKG_FORMATS=.*/m,
"PKG_FORMATS='" + ((rel && rel.formats) || []).join(',') + "'"
)
// $', $0, ... $9, $`, $&, and $_ all have special meaning
// (see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp)
// However, it can be escaped with $$ (which must be escaped with $$)
.replace(reInstallTpl, '\n' + installTxt.replace(/\$/g, '$$$$'))
.replace(reInstallTpl, '\n' + installTxt)
);
});
});

View File

@@ -1,92 +0,0 @@
'use strict';
var path = require('path');
var uaDetect = require('./ua-detect.js');
var packages = require('./packages.js');
var Releases = require('./releases.js');
// handlers caching and transformation, probably should be broken down
var getReleases = require('./transform-releases.js');
var installersDir = path.join(__dirname, '..');
module.exports = async function serveInstaller(
baseurl,
ua,
pkg,
tag,
ext,
formats
) {
// TODO put some of this in a middleware? or common function?
var ver = tag.replace(/^v/, '');
var lts;
var channel;
switch (ver) {
case 'latest':
ver = '';
channel = 'stable';
break;
case 'lts':
lts = true;
channel = 'stable';
ver = '';
break;
case 'stable':
channel = 'stable';
ver = '';
break;
case 'beta':
channel = 'beta';
ver = '';
break;
case 'dev':
channel = 'dev';
ver = '';
break;
}
// TODO maybe move package/version/lts/channel detection into getReleases
var myOs = uaDetect.os(ua);
var myArch = uaDetect.arch(ua);
return packages.get(pkg).then(function (cfg) {
return getReleases({
pkg: cfg.alias || pkg,
ver,
os: myOs,
arch: myArch,
lts,
channel,
formats,
limit: 1
}).then(function (rels) {
var rel = rels.releases[0];
var pkgdir = path.join(installersDir, pkg);
var opts = {
baseurl,
pkg: cfg.alias || pkg,
ver,
tag,
os: myOs,
arch: myArch,
lts,
channel,
formats,
limit: 1
};
rel.oses = rels.oses;
rel.arches = rels.arches;
rel.formats = rels.formats;
if ('bat' === ext) {
return Releases.renderBatch(pkgdir, rel, opts);
} else if ('ps1' === ext) {
return Releases.renderPowerShell(pkgdir, rel, opts);
} else {
return Releases.renderBash(pkgdir, rel, opts);
}
});
});
};

View File

@@ -1,17 +1,4 @@
#!/usr/bin/env pwsh
#350 check if windows user run as admin
function Confirm-IsElevated {
$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$p = New-Object System.Security.Principal.WindowsPrincipal($id)
if ($p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))
{ Write-Output $true }
else
{ Write-Output $false }
}
if (Confirm-IsElevated)
{ throw "Webi MUST NOT be run with elevated privileges. Please run again as a normal user, NOT as administrator." }
# this allows us to call ps1 files, which allows us to have spaces in filenames
# ('powershell "$Env:USERPROFILE\test.ps1" foo' will fail if it has a space in
@@ -44,11 +31,6 @@ New-Item -Path .local\opt -ItemType Directory -Force | out-null
function webi_add_path
{
Write-Host ''
Write-Host '*****************************' -ForegroundColor red -BackgroundColor white
Write-Host '* IMPORTANT - READ ME *' -ForegroundColor red -BackgroundColor white
Write-Host '*****************************' -ForegroundColor red -BackgroundColor white
Write-Host ''
& "$Env:USERPROFILE\.local\bin\pathman.exe" add "$args[0]"
# Note: not all of these work as expected, so we use the unix-style, which is most consistent
#& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin

View File

@@ -1,6 +1,10 @@
#!/bin/sh
#!/bin/bash
__bootstrap_webi() {
# shellcheck disable=2001
# because I prefer to use sed rather than bash replace
# (there's too little space in my head to learn both syntaxes)
function __bootstrap_webi() {
set -e
set -u
@@ -31,8 +35,6 @@ __bootstrap_webi() {
#PKG_ARCHES=
#PKG_FORMATS=
WEBI_UA="$(uname -a)"
WEBI_PKG_DOWNLOAD=""
WEBI_PKG_PATH="${HOME}/Downloads/webi/${PKG_NAME:-error}/${WEBI_VERSION:-latest}"
export WEBI_HOST
##
@@ -42,7 +44,7 @@ __bootstrap_webi() {
WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-"${WEBI_PKG:-}".XXXXXXXX)"}
export _webi_tmp="${_webi_tmp:-"$HOME/.local/opt/webi-tmp.d"}"
mkdir -p "${WEBI_PKG_PATH}"
mkdir -p "$HOME/Downloads"
mkdir -p "$HOME/.local/bin"
mkdir -p "$HOME/.local/opt"
@@ -65,9 +67,9 @@ __bootstrap_webi() {
fi
if [ -n "$(command -v pkg_format_cmd_version)" ]; then
my_versioned_name="'$(pkg_format_cmd_version "$WEBI_VERSION")'"
my_versioned_name="$(pkg_format_cmd_version "$WEBI_VERSION")"
else
my_versioned_name="'$pkg_cmd_name v$WEBI_VERSION'"
my_versioned_name="'$pkg_cmd_name' v$WEBI_VERSION"
fi
echo "$my_versioned_name"
@@ -82,7 +84,7 @@ __bootstrap_webi() {
return 0
fi
if [ -n "$WEBI_SINGLE" ] || [ "single" = "${1:-}" ]; then
if [ -n "$WEBI_SINGLE" ] || [ "single" == "${1:-}" ]; then
rm -rf "$pkg_dst_cmd"
ln -s "$pkg_src_cmd" "$pkg_dst_cmd"
else
@@ -103,57 +105,36 @@ __bootstrap_webi() {
my_current_cmd="$(command -v "$pkg_cmd_name")"
set -e
if [ -n "$my_current_cmd" ]; then
pkg_current_version="$(pkg_get_current_version 2> /dev/null | head -n 1)"
# remove trailing '.0's for golang's sake
my_current_version="$(echo "$pkg_current_version" | sed 's:\.0::g')"
my_src_version="$(echo "$WEBI_VERSION" | sed 's:\.0::g')"
my_canonical_name="$(_webi_canonical_name)"
if [ "$my_current_cmd" != "$pkg_dst_cmd" ]; then
echo >&2 "WARN: possible PATH conflict between $my_canonical_name and currently installed version"
echo >&2 " ${pkg_dst_cmd} (new)"
echo >&2 " ${my_current_cmd} (existing)"
#my_current_version=false
fi
# 'readlink' can't read links in paths on macOS 🤦
# but that's okay, 'cmp -s' is good enough for us
if cmp -s "${pkg_src_cmd}" "${my_current_cmd}"; then
echo "${my_canonical_name} already installed:"
printf " %s" "${pkg_dst}"
if [ "${pkg_src_cmd}" != "${my_current_cmd}" ]; then
printf " => %s" "${pkg_src}"
if [ "$my_src_version" == "$my_current_version" ]; then
echo "$my_canonical_name already installed at $my_current_cmd"
exit 0
else
if [ "$my_current_cmd" != "$pkg_dst_cmd" ]; then
echo >&2 "WARN: possible conflict between $my_canonical_name and $pkg_current_version at $my_current_cmd"
fi
if [ -x "$pkg_src_cmd" ]; then
# shellcheck disable=2119
# this function takes no args
webi_link
echo "switched to $my_canonical_name at $pkg_src"
exit 0
fi
echo ""
exit 0
fi
if [ -x "$pkg_src_cmd" ]; then
# shellcheck disable=2119
# this function takes no args
webi_link
echo "switched to $my_canonical_name:"
echo " ${pkg_dst} => ${pkg_src}"
exit 0
fi
fi
export PATH="$my_path"
}
is_interactive_shell() {
# $- shows shell flags (error,unset,interactive,etc)
case $- in
*i*)
# true
return 0
;;
*)
# false
return 1
;;
esac
}
# detect if file is downloaded, and how to download it
webi_download() {
# determine the url to download
if [ -n "${1:-}" ]; then
my_url="$1"
else
if [ "error" = "$WEBI_CHANNEL" ]; then
if [ "error" == "$WEBI_CHANNEL" ]; then
# TODO pass back requested OS / Arch / Version
echo >&2 "Error: no '$PKG_NAME' release for '${WEBI_OS:-}' on '$WEBI_ARCH' as one of '$WEBI_FORMATS' by the tag '${WEBI_TAG:-}'"
echo >&2 " '$PKG_NAME' is available for '$PKG_OSES' on '$PKG_ARCHES' as one of '$PKG_FORMATS'"
@@ -165,17 +146,12 @@ __bootstrap_webi() {
fi
my_url="$WEBI_PKG_URL"
fi
# determine the location to download to
if [ -n "${2:-}" ]; then
my_dl="$2"
else
my_dl="${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
my_dl="$HOME/Downloads/$WEBI_PKG_FILE"
fi
WEBI_PKG_DOWNLOAD="${my_dl}"
export WEBI_PKG_DOWNLOAD
if [ -e "$my_dl" ]; then
echo "Found $my_dl"
return 0
@@ -191,7 +167,7 @@ __bootstrap_webi() {
# TODO wget -c --content-disposition "$my_url"
set +e
my_show_progress=""
if is_interactive_shell; then
if [[ $- == *i* ]]; then
my_show_progress="--show-progress"
fi
if ! wget -q $my_show_progress --user-agent="wget $WEBI_UA" -c "$my_url" -O "$my_dl.part"; then
@@ -203,7 +179,7 @@ __bootstrap_webi() {
# Neither GNU nor BSD curl have sane resume download options, hence we don't bother
# TODO curl -fsSL --remote-name --remote-header-name --write-out "$my_url"
my_show_progress="-#"
if is_interactive_shell; then
if [[ $- == *i* ]]; then
my_show_progress=""
fi
# shellcheck disable=SC2086
@@ -218,26 +194,25 @@ __bootstrap_webi() {
# detect which archives can be used
webi_extract() {
(
cd "$WEBI_TMP"
if [ "tar" = "$WEBI_EXT" ]; then
echo "Extracting ${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
tar xf "${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
elif [ "zip" = "$WEBI_EXT" ]; then
echo "Extracting ${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
unzip "${WEBI_PKG_PATH}/$WEBI_PKG_FILE" > __unzip__.log
elif [ "exe" = "$WEBI_EXT" ]; then
echo "Moving ${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
mv "${WEBI_PKG_PATH}/$WEBI_PKG_FILE" .
elif [ "xz" = "$WEBI_EXT" ]; then
echo "Inflating ${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
unxz -c "${WEBI_PKG_PATH}/$WEBI_PKG_FILE" > "$(basename "$WEBI_PKG_FILE")"
else
# do nothing
echo "Failed to extract ${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
exit 1
fi
)
pushd "$WEBI_TMP" > /dev/null 2>&1
if [ "tar" == "$WEBI_EXT" ]; then
echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE"
tar xf "$HOME/Downloads/$WEBI_PKG_FILE"
elif [ "zip" == "$WEBI_EXT" ]; then
echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE"
unzip "$HOME/Downloads/$WEBI_PKG_FILE" > __unzip__.log
elif [ "exe" == "$WEBI_EXT" ]; then
echo "Moving $HOME/Downloads/$WEBI_PKG_FILE"
mv "$HOME/Downloads/$WEBI_PKG_FILE" .
elif [ "xz" == "$WEBI_EXT" ]; then
echo "Inflating $HOME/Downloads/$WEBI_PKG_FILE"
unxz -c "$HOME/Downloads/$WEBI_PKG_FILE" > "$(basename "$WEBI_PKG_FILE")"
else
# do nothing
echo "Failed to extract $HOME/Downloads/$WEBI_PKG_FILE"
exit 1
fi
popd > /dev/null 2>&1
}
# use 'pathman' to update $HOME/.config/envman/PATH.env
@@ -255,12 +230,8 @@ __bootstrap_webi() {
# in case pathman was recently installed and the PATH not updated
mkdir -p "$_webi_tmp"
# 'true' to prevent "too few arguments" output
# when there are 0 lines of stdout
"$HOME/.local/bin/pathman" add "$1" |
grep "export" 2> /dev/null \
>> "$_webi_tmp/.PATH.env" ||
true
# prevent "too few arguments" output on bash when there are 0 lines of stdout
"$HOME/.local/bin/pathman" add "$1" | grep "export" 2> /dev/null >> "$_webi_tmp/.PATH.env" || true
}
# group common pre-install tasks as default
@@ -274,7 +245,7 @@ __bootstrap_webi() {
# shellcheck disable=2120
# webi_install may be sourced and used elsewhere
webi_install() {
if [ -n "$WEBI_SINGLE" ] || [ "single" = "${1:-}" ]; then
if [ -n "$WEBI_SINGLE" ] || [ "single" == "${1:-}" ]; then
mkdir -p "$(dirname "$pkg_src_cmd")"
mv ./"$pkg_cmd_name"* "$pkg_src_cmd"
else
@@ -328,21 +299,18 @@ __bootstrap_webi() {
WEBI_SINGLE=
if [ -z "${WEBI_WELCOME:-}" ]; then
if [[ -z ${WEBI_WELCOME:-} ]]; then
echo ""
printf "Thanks for using webi to install '\e[32m%s\e[0m' on '\e[31m%s/%s\e[0m'.\n" "${WEBI_PKG:-}" "$(uname -s)" "$(uname -m)"
echo "Thanks for using webi to install '$PKG_NAME' on '$WEBI_OS/$WEBI_ARCH'."
echo "Have a problem? Experience a bug? Please let us know:"
echo " https://github.com/webinstall/webi-installers/issues"
echo ""
printf "\e[31mLovin'\e[0m it? Say thanks with a \e[34mStar on GitHub\e[0m:\n"
printf " \e[32mhttps://github.com/webinstall/webi-installers\e[0m\n"
echo " https://github.com/webinstall/packages/issues"
echo ""
fi
__init_installer() {
function __init_installer() {
# do nothing - to satisfy parser prior to templating
printf ""
echo -n ""
# {{ installer }}
@@ -357,20 +325,7 @@ __bootstrap_webi() {
##
# run everything with defaults or overrides as needed
if command -v pkg_install > /dev/null ||
command -v pkg_link > /dev/null ||
command -v pkg_post_install > /dev/null ||
command -v pkg_done_message > /dev/null ||
command -v pkg_format_cmd_version > /dev/null ||
[ -n "${WEBI_SINGLE:-}" ] ||
[ -n "${pkg_cmd_name:-}" ] ||
[ -n "${pkg_dst_cmd:-}" ] ||
[ -n "${pkg_dst_dir:-}" ] ||
[ -n "${pkg_dst:-}" ] ||
[ -n "${pkg_src_cmd:-}" ] ||
[ -n "${pkg_src_dir:-}" ] ||
[ -n "${pkg_src:-}" ]; then
if [ -n "$(command -v pkg_get_current_version)" ]; then
pkg_cmd_name="${pkg_cmd_name:-$PKG_NAME}"
if [ -n "$WEBI_SINGLE" ]; then
@@ -393,45 +348,36 @@ __bootstrap_webi() {
# shellcheck disable=SC2034
pkg_dst_bin="$(dirname "$pkg_dst_cmd")"
if [ -n "$(command -v pkg_pre_install)" ]; then pkg_pre_install; else webi_pre_install; fi
if [[ -n "$(command -v pkg_pre_install)" ]]; then pkg_pre_install; else webi_pre_install; fi
(
cd "$WEBI_TMP"
echo "Installing to $pkg_src_cmd"
if [ -n "$(command -v pkg_install)" ]; then pkg_install; else webi_install; fi
chmod a+x "$pkg_src"
chmod a+x "$pkg_src_cmd"
)
pushd "$WEBI_TMP" > /dev/null 2>&1
echo "Installing to $pkg_src_cmd"
if [[ -n "$(command -v pkg_install)" ]]; then pkg_install; else webi_install; fi
chmod a+x "$pkg_src"
chmod a+x "$pkg_src_cmd"
popd > /dev/null 2>&1
webi_link
_webi_enable_exec
(
cd "$WEBI_TMP"
if [ -n "$(command -v pkg_post_install)" ]; then pkg_post_install; else webi_post_install; fi
)
pushd "$WEBI_TMP" > /dev/null 2>&1
if [[ -n "$(command -v pkg_post_install)" ]]; then pkg_post_install; else webi_post_install; fi
popd > /dev/null 2>&1
(
cd "$WEBI_TMP"
if [ -n "$(command -v pkg_done_message)" ]; then pkg_done_message; else _webi_done_message; fi
)
pushd "$WEBI_TMP" > /dev/null 2>&1
if [[ -n "$(command -v pkg_done_message)" ]]; then pkg_done_message; else _webi_done_message; fi
popd > /dev/null 2>&1
echo ""
fi
webi_path_add "$HOME/.local/bin"
if [ -z "${_WEBI_CHILD:-}" ] && [ -f "$_webi_tmp/.PATH.env" ]; then
if [ -n "$(cat "$_webi_tmp/.PATH.env")" ]; then
printf 'PATH.env updated with:\n'
if [[ -z ${_WEBI_CHILD:-} ]] && [[ -f "$_webi_tmp/.PATH.env" ]]; then
if [[ -n $(cat "$_webi_tmp/.PATH.env") ]]; then
echo "You need to update your PATH to use $PKG_NAME:"
echo ""
sort -u "$_webi_tmp/.PATH.env"
printf "\n"
rm -f "$_webi_tmp/.PATH.env"
printf "\e[31mTO FINISH\e[0m: copy, paste & run the following command:\n"
printf "\n"
printf " \e[34msource ~/.config/envman/PATH.env\e[0m\n"
printf " (newly opened terminal windows will update automatically)\n"
fi
fi

View File

@@ -131,7 +131,7 @@ Releases.get(path.join(process.cwd(), pkgdir)).then(function (all) {
console.info('Do the scripts actually work?');
if (bashFile && bashTxt) {
fs.writeFileSync(bashFile, bashTxt, 'utf-8');
console.info('\tNEEDS MANUAL TEST: sh %s', bashFile);
console.info('\tNEEDS MANUAL TEST: bash %s', bashFile);
}
if (ps1File && ps1Txt) {
fs.writeFileSync(ps1File, ps1Txt, 'utf-8');

View File

@@ -1,292 +0,0 @@
'use strict';
var path = require('path');
var Releases = require('./releases.js');
var cache = {};
var staleAge = 5 * 1000;
var expiredAge = 15 * 1000;
let installerDir = path.join(__dirname, '..');
// TODO needs a proper test, and more accurate (though perhaps far less simple) code
function createFormatsSorter(formats) {
return function sortByVerExt(a, b) {
function lexver(semver) {
// v1.20.156 => 00001.00020.00156.zzzzz
// TODO BUG: v1.20.156-rc2 => 00001.00020.00156.rc2zz
var parts = semver.split(/[+\.\-]/g);
while (parts.length < 4) {
parts.push('');
}
return parts
.map(function (num, i) {
if (3 === i) {
return num.toString().padEnd(10, 'z');
}
return num.toString().padStart(10, '0');
})
.join('.');
}
var aver = lexver(a.version);
var bver = lexver(b.version);
if (aver > bver) {
//console.log(aver, '>', bver);
return -1;
}
if (aver < bver) {
//console.log(aver, '<', bver);
return 1;
}
var aExtPri = formats.indexOf(a.ext.replace(/tar\..*/, 'tar'));
var bExtPri = formats.indexOf(b.ext.replace(/tar\..*/, 'tar'));
if (aExtPri > bExtPri) {
//console.log(a.ext, aExtPri, '>', b.ext, bExtPri);
return -1;
}
if (aExtPri < bExtPri) {
//console.log(a.ext, aExtPri, '<', b.ext, bExtPri);
return 1;
}
// Hacky-doo for linux: prefer musl
if (a._musl && !b._musl) {
return -1;
}
if (!a._musl && b._musl) {
return 1;
}
return 0;
};
}
async function getCachedReleases(pkg) {
// returns { download: '<template string>', releases: [{ version, date, os, arch, lts, channel, download}] }
function putCache() {
cache[pkg].promise = cache[pkg].promise.then(function () {
var age = Date.now() - cache[pkg].updatedAt;
if (age < staleAge) {
//console.debug('NOT STALE ANYMORE - updated in previous promise');
return cache[pkg].all;
}
//console.debug('DOWNLOADING NEW "%s" releases', pkg);
var pkgdir = path.join(installerDir, pkg);
return Releases.get(pkgdir)
.then(function (all) {
//console.debug('DOWNLOADED NEW "%s" releases', pkg);
cache[pkg].updatedAt = Date.now();
cache[pkg].all = all;
})
.catch(function (e) {
console.error(
'Error fetching releases for "%s": %s',
pkg,
e.toString()
);
cache[pkg].all = { download: '', releases: [] };
})
.then(function () {
return cache[pkg].all;
});
});
return cache[pkg].promise;
}
var p;
if (!cache[pkg]) {
cache[pkg] = {
updatedAt: 0,
all: null,
promise: Promise.resolve()
};
}
var age = Date.now() - cache[pkg].updatedAt;
if (age >= expiredAge) {
//console.debug("EXPIRED - waiting");
p = putCache();
} else if (age >= staleAge) {
//console.debug("STALE - background update");
putCache();
p = Promise.resolve(cache[pkg].all);
} else {
//console.debug("FRESH");
p = Promise.resolve(cache[pkg].all);
}
return p;
}
async function filterReleases(
all,
{ ver, os, arch, lts, channel, formats, limit }
) {
// When multiple formats are downloadable (i.e. .zip and .pkg)
// sort the most compatible format first
// (i.e. so that we don't do .pkg on linux except on purpose)
var rformats = formats.slice(0).reverse();
var sortByVerExt = createFormatsSorter(rformats);
var reVer = new RegExp('^' + ver + '\\b');
var sortedRels = all.releases
.filter(function (rel) {
if (
(os && rel.os !== os) ||
// Hacky-doo for linux musl
(arch && rel.arch !== arch) ||
(lts && !rel.lts) ||
(channel && rel.channel !== channel) ||
// to match 'tar.gz' and 'tar.xz' with just 'tar'
(formats.length &&
!formats.some(function (ext) {
return rel.ext.match(ext);
})) ||
(ver && !rel.version.match(reVer))
) {
return false;
}
return true;
})
.sort(sortByVerExt);
//console.log(sortedRels.slice(0, 4));
return sortedRels.slice(0, limit || 1000);
}
module.exports = function getReleases({
_count,
pkg,
ver,
os,
arch,
lts,
channel,
formats,
limit
}) {
if (!_count) {
_count = 0;
}
return getCachedReleases(pkg).then(function (all) {
return filterReleases(all, {
ver,
os,
arch,
lts,
channel,
formats,
limit
})
.catch(function (err) {
if ('MODULE_NOT_FOUND' === err.code) {
return null;
}
console.error(
'TODO: lib/release.js: check type of error, such as MODULE_NOT_FOUND'
);
console.error(err);
})
.then(function (releases) {
if (!releases.length) {
// Apple Silicon M1 hack-y do workaround fix
if ('macos' === os && 'arm64' === arch) {
return getReleases({
pkg,
ver,
os,
arch: 'amd64',
lts,
channel,
formats,
limit
});
}
// Raspberry Pi 3+ on Raspbian x86 (not Ubuntu arm64)
if (!_count && 'linux' === os && 'armv7l' === arch) {
return getReleases({
_count: _count + 1,
pkg,
ver,
os,
arch: 'arm64',
lts,
channel,
formats,
limit
});
}
// Raspberry Pi 3+ on Ubuntu arm64 (via Bionic?)
// (this may be the same as the prior search, that's okay)
if ('linux' === os && 'arm64' === arch) {
return getReleases({
_count: _count + 1,
pkg,
ver,
os,
arch: 'armv7l',
lts,
channel,
formats,
limit
});
}
// Raspberry Pi 3+ on Ubuntu arm64 (via Bionic?)
if ('linux' === os && 'armv7l' === arch) {
return getReleases({
_count: _count + 1,
pkg,
ver,
os,
arch: 'armv6l',
lts,
channel,
formats,
limit
});
}
releases = [
{
name: 'doesntexist.ext',
version: '0.0.0',
lts: '-',
channel: 'error',
date: '1970-01-01',
os: os || '-',
arch: arch || '-',
_musl: undefined,
ext: 'err',
download: 'https://example.com/doesntexist.ext',
comment:
'No matches found. Could be bad or missing version info' +
',' +
"Check query parameters. Should be something like '/api/releases/{package}@{version}.tab?os={macos|linux|windows|-}&arch={amd64|x86|aarch64|arm64|armv7l|-}&limit=100'"
}
];
}
return {
oses: all.oses,
arches: all.arches,
formats: all.formats,
releases: releases
};
});
});
};
if (require.main === module) {
return module
.exports({
pkg: 'node',
ver: '',
os: 'macos',
arch: 'amd64',
lts: true,
channel: 'stable',
formats: ['tar', 'exe', 'zip', 'xz', 'dmg', 'pkg'],
limit: 10
})
.then(function (all) {
console.info(JSON.stringify(all));
});
}

View File

@@ -1,7 +1,5 @@
'use strict';
var uaDetect = module.exports;
function getRequest(req) {
var ua = req.headers['user-agent'] || '';
var os = req.query.os;
@@ -59,7 +57,7 @@ function getArch(ua) {
// quick hack for Apple Silicon M1
// Native: Darwin boomer.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 arm64
// Resetta: Darwin boomer.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 x86_64
ua = ua.replace(/xnu-.*RELEASE_[^\s]*/, '');
ua = ua.replace(/xnu-.*RELEASE_[^\s]*/, '')
if (/aarch64|arm64|arm8|armv8/i.test(ua)) {
return 'arm64';
} else if (/aarch|arm7|armv7/i.test(ua)) {
@@ -84,6 +82,7 @@ function getArch(ua) {
}
}
var uaDetect = module.exports;
uaDetect.os = getOs;
uaDetect.arch = getArch;
uaDetect.request = getRequest;

View File

@@ -59,59 +59,11 @@ if (!(Test-Path -Path .local\bin\pathman.exe))
# Run pathman to set up the folder
# (using unix style path because... cmd vs powershell vs whatever)
$has_local_bin = echo "$Env:PATH" | Select-String -Pattern '\.local.bin'
if (!$has_local_bin)
{
Write-Host ''
Write-Host '**********************************' -ForegroundColor red -BackgroundColor white
Write-Host '* IMPORTANT -- READ ME *' -ForegroundColor red -BackgroundColor white
Write-Host '* (run the PATH command below) *' -ForegroundColor red -BackgroundColor white
Write-Host '**********************************' -ForegroundColor red -BackgroundColor white
Write-Host ''
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin
}
& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin
# {{ baseurl }}
# {{ version }}
$my_version = 'v1.1.15'
## show help if no params given or help flags are used
if ($exename -eq $null -or $exename -eq "-h" -or $exename -eq "--help" -or $exename -eq "help" -or $exename -eq "/?") {
Write-Host "webi " -ForegroundColor Green -NoNewline; Write-Host "$my_version " -ForegroundColor Red -NoNewline; Write-Host "Copyright 2020+ AJ ONeal"
Write-Host " https://webinstall.dev/webi" -ForegroundColor blue
echo ""
echo "SUMMARY"
echo " Webi is the best way to install the modern developer tools you love."
echo " It's fast, easy-to-remember, and conflict free."
echo ""
echo "USAGE"
echo " webi <thing1>[@version] [thing2] ..."
echo ""
echo "UNINSTALL"
echo " Almost everything that is installed with webi is scoped to"
echo " ~/.local/opt/<thing1>, so you can remove it like so:"
echo ""
echo " rmdir /s %USERPROFILE%\.local\opt\<thing1>"
echo " del %USERPROFILE%\.local\bin\<thing1>"
echo ""
echo " Some packages have special uninstall instructions, check"
echo " https://webinstall.dev/<thing1> to be sure."
echo ""
echo "FAQ"
Write-Host " See " -NoNewline; Write-Host "https://webinstall.dev/faq" -ForegroundColor blue
echo ""
echo "ALWAYS REMEMBER"
echo " Friends don't let friends use brew for simple, modern tools that don't need it."
exit 0
}
if ($exename -eq "-V" -or $exename -eq "--version" -or $exename -eq "version" -or $exename -eq "/v") {
Write-Host "webi " -ForegroundColor Green -NoNewline; Write-Host "$my_version " -ForegroundColor Red -NoNewline; Write-Host "Copyright 2020+ AJ ONeal"
Write-Host " https://webinstall.dev/webi" -ForegroundColor blue
exit 0
}
# Fetch <whatever>.ps1
# TODO detect formats
$PKG_URL = "$Env:WEBI_HOST/api/installers/$exename.ps1?formats=zip,exe,tar"

View File

@@ -5,7 +5,11 @@ tagline: |
Arc is a cross-platform, multi-format archive utility.
---
To update or switch versions, run `webi arc@stable` (or `@v3.5`, `@beta`, etc).
## Updating `arc`
`webi arc@stable`
Use the `@beta` tag for pre-releases.
## Cheat Sheet

View File

@@ -15,12 +15,12 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\archiver-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\archiver-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
# TODO: arch detection
echo "Downloading archiver from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
@@ -39,7 +39,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd"))
Remove-Item -Path ".\arc.exe" -Recurse -ErrorAction Ignore
# Move single binary into root of temporary folder
& move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE" "arc.exe"
& move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" "arc.exe"
# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"

View File

@@ -1,8 +1,6 @@
#!/bin/sh
set -e
set -u
__init_arc() {
{
set -e
set -u
####################
# Install archiver #
@@ -21,7 +19,7 @@ __init_arc() {
# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/arc-v3.2.0/bin
mkdir -p "$(dirname "$pkg_src_cmd")"
mkdir -p "$(dirname $pkg_src_cmd)"
# mv ./arc_* ~/.local/opt/arc-v3.2.0/bin/arc
mv ./arc_* "$pkg_src_cmd"
@@ -33,8 +31,6 @@ __init_arc() {
# arc v3.5.0 (25e050d) 2020-10-30T03:27:58Z
# This trims it down to just the version number:
# 3.5.0
arc version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::'
echo "$(arc version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')"
}
}
__init_arc

View File

@@ -1,11 +0,0 @@
---
title: Archiver (arc alias)
homepage: https://webinstall.dev/arc
tagline: |
Alias for https://webinstall.dev/arc
alias: arc
description: |
See https://webinstall.dev/arc
---
Alias for https://webinstall.dev/arc

View File

@@ -1,11 +1,10 @@
#!/bin/sh
set -e
set -u
# title: Archiver (arc alias)
# homepage: https://webinstall.dev/arc
# tagline: Alias for https://webinstall.dev/arc
# alias: arc
# description: |
# See https://webinstall.dev/arc
__redirect_alias_arc() {
echo "'archiver@${WEBI_TAG:-stable}' is an alias for 'arc@${WEBI_VERSION:-}'"
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL "$WEBI_HOST/arc@${WEBI_VERSION:-}" | sh
}
__redirect_alias_arc
echo "'archiver@${WEBI_TAG:-stable}' is an alias for 'arc@${WEBI_VERSION:-}'"
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL "$WEBI_HOST/arc@${WEBI_VERSION:-}" | bash

View File

@@ -12,7 +12,7 @@ To update or switch versions, run `webi awless@stable` (or `@v2`, `@beta`, etc).
awless is modeled after popular command-line tools such as Git. Most commands
are in the form of:
```sh
```bash
awless verb [entity] [parameter=value ...]
```
@@ -26,13 +26,13 @@ Unlike the standard awscli tools, `awless` aims to be more human readable.
For instance, let's list some resources:
```sh
```bash
awless list vpcs
```
Which outputs a friendly human readable table!
```sh
```bash
| ID ▲ | NAME | DEFAULT | STATE | CIDR |
|-----------------------|------|---------|-----------|---------------|
| vpc-00fd208a070000000 | | false | available | 172.16.0.0/16 |
@@ -42,13 +42,13 @@ Which outputs a friendly human readable table!
There's also filter capabilities, in case the list is long. For example, let's
list all EC2 instances with "api" in the name:
```sh
```bash
awless list instances --filter name=api
```
In addition to the default table output, there's also csv, tsv, json.
```sh
```bash
awless list loadbalancers --format csv
```
@@ -56,7 +56,7 @@ awless list loadbalancers --format csv
awless allows specifying things by name rather than ID by using the `@` prefix.
```sh
```bash
awless create subnet cidr=10.0.0.0/24 vpc=@wordpress-vpc name=wordpress-public-subnet
```
@@ -65,13 +65,13 @@ awless create subnet cidr=10.0.0.0/24 vpc=@wordpress-vpc name=wordpress-public-s
If you leave out a parameter, awless will prompt you for the missing
information.
```sh
```bash
awless delete i-123456789000abcd
```
It will correctly detect what you were probably trying to do:
```sh
```bash
Did you mean `awless delete instance ids=i-051fcef0537a53eb0` ? [Y/n]
```

View File

@@ -16,11 +16,11 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\awless-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\awless-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE")) {
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE")) {
# TODO: arch detection
echo "Downloading awless from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# "This is too simple" you say! "Where is the magic!?" you ask.
# There is no magic!
@@ -19,7 +19,7 @@ pkg_get_current_version() {
# v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
# This trims it down to just the version number:
# 2.1.0
awless version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::'
echo "$(awless version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')"
}
pkg_install() {

View File

@@ -5,16 +5,22 @@ tagline: |
bat: A cat(1) clone with syntax highlighting and Git integration.
---
To update or switch versions, run `webi bat@stable` (or `@v0.18`, `@beta`, etc).
## Updating `bat`
```bash
webi bat@stable
```
Use the `@beta` tag for pre-releases.
## Cheat Sheet
> `bat` is pretty much what `cat` would be if it were developed today's in the
> world of Markdown, git, etc.
### How to run on Windows
### How to run on Windows 10
On Windows you'll get an error like this:
On Windows 10 you'll get an error like this:
> execution cannot proceed run because vcruntime140.dll was not found
@@ -25,14 +31,13 @@ You need to download and install the
Update your `.bashrc`, `.zshrc`, or `.profile`
```sh
```bash
alias cat="bat --style=plain"
```
For situations in which you must use `cat` exactly, remember that you can escape
the alias:
For situations in which you must use `cat` exactly, remember that you can escape the alias:
```sh
```bash
\cat foo
```
@@ -40,13 +45,13 @@ the alias:
Take a look at the config options:
```sh
```bash
bat --help
```
Check to see where your config file is:
```sh
```bash
echo 'N' | bat --generate-config-file
```

View File

@@ -3,11 +3,12 @@
$VERNAME = "$Env:PKG_NAME-v$Env:WEBI_VERSION.exe"
$EXENAME = "$Env:PKG_NAME.exe"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# TODO: arch detection
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
}
IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
@@ -23,8 +24,8 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
# Unpack archive
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
echo "Unpacking $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Move single binary into root of temporary folder
& move "bat-*\$EXENAME" "$VERNAME"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
set -e
set -u
#!/bin/bash
__init_bat() {
{
set -e
set -u
###############
# Install bat #
@@ -15,7 +15,7 @@ __init_bat() {
# bat 0.15.4
# This trims it down to just the version number:
# 0.15.4
bat --version 2> /dev/null | head -n 1 | cut -d' ' -f 2
echo $(bat --version 2> /dev/null | head -n 1 | cut -d' ' -f 2)
}
pkg_install() {
@@ -29,5 +29,3 @@ __init_bat() {
chmod a+x "$pkg_src_cmd"
}
}
__init_bat

View File

@@ -9,7 +9,7 @@ tagline: |
`brew` has its own built-in upgrade management.
```sh
```bash
brew update
brew upgrade
```
@@ -26,27 +26,27 @@ way, report it to brew.
### How to install CLI packages
```sh
```bash
brew update
brew install node
```
### How to install GUI packages
```sh
```bash
brew update
brew cask install docker
```
### Where are things installed?
```sh
```bash
~/.local/opt/brew/
```
For reference, traditional `brew` installs here:
```sh
```bash
/usr/local/Cellar/
/opt/homebrew-cask/Caskroom/
```
@@ -58,7 +58,7 @@ like `brew upgrade` or `brew update python`, and your whole system gets borked.
If you need to _uninstall_ and _reinstall_ local brew:
```sh
```bash
rm -rf ~/.local/opt/brew
webi brew
```
@@ -67,12 +67,12 @@ If you need to _uninstall_ global brew:
For _Mojave_, _Catalina_, _Big Sur_, and above:
```sh
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
```
For _High Sierra_ and below:
```sh
```bash
/bin/bash -c ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
```

View File

@@ -1,15 +1,15 @@
#!/bin/sh
#!/bin/bash
set -e
set -u
_install_brew() {
function _install_brew() {
# Straight from https://brew.sh
#/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
if uname -a | grep -q -i darwin; then
if [[ -n "$(uname -a | grep -i darwin)" ]]; then
needs_xcode="$(/usr/bin/xcode-select -p > /dev/null 2> /dev/null || echo "true")"
if [ -n "${needs_xcode}" ]; then
if [[ -n ${needs_xcode} ]]; then
echo ""
echo ""
echo "ERROR: Run this command to install XCode Command Line Tools first:"
@@ -37,7 +37,6 @@ _install_brew() {
echo ""
echo "If you prefer to have brew installed to '/usr/local' cancel now and do the following:"
echo " rm -rf '$HOME/.local/opt/brew'"
# shellcheck disable=2016
echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
echo ""
sleep 3
@@ -57,7 +56,6 @@ _install_brew() {
echo ""
echo "If you prefer to have brew installed to '/usr/local' do the following:"
echo " mv '$HOME/.local/opt/brew' '$HOME/.local/opt/brew.$(date '+%F_%H-%M-%S').bak'"
# shellcheck disable=2016
echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
echo ""
}

View File

@@ -5,8 +5,13 @@ tagline: |
Caddy is a fast, multi-platform web server with automatic HTTPS.
---
To update or switch versions, run `webi caddy@stable` (or `@v2.4`, `@beta`,
etc).
## Updating `caddy`
```bash
webi caddy@stable
```
Use the `@beta` tag for pre-releases, or `@x.y.z` for a specific version.
## Cheat Sheet
@@ -21,168 +26,62 @@ Here's the things we find most useful:
- Running as a system service on
- Linux
- MacOS
- Windows
- Windows 10
### How to serve a directory
```sh
caddy file-server --browse --listen :443
```bash
caddy file-server --browse --listen :4040
```
### How to serve via Caddyfile
```sh
caddy run --config ./Caddyfile
```
Note: `run` runs in the foreground, `start` starts a background service (daemon)
in the background.
### How to serve HTTPS on localhost
Caddy can be used to test with https on localhost.
`Caddyfile`:
```Caddyfile
localhost {
handle /* {
root * ./public/
file_server
}
handle /api/* {
reverse_proxy localhost:3000
}
}
```
### How to serve on Linux/VPS (systemd)
1. Create a generic `Caddyfile`
```sh
mkdir -p ~/srv/caddy
echo '
# Generically vhost all domains pointed at this server
https:// {
tls {
on_demand
}
handle /* {
file_server
root * /home/app/srv/www/{host}/public/
}
}
' > ~/srv/caddy/Caddyfile
```
2. Install serviceman
```sh
webi serviceman
source ~/.config/envman/PATH.env
```
3. Install caddy as a system service
```sh
sudo env PATH="$PATH" \
serviceman add --system --username "$(whoami)" --name caddy -- \
caddy run --config ~/srv/caddy/Caddyfile
```
Note: In this example any host that points to the server and has files in
`~/srv/www/{host}/public` can be served without additional changes.
Note: More on using `systemctl` below.
### How to redirect and reverse proxy
Here's what a fairly basic `Caddyfile` looks like:
`Caddyfile`:
```Caddyfile
```txt
# redirect www to bare domain
www.example.com {
redir https://example.com{uri} permanent
}
example.com {
###########
# Logging #
###########
# log to stdout, which is captured by journalctl
log {
output stdout
format console
}
###############
# Compression #
###############
# turn on standard streaming compression
encode gzip zstd
####################
# Reverse Proxying #
####################
# reverse proxy /api to :3000
handle /api/* {
reverse_proxy localhost:3000
}
reverse_proxy /api/* localhost:3000
# reverse proxy some "well known" APIs
handle /.well-known/openid-configuration {
reverse_proxy localhost:3000
}
handle /.well-known/jwks.json {
reverse_proxy localhost:3000
}
reverse_proxy /.well-known/openid-configuration localhost:3000
reverse_proxy /.well-known/jwks.json localhost:3000
##################
# Path Rewriting #
##################
# reverse proxy and rewrite path /api/oldpath/* => /api/newpath/*
handle_path /api/oldpath/* {
rewrite * /api/newpath{path}
reverse_proxy localhost:3000
# serve static files from public folder, but not /api
@notApi {
file {
try_files {path} {path}/ {path}/index.html
}
not path /api/*
not path /.well-known/openid-configuration
not path /.well-known/jwks.json
}
###############
# File Server #
###############
# serve static files
handle /* {
root * /srv/example.com/public/
file_server
route {
rewrite @notApi {http.matchers.file.relative}
}
root * /srv/example.com/public/
file_server
}
```
```sh
caddyfile run --config ./Caddyfile
```
And here's how you run caddy with it:
- [`log`](https://caddyserver.com/docs/caddyfile/directives/log)
- [`encode`](https://caddyserver.com/docs/caddyfile/directives/encode)
- [`handle`](https://caddyserver.com/docs/caddyfile/directives/handle)
- [`handle_path`](https://caddyserver.com/docs/caddyfile/directives/handle_path)
- [`root`](https://caddyserver.com/docs/caddyfile/directives/root)
- [`file_server`](https://caddyserver.com/docs/caddyfile/directives/file_server)
### How to rewrite and reverse proxy
```Caddyfile
example.com {
# ...
# reverse proxy /api/new/ to http://localhost:3100/api/
handle_path /api/new/* {
rewrite * /api{path}
reverse_proxy localhost:3100
}
}
```bash
caddy run --config ./Caddyfile
```
### How to start Caddy as a Linux service
@@ -198,11 +97,10 @@ Using a user named `app` to run your services is common industry convention.
**port-binding privileges**
You can use `setcap` or [`setcap-netbind`](/setcap-netbind) to allow Caddy to
use privileged ports.
You can use `setcap` to allow Caddy to use privileged ports.
```sh
sudo setcap cap_net_bind_service=+ep "$(readlink -f "$(command -v caddy)")"
```bash
sudo setcap cap_net_bind_service=+ep $(readlink -f $(command -v caddy))
```
**systemd config**
@@ -212,13 +110,13 @@ start the appropriate systemd launcher for Linux.
Install Serviceman with Webi:
```sh
```bash
webi serviceman
```
Use Serviceman to create a _systemd_ config file.
```sh
```bash
sudo env PATH="$PATH" \
serviceman add --system --username $(whoami) --name caddy -- \
caddy run --config ./Caddyfile
@@ -227,7 +125,7 @@ sudo env PATH="$PATH" \
This will create `/etc/systemd/system/caddy.service`, which can be managed with
`systemctl`. For example:
```sh
```bash
sudo systemctl restart caddy
```
@@ -244,13 +142,13 @@ start the appropriate service launcher file for MacOS.
Install Serviceman with Webi:
```sh
```bash
webi serviceman
```
Use Serviceman to create a _launchd_ plist file.
```sh
```bash
serviceman add --username $(whoami) --name caddy -- \
caddy run --config ./Caddyfile
```
@@ -258,7 +156,7 @@ serviceman add --username $(whoami) --name caddy -- \
This will create `~//Library/LaunchAgents/caddy.plist`, which can be managed
with `launchctl`. For example:
```sh
```bash
launchctl unload -w "$HOME/Library/LaunchAgents/caddy.plist"
launchctl load -w "$HOME/Library/LaunchAgents/caddy.plist"
```
@@ -280,24 +178,24 @@ powershell.exe -WindowStyle Hidden -Command $r = Get-NetFirewallRule -DisplayNam
**Startup Registry**
You can use [Serviceman](https://webinstall.dev/serviceman) to create and start
the appropriate service launcher for Windows.
the appropriate service launcher for Windows 10.
Install Serviceman with Webi:
```sh
```bash
webi.bat serviceman
```
Use Serviceman to create a Startup entry in the Windows Registry:
```sh
```bash
serviceman.exe add --name caddy -- \
caddy run --config ./Caddyfile
```
You can manage the service directly with Serviceman. For example:
```sh
```bash
serviceman stop caddy
serviceman start caddy
```

View File

@@ -16,11 +16,11 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\caddy-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\caddy-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE")) {
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE")) {
# TODO: arch detection
echo "Downloading caddy from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# "This is too simple" you say! "Where is the magic!?" you ask.
# There is no magic!
@@ -19,7 +19,7 @@ pkg_get_current_version() {
# v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
# This trims it down to just the version number:
# 2.1.0
caddy version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::'
echo "$(caddy version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')"
}
pkg_install() {

View File

@@ -24,7 +24,7 @@ Also, **Chrome must be installed first** in order for ChromeDriver to work.
On Debian (and Ubuntu) Linux you should be able to install Chrome with `dpkg`
and `apt`:
```sh
```bash
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt install -y google-chrome-stable
@@ -39,7 +39,7 @@ chromedriver: error while loading shared libraries: libnss3.so: cannot open shar
If so, try installing `chromium-browser`:
```sh
```bash
sudo apt install -y chromium-browser
sudo apt --fix-broken install -y
```

View File

@@ -15,12 +15,12 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\chromedriver-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\chromedriver-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
# TODO: arch detection
echo "Downloading chromedriver from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
set -e
set -u
#!/bin/bash
__init_chromedriver() {
{
set -e
set -u
########################
# Install chromedriver #
@@ -21,7 +21,7 @@ __init_chromedriver() {
# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/chromedriver-v88.0.4324.96/bin
mkdir -p "$(dirname "$pkg_src_cmd")"
mkdir -p "$(dirname $pkg_src_cmd)"
# mv ./chromedriver-*/chromedriver ~/.local/opt/chromedriver-v88.0.4324.96/bin/chromedriver
mv ./chromedriver* "$pkg_src_cmd"
@@ -33,9 +33,7 @@ __init_chromedriver() {
# ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784})
# This trims it down to just the version number:
# 88.0.4324.96
chromedriver --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2
echo $(chromedriver --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2)
}
}
__init_chromedriver

View File

@@ -5,8 +5,11 @@ tagline: |
Comrak is a Rust port of github's cmark-gfm.
---
To update or switch versions, run `webi comrak@stable` (or `@v0.11`, `@beta`,
etc).
### Updating `comrak`
`webi comrak@stable`
Use the `@beta` tag for pre-releases.
## Cheat Sheet
@@ -14,7 +17,7 @@ etc).
> Flavored Markdown Spec: Tables, Task list items, Strikethrough, Autolinks, &
> Disallowed Raw HTML
```sh
```bash
comrak --gfm index.md > index.html
```
@@ -28,7 +31,7 @@ Here you'll learn how to:
## How to Convert Markdown to HTML
```sh
```bash
comrak --gfm --header-ids '' README.md > README.html
```
@@ -39,7 +42,7 @@ defaults to always include your favorite options.
Here's what I suggest:
```sh
```bash
echo "--gfm --header-ids ''" > ~/.config/comrak/config
```
@@ -62,7 +65,7 @@ Example:
Then, to sanitize `<script>` and `<iframe>` tags you must add `-e tagfilter`
(which the `--gfm` option also enables).
```sh
```bash
comrak --unsafe --gfm --header-ids '' README.md
```
@@ -75,7 +78,7 @@ The `--unsafe` option
If you want Github-Flavored Markdown with trusted scripts, you'll need to enable
its extensions by hand:
```sh
```bash
echo "
# WARNING: allows <script>, <iframe>
# and <a href=javascript:alert('')>
@@ -100,7 +103,7 @@ echo "
" > ~/.config/comrak/allow-scripts
```
```sh
```bash
comrak --config ~/.config/comrak/allow-scripts README.md
```
@@ -110,6 +113,6 @@ You can disable all options with `--config-file none`.
Example:
```sh
```bash
comrak --config-file none -e table README.md
```

View File

@@ -3,11 +3,12 @@
$VERNAME = "$Env:PKG_NAME-v$Env:WEBI_VERSION.exe"
$EXENAME = "$Env:PKG_NAME.exe"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# TODO: arch detection
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
}
IF (!(Test-Path -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION\bin\$VERNAME"))
@@ -22,7 +23,7 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERS
Remove-Item -Path "$Env:PKG_NAME-v*" -Recurse -ErrorAction Ignore
# Move single binary into root of temporary folder
& move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE" "$VERNAME"
& move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" "$VERNAME"
# Settle unpacked archive into place
echo "New Name: $VERNAME"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
set -e
set -u
#!/bin/bash
__init_comrak() {
{
set -e
set -u
##################
# Install comrak #
@@ -15,7 +15,7 @@ __init_comrak() {
# comrak 0.8.1
# This trims it down to just the version number:
# 0.8.1
comrak --version 2> /dev/null | head -n 1 | cut -d' ' -f 2
echo $(comrak --version 2> /dev/null | head -n 1 | cut -d' ' -f 2)
}
pkg_install() {
@@ -34,5 +34,3 @@ __init_comrak() {
"$pkg_src_cmd" --version > /dev/null
}
}
__init_comrak

View File

@@ -5,8 +5,13 @@ tagline: |
curlie wraps `curl` with modern defaults and `httpie`-like syntax highlighting
---
To update or switch versions, run `webi curlie@stable` (or `@v1.6`, `@beta`,
etc).
## Updating
```bash
webi curlie@stable
```
Use the `@beta` tag for pre-releases.
## Cheat Sheet
@@ -22,19 +27,19 @@ etc).
### Simple GET
```sh
```bash
curlie -v example.com
```
### POST simple JSON with headers
```sh
```bash
curlie -v POST httpbin.org/status/201 "Authorization: Bearer xxxx" "name=John Doe"
```
### POST large JSON
```sh
```bash
curlie -v POST httpbin.org/status/201 "Authorization: Bearer xxxx" -d '
[
{
@@ -49,7 +54,7 @@ curlie -v POST httpbin.org/status/201 "Authorization: Bearer xxxx" -d '
The `--resolve` option is for when you need to test a local service as if it had
a remote hostname and TLS SNI (or when you want to break things 😈).
```sh
```bash
curlie https://foo.example.com:8443 "Host: foo.example.com" \
--resolve foo.example.com:8443:127.0.0.1
```

View File

@@ -3,11 +3,12 @@
$VERNAME = "$Env:PKG_NAME-v$Env:WEBI_VERSION.exe"
$EXENAME = "$Env:PKG_NAME.exe"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# TODO: arch detection
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
}
IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
@@ -23,8 +24,8 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
# Unpack archive
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
echo "Unpacking $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Move single binary into root of temporary folder
& move "$EXENAME" "$VERNAME"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
set -e
set -u
#!/bin/bash
__init_curlie() {
{
set -e
set -u
##################
# Install curlie #
@@ -12,10 +12,12 @@ __init_curlie() {
pkg_get_current_version() {
# 'curlie --version' has output in this format:
# curlie 1.6.9 (2022-04-04T15:04:20Z)
# TODO
# This trims it down to just the version number:
# 1.6.9
curlie version 2> /dev/null | head -n 1 | cut -d' ' -f 2
# TODO
#echo $(curlie --version 2>/dev/null | head -n 1 | cut -d' ' -f 2)
# See https://github.com/rs/curlie/issues/22
echo "0.0.0"
}
pkg_install() {
@@ -29,5 +31,3 @@ __init_curlie() {
chmod a+x "$pkg_src_cmd"
}
}
__init_curlie

View File

@@ -1,94 +0,0 @@
---
title: dashmsg
homepage: https://github.com/dashhive/dashmsg
tagline: |
dashmsg: a cross-platform tool to Sign and Verify Dash messages via Private Key and/or Payment Address
---
To update or switch versions, run `webi dashmsg@stable`.
## Cheat Sheet
> dashmsg allows you to sign and verify, like dash-cli, but without needing a
> full dash node with rpc to do so.
- Generates secp256k1 ECDSA keys (WIF)
- Signatures output as Base64
- Verifies signatures by Payment Address (PubKeyHash)
### How to generate a new Private Key (WIF)
```sh
# dashmsg gen <key>
dashmsg gen priv.wif
```
```sh
dashmsg gen > pirv.wif
```
### How to sign a message
```sh
# dashmsg sign <priv key> <data or file>
dashmsg sign ./priv.wif 'vote2022-alice|bob|charlie'
```
```txt
H2Opy9NX72iPZRcDVEHrFn2qmVwWMgc+DKILdVxl1yfmcL2qcpu9esw9wcD7RH0/dJHnIISe5j39EYahorWQM7I=
```
### How to verify a signature
```sh
# dashmsg verify <payment address> <message> <signature>
dashmsg verify 'Xn4A2vv5fb7LvmiiXPPMexYbSbiQ29rzDu' \
'vote2022-alice|bob|charly' \
./signature.txt
```
### Inspecting & Debugging
You can also use this tool to inspect Private Key, Signatures, and Payment
Addresses:
#### How to inspect a Private Key:
```msg
dashmsg inspect 'XK5DHnAiSj6HQNsNcDkawd9qdp8UFMdYftdVZFuRreTMJtbJhk8i'
```
```txt
PrivateKey (hex): cc (coin type)
: e84f59fec1c8cc7feb9ce1c829849ae336f73e56437301eb5db945c8e0dd2683
: 01 (compressed)
PublicKey (hex): 04 (uncompressed)
x: bbe03e3da812a587be6b939c31483121c23af0e1ce6504c38902d92c5ab784b2
y: 567eca6bbd7db1e9e8940b2534131b2f9bbaf1db585c8fa38f57bd31b382d247
Address (b58c): Xn4A2vv5fb7LvmiiXPPMexYbSbiQ29rzDu
```
#### How to inspect a signature
```sh
dashmsg inspect 'IFLv0JVRM70bTZCTmzMfNX3NVkSULmnAR/3PSWpgC5GXBD7rRi5g4QsK968ITE3dfKdzhX7fAIXwhpnsP0WvQOc='
```
```txt
I (0): 1 (quadrant)
R (1-32): 52efd0955133bd1b4d90939b331f357dcd5644942e69c047fdcf496a600b9197
S (33-64): 043eeb462e60e10b0af7af084c4ddd7ca773857edf0085f08699ec3f45af40e7
```
#### How to inspect a payment address
```sh
dashmsg inspect 'Xn4A2vv5fb7LvmiiXPPMexYbSbiQ29rzDu'
```
```txt
Address (hex): 4c (coin type)
: 7cb1500163c8d413314dc238f9268b6c723a48f0
```

View File

@@ -1,57 +0,0 @@
#!/usr/bin/env pwsh
####################
# Install dashmsg #
####################
# Every package should define these variables
$pkg_cmd_name = "dashmsg"
$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\dashmsg.exe"
$pkg_dst = "$pkg_dst_cmd"
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\dashmsg-v$Env:WEBI_VERSION\bin\dashmsg.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\dashmsg-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\dashmsg-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
{
echo "Downloading dashmsg from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}
IF (!(Test-Path -Path "$pkg_src_cmd"))
{
echo "Installing dashmsg"
# TODO: create package-specific temp directory
# Enter tmp
pushd .local\tmp
# Remove any leftover tmp cruft
Remove-Item -Path ".\dashmsg-v*" -Recurse -ErrorAction Ignore
Remove-Item -Path ".\dashmsg.exe" -Recurse -ErrorAction Ignore
# Unpack archive file into this temporary directory
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $pkg_download"
& tar xf "$pkg_download"
# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"
New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
Move-Item -Path ".\dashmsg.exe" -Destination "$pkg_src_bin"
# Exit tmp
popd
}
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse

View File

@@ -1,42 +0,0 @@
#!/bin/sh
__init_dashmsg() {
set -e
set -u
####################
# Install dashmsg #
####################
# Every package should define these 6 variables
pkg_cmd_name="dashmsg"
pkg_dst_cmd="$HOME/.local/bin/dashmsg"
pkg_dst="$pkg_dst_cmd"
pkg_src_cmd="$HOME/.local/opt/dashmsg-v$WEBI_VERSION/bin/dashmsg"
pkg_src_dir="$HOME/.local/opt/dashmsg-v$WEBI_VERSION"
pkg_src="$pkg_src_cmd"
pkg_install() {
# $HOME/.local/opt/dashmsg-v0.9.0/bin
mkdir -p "$(dirname "$pkg_src_cmd")"
# mv ./dashmsg* "$HOME/.local/opt/dashmsg-v0.9.0/bin/dashmsg"
mv ./"$pkg_cmd_name"* "$pkg_src_cmd"
# chmod a+x "$HOME/.local/opt/dashmsg-v0.9.0/bin/dashmsg"
chmod a+x "$pkg_src_cmd"
}
pkg_get_current_version() {
# 'dashmsg version' has output in this format:
# dashmsg v0.9.0 (6d73209) 2022-03-12T09:07:43Z
# This trims it down to just the version number:
# 0.9.0
dashmsg --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::'
}
}
__init_dashmsg

View File

@@ -1,18 +0,0 @@
'use strict';
var github = require('../_common/github.js');
var owner = 'dashhive';
var repo = 'dashmsg';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
return all;
});
};
if (module === require.main) {
module.exports(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
console.info(JSON.stringify(all, null, 2));
});
}

View File

@@ -1,140 +0,0 @@
---
title: delta
homepage: https://github.com/dandavison/delta
tagline: |
delta: A syntax-highlighting pager for git and diff output
---
To update or switch versions, run `webi delta` (or `@0.9.1`, `@0.9.0`, etc).
**Note**: You should install [git](./git) before installing `delta`.
## Cheat Sheet
> `delta` gives you GitHub-style diffs, with word-level diff coloring, right in
> your trusty rusty terminal.
![](https://user-images.githubusercontent.com/52205/65248525-32250480-daea-11e9-9965-1a05c6a4bdf4.png)
Here we'll cover:
- **The install**: which files are added or changed
- **Configuration**: how to set a syntax theme
- **Preview**: how to list or show the color schemes
- **Manual Config**: how to turn `delta` on or off for git diffs
For the full set of options, be sure to check out the helpful
[README](https://github.com/dandavison/delta).
## Files
These are the files that are created and/or modified with this installer:
```txt
~/.config/envman/PATH.env
~/.gitconfig
~/.local/bin/delta
~/.local/opt/delta-VERSION/bin/delta
```
## How to set delta's color scheme
Delta uses `~/.gitconfig` for most of its options.
Set `delta.syntax-theme` to change the color scheme:
```sh
git config --global delta.syntax-theme 'Coldark-Dark'
```
## How to list / preview delta's themes
You can list all available themes with `--list-syntax-themes`, or see each color
schemes in action with `--show-syntax-themes`:
```sh
delta --list-syntax-themes --dark
delta --show-syntax-themes --dark
```
You can also show only light or dark themes:
```sh
delta --list-syntax-themes --light
delta --show-syntax-themes --light
```
```sh
delta --list-syntax-themes --dark
delta --show-syntax-themes --dark
```
Here's the current list, for convenience:
### Dark Syntax Themes
```txt
1337
Coldark-Cold
Coldark-Dark
DarkNeon
Dracula
Monokai Extended
Monokai Extended Bright
Monokai Extended Origin
Nord
OneHalfDark
Solarized (dark)
Sublime Snazzy
TwoDark
Visual Studio Dark+
ansi
base16
base16-256
gruvbox-dark
zenburn
```
### Light Syntax Themes
```txt
GitHub
Monokai Extended Light
OneHalfLight
Solarized (light)
gruvbox-light
```
## How to manually configure git to use delta
You can use `git config --global` to get or set any arbitrary option of
`~/.gitconfig`.
```sh
git config --global page.diff delta
git config --global page.show delta
git config --global page.log delta
git config --global page.blame delta
git config --global page.reflog delta
git config --global interactive.diffFilter 'delta --color-only'
git config --global delta.syntax-theme 'Coldark-Dark'
```
Your `~/.gitconfig` will then contain these sections and options:
```gitconfig
[pager]
diff = delta
show = delta
log = delta
blame = delta
reflog = delta
[interactive]
diffFilter = delta --color-only
[delta]
syntax-theme = Coldark-Dark
```

View File

@@ -1,65 +0,0 @@
#!/usr/bin/env pwsh
##################
# Install delta #
##################
# Every package should define these variables
$pkg_cmd_name = "delta"
$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\delta.exe"
$pkg_dst = "$pkg_dst_cmd"
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\delta-v$Env:WEBI_VERSION\bin\delta.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\delta-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\delta-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
{
echo "Downloading delta from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}
IF (!(Test-Path -Path "$pkg_src_cmd"))
{
echo "Installing delta"
# TODO: create package-specific temp directory
# Enter tmp
pushd .local\tmp
# Remove any leftover tmp cruft
Remove-Item -Path ".\delta-v*" -Recurse -ErrorAction Ignore
Remove-Item -Path ".\delta.exe" -Recurse -ErrorAction Ignore
# Unpack archive file into this temporary directory
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $pkg_download"
& tar xf "$pkg_download"
# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"
New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
Move-Item -Path ".\delta-*\delta.exe" -Destination "$pkg_src_bin"
# set delta to be the default differ
git config --global page.diff delta
git config --global page.show delta
git config --global page.log delta
git config --global page.blame delta
git config --global page.reflog delta
git config --global interactive.diffFilter 'delta --color-only'
# Exit tmp
popd
}
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse

View File

@@ -1,54 +0,0 @@
#!/bin/sh
set -e
set -u
# shellcheck disable=SC2034
# "'pkg_cmd_name' appears unused. Verify it or export it."
__init_delta() {
#################
# Install delta #
#################
# Every package should define these 6 variables
pkg_cmd_name="delta"
pkg_dst_cmd="$HOME/.local/bin/delta"
pkg_dst="$pkg_dst_cmd"
pkg_src_cmd="$HOME/.local/opt/delta-v$WEBI_VERSION/bin/delta"
pkg_src_dir="$HOME/.local/opt/delta-v$WEBI_VERSION"
pkg_src="$pkg_src_cmd"
# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/delta-v0.99.9/bin
mkdir -p "$(dirname "$pkg_src_cmd")"
# mv ./delta-*/delta ~/.local/opt/delta-v0.99.9/bin/delta
mv ./delta-*/delta "$pkg_src_cmd"
git config --global page.diff delta
git config --global page.show delta
git config --global page.log delta
git config --global page.blame delta
git config --global page.reflog delta
git config --global interactive.diffFilter 'delta --color-only'
}
# pkg_get_current_version is recommended, but not required
pkg_get_current_version() {
# 'delta --version' has output in this format:
# delta 0.9.2
# This trims it down to just the version number:
# 0.9.2
delta --version 2> /dev/null |
head -n 1 |
cut -d ' ' -f 2
}
}
__init_delta

View File

@@ -1,20 +0,0 @@
'use strict';
var github = require('../_common/github.js');
var owner = 'dandavison';
var repo = 'delta';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
return all;
});
};
if (module === require.main) {
module.exports(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
// just select the first 15 for demonstration
all.releases = all.releases.slice(0, 15);
console.info(JSON.stringify(all, null, 2));
});
}

View File

@@ -5,8 +5,13 @@ tagline: |
Deno: A secure runtime for JavaScript and TypeScript.
---
To update or switch versions, run `webi deno@stable` (or `@v1.13`, `@beta`,
etc).
## Updating `deno`
```bash
webi deno@stable
```
Use the `@beta` tag for pre-releases, or `@x.y.z` for a specific version.
## Cheat Sheet
@@ -17,25 +22,25 @@ etc).
The obligatory Hello World
```sh
```bash
deno run https://deno.land/std/examples/welcome.ts
```
Run a local file
```sh
```bash
deno run ./hello.ts
```
Enable [permissions](https://deno.land/manual/getting_started/permissions)
```sh
```bash
deno run --allow-read=./data,./public --allow-write=./data \
--allow-net=example.com,example.net ./hello.ts
```
Format source code, recursively
```sh
```bash
deno fmt ./my-project
```

View File

@@ -1,12 +1,13 @@
#!/usr/bin/env pwsh
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# TODO: arch detection
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
#Invoke-WebRequest https://nodejs.org/dist/v12.16.2/node-v12.16.2-win-x64.zip -OutFile node-v12.16.2-win-x64.zip
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
}
IF (!(Test-Path -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION"))
@@ -22,8 +23,8 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERS
# Unpack archive
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
echo "Unpacking $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Settle unpacked archive into place
echo "New Name: $Env:PKG_NAME-v$Env:WEBI_VERSION"

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# The custom functions for Deno are here.
# For the generic functions - version checks, download, extract, etc:
@@ -19,7 +19,7 @@ pkg_get_current_version() {
# typescript 3.9.2
# This trims it down to just the version number:
# 1.1.1
deno --version 2> /dev/null | head -n 1 | cut -d' ' -f2
echo "$(deno --version 2> /dev/null | head -n 1 | cut -d' ' -f2)"
}
pkg_install() {

View File

@@ -11,9 +11,9 @@ tagline: |
Use the `@beta` tag for pre-releases.
#### Windows
#### Windows 10
On Windows you'll get an error like this:
On Windows 10 you'll get an error like this:
> execution cannot proceed run because `vcruntime140.dll` was not found
@@ -22,46 +22,45 @@ You need to download and install the
## Cheat Sheet
> Dotenv Linter is a lightning-fast check for your `.env` files. It can rapidly
> detect and automatically fix issues.
> Dotenv Linter is a lightning-fast check for your `.env` files.
> It can rapidly detect and automatically fix issues.
By default, `dotenv-linter` checks all `.env` files in the current directory:
```sh
```bash
dotenv-linter
```
This is the same as the default behavior:
```sh
```bash
dotenv-linter .env .env.*
```
To lint .env files recursively, use `-r`:
```sh
```bash
dotenv-linter -r
```
For the complete usage, see the official
[Dotenv Linter Usage Guide](https://dotenv-linter.github.io/#/usage).
For the complete usage, see the official [Dotenv Linter Usage Guide](https://dotenv-linter.github.io/#/usage).
### How to automatically fix errors
Use the `--fix` flag.
```sh
```bash
dotenv-linter --fix
```
Backup files in the format of `.env_0000000000` will be created by default. You
can use `--no-backup` to skip this.
Backup files in the format of `.env_0000000000` will be created by default.
You can use `--no-backup` to skip this.
### How to toggle linter rules
You can turn off certain linter checks with `--skip` options, for example:
```sh
```bash
dotenv-linter --skip QuoteCharacter --skip UnorderedKey
```

View File

@@ -15,12 +15,12 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\dotenv-linter-v$Env:WEBI_VERSION\bin
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\dotenv-linter-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
# TODO: arch detection
echo "Downloading dotenv-linter from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
set -e
set -u
#!/bin/bash
__init_dotenv_linter() {
{
set -e
set -u
#########################
# Install dotenv-linter #
@@ -21,7 +21,7 @@ __init_dotenv_linter() {
# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/dotenv-linter-v0.99.9/bin
mkdir -p "$(dirname "$pkg_src_cmd")"
mkdir -p "$(dirname $pkg_src_cmd)"
# mv ./dotenv-linter-*/dotenv-linter ~/.local/opt/dotenv-linter-v0.99.9/bin/dotenv-linter
mv ./dotenv-linter "$pkg_src_cmd"
@@ -33,9 +33,7 @@ __init_dotenv_linter() {
# dotenv-linter 0.99.9 (rev abcdef0123)
# This trims it down to just the version number:
# 0.99.9
dotenv-linter --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2
echo $(dotenv-linter --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2)
}
}
__init_dotenv_linter

View File

@@ -13,7 +13,7 @@ To update or switch versions, run `webi dotenv@stable`.
> variables) from a .env file. It works cross platform, and with any programming
> environment (Node.js, Go, Rust, Ruby, Python, etc)
```sh
```bash
# Usage: dotenv [-f .env.alt] -- <command> [arguments]
# Example:

View File

@@ -15,12 +15,12 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\dotenv-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\dotenv-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
# TODO: arch detection
echo "Downloading dotenv from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#!/bin/bash
__init_dotenv() {
function __init_dotenv() {
set -e
set -u
@@ -34,7 +34,7 @@ __init_dotenv() {
# dotenv v1.0.0 (17c7677) 2020-10-19T23:43:57Z
# This trims it down to just the version number:
# 1.0.0
dotenv --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::'
echo "$(dotenv --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')"
}
}

View File

@@ -5,7 +5,13 @@ tagline: |
fd is a git-aware, simple, fast and user-friendly alternative to find.
---
To update or switch versions, run `webi fd@stable` (or `@v8.2`, `@beta`, etc).
## Updating
```bash
webi fd@stable
```
Use the `@beta` tag for pre-releases.
## Cheat Sheet
@@ -16,7 +22,7 @@ To update or switch versions, run `webi fd@stable` (or `@v8.2`, `@beta`, etc).
### Colorized Recursive List
```sh
```bash
fd
```
@@ -24,7 +30,7 @@ fd
Anytime you use only lowercase letters, it's case-insensitive by default.
```sh
```bash
fd foo
```
@@ -32,7 +38,7 @@ fd foo
All `.` files and folders, and anything in `.gitignore` are ignored by default.
```sh
```bash
fd -s -I -H foo
```
@@ -40,7 +46,7 @@ fd -s -I -H foo
Use `-e` as many times as there are extensions that you want to match.
```sh
```bash
fd -e md -e mkdn -e js -e mjs
```
@@ -48,6 +54,6 @@ fd -e md -e mkdn -e js -e mjs
For options see:
```sh
```bash
hexyl --help
```

View File

@@ -3,11 +3,12 @@
$VERNAME = "$Env:PKG_NAME-v$Env:WEBI_VERSION.exe"
$EXENAME = "$Env:PKG_NAME.exe"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# TODO: arch detection
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
}
IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
@@ -23,8 +24,8 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
# Unpack archive
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
echo "Unpacking $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Move single binary into root of temporary folder
& move "$EXENAME" "$VERNAME"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
set -e
set -u
#!/bin/bash
__init_fd() {
{
set -e
set -u
###############
# Install fd #
@@ -15,7 +15,7 @@ __init_fd() {
# fd 8.1.1
# This trims it down to just the version number:
# 8.1.1
fd --version 2> /dev/null | head -n 1 | cut -d' ' -f 2
echo $(fd --version 2> /dev/null | head -n 1 | cut -d' ' -f 2)
}
pkg_install() {
@@ -29,5 +29,3 @@ __init_fd() {
chmod a+x "$pkg_src_cmd"
}
}
__init_fd

View File

@@ -5,8 +5,14 @@ tagline: |
FFmpeg: A complete, cross-platform solution to record, convert and stream audio and video.
---
To update or switch versions, run `webi ffmpeg@stable` (or `@v4.4`, `@beta`,
etc).
## Updating `ffmpeg`
```bash
webi ffmpeg@stable
```
Disclaimer: ffmpeg does not provide official binaries, so
<https://github.com/eugeneware/ffmpeg-static> is used.
## Cheat Sheet
@@ -16,6 +22,6 @@ etc).
Many simple conversions can be auto-detected by file extension and the options
that produce the most similar quality by default.
```sh
```bash
ffmpeg -i input.m4a output.mp3
```

View File

@@ -15,12 +15,12 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\ffmpeg-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\ffmpeg-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
# TODO: arch detection
echo "Downloading ffmpeg from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
Move-Item -Path "$pkg_download.part" -Destination "$pkg_download" -Force

View File

@@ -1,8 +1,8 @@
#!/bin/sh
set -e
set -u
#!/bin/bash
__init_ffmpeg() {
{
set -e
set -u
##################
# Install ffmpeg #
@@ -21,7 +21,7 @@ __init_ffmpeg() {
# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/ffmpeg-v4.3.1/bin
mkdir -p "$(dirname "$pkg_src_cmd")"
mkdir -p "$(dirname $pkg_src_cmd)"
# mv ./linux-x86 ~/.local/opt/ffmpeg-v4.3.1/bin/ffmpeg
mv ./*-* "$pkg_src_cmd"
@@ -35,9 +35,7 @@ __init_ffmpeg() {
# ...
# This trims it down to just the version number:
# 4.3.1
ffmpeg -version 2> /dev/null | head -n 1 | cut -d ' ' -f 3
echo $(ffmpeg -version 2> /dev/null | head -n 1 | cut -d ' ' -f 3)
}
}
__init_ffmpeg

View File

@@ -5,7 +5,11 @@ tagline: |
fish is a smart and user-friendly command line shell for Linux, macOS, and the rest of the family.
---
To update or switch versions, run `webi fish@stable` (or `@v3.3`, `@beta`, etc).
### Updating `fish`
`webi fish@stable`
Use the `@beta` tag for pre-releases.
## Cheat Sheet
@@ -40,7 +44,7 @@ This also covers how to
A bash script should have a "bash shebang" (`#!/bin/bash`) as the first line of
the file:
```sh
```bash
#!/bin/bash
echo "Who am I? I'm $(whoami)."
@@ -48,7 +52,7 @@ echo "Who am I? I'm $(whoami)."
You can also run bash explicitly:
```sh
```bash
bash ./some-script.sh
```
@@ -57,7 +61,7 @@ bash ./some-script.sh
You may like to have your `fish` theme match your Terminal or iTerm2 theme (such
as _Solarized_, _Dracula_, or _Tomorrow Night_).
```sh
```bash
fish_config colors
```
@@ -78,28 +82,28 @@ use the Terminal-specific methods.
First, `fish` must be installed and in the `PATH`.
```sh
```bash
# if you don't see a file path as output, fish is not in the path
command -v fish
which fish
```
Second, fish must be in the system-approved list of shells in `/etc/shells`:
```sh
#!/bin/sh
```bash
#!/bin/bash
if ! grep $(command -v fish) /etc/shells > /dev/null; then
sudo sh -c "echo '$(command -v fish)' >> /etc/shells";
echo "added '$(command -v fish)' to /etc/shells"
if ! grep $(which fish) /etc/shells > /dev/null; then
sudo bash -c "echo '$(which fish)' >> /etc/shells";
echo "added '$(which fish)' to /etc/shells"
fi
```
You should use `chsh` to change your shell:
```sh
#!/bin/sh
```bash
#!/bin/bash
sudo chsh -s "$(command -v fish)" "$(whoami)"
sudo chsh -s "$(which fish)" "$(whoami)"
```
If vim uses `fish` instead of `bash`, annoying errors will happen.
@@ -115,8 +119,8 @@ You can also set is as the default for a particular Terminal, or for your user.
Find out where `fish` is:
```sh
command -v fish
```bash
which fish
```
Then update the Terminal preferences:
@@ -130,8 +134,8 @@ Terminal > Preferences > General > Shells open with:
Or, you can quit Terminal and change the preferences from the command line:
```sh
#!/bin/sh
```bash
#!/bin/bash
defaults write com.apple.Terminal "Shell" -string "$HOME/.local/bin/fish"
```
@@ -140,8 +144,8 @@ defaults write com.apple.Terminal "Shell" -string "$HOME/.local/bin/fish"
Find out where `fish` is:
```sh
command -v fish
```bash
which fish
```
Then update iTerm2 preferences:
@@ -155,8 +159,8 @@ Custom Shell: /Users/YOUR_USER/.local/bin/fish
Or, you can quit iTerm2 and change the preferences from the command line:
```sh
#!/bin/sh
```bash
#!/bin/bash
/usr/libexec/PlistBuddy -c "SET ':New Bookmarks:0:Custom Command' 'Custom Shell'" \
~/Library/Preferences/com.googlecode.iterm2.plist
@@ -193,8 +197,8 @@ shell:
If you don't yet have an alacritty config, this will do:
```sh
#!/bin/sh
```bash
#!/bin/bash
mkdir -p ~/.config/alacritty
@@ -213,13 +217,13 @@ The default `alacritty.yml` is included as an _asset_ with each
Fish will be installed to the standard user location:
```sh
```bash
~/.local/opt/fish/
```
It's config will also go in the standard user location:
```sh
```bash
~/.config/fish/config.fish
```

View File

@@ -1,4 +1,3 @@
#!/bin/sh
set -e
set -u
@@ -13,22 +12,18 @@ fi
################
# Every package should define these 6 variables
# shellcheck disable=2034
pkg_cmd_name="fish"
pkg_dst_cmd="$HOME/.local/bin/fish"
# shellcheck disable=2034
pkg_dst="$pkg_dst_cmd"
pkg_src_cmd="$HOME/.local/opt/fish-v$WEBI_VERSION/bin/fish"
# shellcheck disable=2034
pkg_src_dir="$HOME/.local/opt/fish-v$WEBI_VERSION"
# shellcheck disable=2034
pkg_src="$pkg_src_cmd"
# pkg_install must be defined by every package
_macos_post_install() {
function _macos_post_install() {
if ! [ -e "$HOME/.local/bin/fish" ]; then
return 0
fi
@@ -50,10 +45,10 @@ _macos_post_install() {
if [ -e "$HOME/Library/Preferences/com.googlecode.iterm2.plist" ]; then
/usr/libexec/PlistBuddy \
-c "SET ':New Bookmarks:0:Custom Command' 'Custom Shell'" \
"$HOME/Library/Preferences/com.googlecode.iterm2.plist"
$HOME/Library/Preferences/com.googlecode.iterm2.plist
/usr/libexec/PlistBuddy \
-c "SET ':New Bookmarks:0:Command' $HOME/.local/bin/fish" \
"$HOME/Library/Preferences/com.googlecode.iterm2.plist"
$HOME/Library/Preferences/com.googlecode.iterm2.plist
echo "To set 'fish' as the default iTerm2 shell:"
echo " iTerm2 > Preferences > Profiles > General > Command >"
echo " Custom Shell: $HOME/.local/bin/fish"
@@ -66,12 +61,12 @@ _macos_post_install() {
# always try to reset the default shells
_macos_post_install
pkg_install() {
function pkg_install() {
mv fish.app/Contents/Resources/base/usr/local "$HOME/.local/opt/fish-v${WEBI_VERSION}"
}
pkg_post_install() {
function pkg_post_install() {
# don't skip what webi would do automatically
webi_post_install
@@ -80,10 +75,10 @@ pkg_post_install() {
}
# pkg_get_current_version is recommended, but (soon) not required
pkg_get_current_version() {
function pkg_get_current_version() {
# 'fish --version' has output in this format:
# fish, version 3.1.2
# This trims it down to just the version number:
# 3.1.2
fish --version 2> /dev/null | head -n 1 | cut -d ' ' -f 3
echo $(fish --version 2> /dev/null | head -n 1 | cut -d ' ' -f 3)
}

View File

@@ -5,8 +5,14 @@ tagline: |
Flutter is a UI Toolkit for mobile, web, and desktop.
---
To update or switch versions, run `webi flutter@stable` (or `@v2.2`, `@beta`,
etc).
## Updating `flutter`
```bash
webi flutter@stable
```
Use `@lts` for long-term support and the `@beta` and `@alpha` tags for
pre-releases and dev releases, or `@x.y.z` for a specific version.
## Cheat Sheet
@@ -15,6 +21,6 @@ etc).
### How to create a new app
```sh
```bash
flutter create my_app
```

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
set -u
@@ -29,7 +29,7 @@ pkg_get_current_version() {
# Tools • Dart 2.9.0 (build 2.9.0-14.1.beta)
# This trims it down to just the version number:
# 1.19.0-4.1.pre
flutter --version 2> /dev/null | head -n 1 | cut -d' ' -f2
echo "$(flutter --version 2> /dev/null | head -n 1 | cut -d' ' -f2)"
}
pkg_format_cmd_version() {

View File

@@ -5,7 +5,13 @@ tagline: |
fzf is a general-purpose command-line fuzzy finder.
---
To update or switch versions, run `webi fzf@stable` (or `@v0.23`, `@beta`, etc).
### Updating
```bash
webi fzf@stable
```
Use the `@beta` tag for pre-releases.
## Cheat Sheet
@@ -17,13 +23,13 @@ To update or switch versions, run `webi fzf@stable` (or `@v0.23`, `@beta`, etc).
### Live filter search results
```sh
```bash
find . | fzf
```
### Live filter logs
```sh
```bash
sudo journalctl -u my-app-name --since '2020-01-01' | fzf
```

View File

@@ -3,11 +3,12 @@
$VERNAME = "$Env:PKG_NAME-v$Env:WEBI_VERSION.exe"
$EXENAME = "$Env:PKG_NAME.exe"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# TODO: arch detection
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part"
& move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
}
IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
@@ -23,8 +24,8 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
# Unpack archive
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
echo "Unpacking $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
& tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Move single binary into root of temporary folder
& move "$EXENAME" "$VERNAME"

View File

@@ -1,8 +1,8 @@
#!/bin/sh
set -e
set -u
#!/bin/bash
__init_fzf() {
{
set -e
set -u
###############
# Install fzf #
@@ -15,7 +15,7 @@ __init_fzf() {
# 0.21.1 (334a4fa)
# This trims it down to just the version number:
# 0.21.1
fzf --version 2> /dev/null | head -n 1 | cut -d' ' -f 1
echo $(fzf --version 2> /dev/null | head -n 1 | cut -d' ' -f 1)
}
pkg_install() {
@@ -29,5 +29,3 @@ __init_fzf() {
chmod a+x "$pkg_src_cmd"
}
}
__init_fzf

View File

@@ -2,7 +2,7 @@
var github = require('../_common/github.js');
var owner = 'junegunn';
var repo = 'fzf';
var repo = 'fzf-bin';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {

View File

@@ -1,109 +0,0 @@
---
title: GitHub CLI
homepage: https://github.com/cli/cli
tagline: |
`gh` is GitHub on the command line.
---
To update or switch versions, run `webi gh@stable` (or `@v1`, `@beta`, etc).
## Cheat Sheet
> `gh` is cross-platform Github command-line. You can perform pull requests
> create-repo, isssues, fork and other GitHub functionalities right from your
> terminal while Working with Git and your code.
Installation:
- For macOS and Windows
[macOS/Windows](https://github.com/cli/cli/blob/trunk/README.md)
- For linux Installation on specific distribution
[linux](https://github.com/cli/cli/blob/trunk/docs/install_linux.md)
### Authentication
Authenticate with your Github account.
```sh
gh auth login
```
### Pull Request
Create a pull request.
```sh
gh pr create -t <title> -b <body>
```
Check out pull requests locally.
```sh
gh pr checkout <pr#>
```
Check the status of your pull requests.
```sh
gh pr status
```
View Your pull requests' checks.
```sh
gh pr check
```
### Issues
View and filter a repository's open issues.
```sh
gh issue list
```
### Release
Create a new release.
```sh
gh release create 0.1
```
### Actions
How to see the status of recent jobs
```sh
gh run list
```
_Note_: The **Job ID** is the third from the right column.
How to view failure details
```sh
gh run view <job-id>
```
How to rerun a failed job
```sh
gh run rerun <job-id>
```
### Repo
View repository READMEs.
```sh
gh repo view
```
### Create Shortcut
Create Shortcut for a `gh` command.
```sh
gh alias set bugs 'issue list --label="bugs"'
```

View File

@@ -1,61 +0,0 @@
#!/usr/bin/env pwsh
##############
# Install gh #
##############
# Every package should define these variables
$pkg_cmd_name = "gh"
$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\gh.exe"
$pkg_dst = "$pkg_dst_cmd"
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\gh-v$Env:WEBI_VERSION\bin\gh.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\gh-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\gh-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
{
echo "Downloading gh from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}
IF (!(Test-Path -Path "$pkg_src_cmd"))
{
echo "Installing gh"
# TODO: create package-specific temp directory
# Enter tmp
pushd .local\tmp
# Remove any leftover tmp cruft
Remove-Item -Path ".\gh-v*" -Recurse -ErrorAction Ignore
Remove-Item -Path ".\gh.exe" -Recurse -ErrorAction Ignore
# NOTE: DELETE THIS COMMENT IF NOT USED
# Move single binary into root of temporary folder
#& move "$pkg_download" "gh.exe"
# Unpack archive file into this temporary directory
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $pkg_download"
& tar xf "$pkg_download"
# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"
New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
Move-Item -Path ".\bin\gh.exe" -Destination "$pkg_src_bin"
# Exit tmp
popd
}
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse

View File

@@ -1,41 +0,0 @@
#!/bin/sh
__init_gh() {
set -e
set -u
##############
# Install gh #
##############
# Every package should define these 6 variables
pkg_cmd_name="gh"
pkg_dst_cmd="$HOME/.local/bin/gh"
pkg_dst="$pkg_dst_cmd"
pkg_src_cmd="$HOME/.local/opt/gh-v$WEBI_VERSION/bin/gh"
pkg_src_dir="$HOME/.local/opt/gh-v$WEBI_VERSION"
pkg_src="$pkg_src_cmd"
# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/gh-v0.99.9/bin
mkdir -p "$(dirname "$pkg_src_cmd")"
# mv ./gh-*/gh ~/.local/opt/gh-v0.99.9/bin/gh
mv ./"$pkg_cmd_name"*/bin/gh "$pkg_src_cmd"
}
# pkg_get_current_version is recommended, but (soon) not required
pkg_get_current_version() {
# 'gh --version' has output in this format:
# gh 0.99.9 (rev abcdef0123)
# This trims it down to just the version number:
# 0.99.9
gh --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2
}
}
__init_gh

View File

@@ -1,20 +0,0 @@
'use strict';
var github = require('../_common/github.js');
var owner = 'cli';
var repo = 'cli';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
return all;
});
};
if (module === require.main) {
module.exports(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
// just select the first 5 for demonstration
all.releases = all.releases.slice(0, 5);
console.info(JSON.stringify(all, null, 2));
});
}

View File

@@ -1,192 +0,0 @@
---
title: git-config-gpg
homepage: https://webinstall.dev/git-config-gpg
tagline: |
Get your GnuPG Public Key.
---
## Cheat Sheet
> Although the latest git release allows you to sign with SSH Keys (and GitHub
> will implement this shortly if it hasn't already), most systems do not have
> the latest git release, and most verification systems are not updated with the
> newest verification techniques, so you may wish to sign your commits with GPG,
> as has been done for the last 20 years...
Here we'll cover
- How to [add a GPG key to Github](https://github.com/settings/gpg/new)
- How to cache the passphrase longer
- How to [create a GPG key](./gpg-pubkey)
- How to configure git with GPG signing
- Troubleshooting 'gpg failed to sign the data'
Usage:
```sh
git-config-gpg
```
Example output:
```txt
GnuPG Public Key ID: CA025BC42F00BBBE
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBGGQtKIBDAChxTT375fetQawLkyyDcz07uIEZVa9pvuip8goMqev7PkOIHi+
j6PDtFmxgv8ZOFe8+1RfMC7eL5fYah0/OBxNm7pPvAPDWOX38FfUzoq9CALW2xPD
...
Yee+eokiC2mWIEkMwbqlnNmkX/wphS0zcCsEiHirmDxgY6YY9QRjlzUMY68OqjfJ
IFjFWv3R7eckM957wyR5BvdQNfGrW7cWefWhdZOzLEE7
=GXEK
-----END PGP PUBLIC KEY BLOCK-----
Successfully updated ~/.gitconfig for gpg commit signing
How to verify signed commits on GitHub:
1. Go to 'Add GPG Key': https://github.com/settings/gpg/new
2. Copy and paste the key above from the first ---- to the last ----
```
### Files
These are the files / directories that are created and/or modified with this
install:
```txt
~/.config/envman/PATH.env
~/.local/bin/git-config-gpg
~/Downloads/YOU.KEY_ID.gpg.asc
```
### How to add your GPG Public Key to GitHub
1. Go to your GitHub Profile (<https://github.com/settings/profile>)
2. Go to the SSH and GPG Keys (<https://github.com/settings/keys>)
3. Add GPG Key (<https://github.com/settings/gpg/new>)
4. Paste the output of `gpg-pubkey` into the form
### How to cache the Passphrase longer
If you'd like the passphrase to be cached until your login session ends, just
set it to 400 days and call it good.
`~/.gnupg/gpg-agent.conf`:
```txt
default-cache-ttl 34560000
max-cache-ttl 34560000
```
You'll need to reload `gpg-agent` for this to take effect, or just logout and
login again.
```sh
# kill gpg-agent dead
killall gpg-agent
gpgconf killall gpg-agent
# start gpg-agent again (yes, 'bye' to start)
gpg-connect-agent --agent-program ~/.local/opt/gnupg/bin/gpg-agent /bye
```
Note: You may need to change or omit `--agent-program`, depending on how you
installed `gpg` (if you installed it with Webi, run it as shown above).
### How to create a GPG Key
See:
- [gpg-pubkey](./gpg-pubkey)
- and [gpg](./gpg), if you want to do it "the hard way"
### How to manually set up git commit gpg signing
(this is what `git-config-gpg` does)
Run [gpg-pubkey-id](./gpg-pubkey) to get your GnuPG Public Key ID and then
update your `~/.gitconfig` to sign with it by default:
```sh
#!/bin/sh
MY_KEY_ID="$(
gpg-pubkey-id
)"
git config --global user.signingkey "${MY_KEY_ID}"
git config --global commit.gpgsign true
git config --global log.showSignature true
```
Or, for Windows users:
```sh
#!/usr/bin/env pwsh
$my_key_id = gpg-pubkey-id
git config --global user.signingkey "$my_key_id"
git config --global commit.gpgsign true
git config --global log.showSignature true
```
Or, if you prefer to edit the text file directly:
`~/.gitconfig`
```txt
[user]
signingkey = CA025BC42F00BBBE
[commit]
gpgsign = true
[log]
showSignature = true
```
In some cases you may also want to prevent conflicts between different installed
versions of gpg, like so:
```sh
git config --global gpg.program ~/.local/opt/gnupg/bin/gpg
```
```txt
[gpg]
program = /Users/me/.local/opt/gnupg/bin/gpg
```
### Troubleshooting 'gpg failed to sign the data'
`gpg` is generally expected to be used with a Desktop client. On Linux servers
you may get this error:
```txt
error: gpg failed to sign the data
fatal: failed to write commit object
```
Try to load the `gpg-agent`, set `GPG_TTY`, and then run a clearsign test.
```sh
gpg-connect-agent /bye
export GPG_TTY=$(tty)
echo "test" | gpg --clearsign
```
If that works, update your `~/.bashrc`, `~/.zshrc`, and/or
`~/.config/fish/config.fish` to include the following:
```sh
gpg-connect-agent /bye
export GPG_TTY=$(tty)
```
If this is failing on Mac or Windows, then `gpg-agent` is not starting as
expected on login (for Mac the above may work), and/or the `pinentry` command is
not in the PATH.
If you just installed `gpg`, try closing and reopening your Terminal, or
possibly rebooting.

View File

@@ -1,40 +0,0 @@
#!/bin/sh
set -e
set -u
__git_gpg_init() {
export PATH="$HOME/.local/opt/gnupg/bin:$PATH"
export PATH="$HOME/.local/opt/gnupg/bin/pinentry-mac.app/Contents/MacOS:$PATH"
# TODO check for public key without gpg-pubkey?
if ! command -v gpg-pubkey; then
"$HOME/.local/bin/webi" gpg-pubkey
else
gpg-pubkey
fi
MY_KEY_ID="$(
gpg-pubkey-id
)"
printf "Enabling automatic git commit signing...
git config --global user.signingkey %s
git config --global commit.gpgsign true
git config --global log.showSignature true
" "${MY_KEY_ID}"
git config --global user.signingkey "${MY_KEY_ID}"
git config --global commit.gpgsign true
git config --global log.showSignature true
echo ""
echo "Successfully updated ~/.gitconfig"
echo ""
echo "How to verify signed commits on GitHub:"
echo ""
echo " 1. Go to 'Add GPG Key': https://github.com/settings/gpg/new"
echo " 2. Copy and paste the key above from the first ---- to the last ----"
echo ""
}
__git_gpg_init

View File

@@ -1,34 +0,0 @@
#!/bin/sh
set -e
set -u
__install_git_gpg_init() {
MY_CMD="git-config-gpg"
rm -f "$HOME/.local/bin/$MY_CMD"
webi_download "$WEBI_HOST/packages/$MY_CMD/$MY_CMD.sh" "$HOME/.local/bin/$MY_CMD"
chmod a+x "$HOME/.local/bin/$MY_CMD"
}
__check_gpg_pubkey_exists() {
if ! command -v gpg; then
"$HOME/.local/bin/webi" gpg-pubkey
export PATH="$HOME/.local/opt/gnupg/bin:$PATH"
export PATH="$HOME/.local/opt/gnupg/bin/pinentry-mac.app/Contents/MacOS:$PATH"
fi
}
__check_gpg_exists() {
if ! command -v gpg; then
"$HOME/.local/bin/webi" gpg
export PATH="$HOME/.local/opt/gnupg/bin:$PATH"
export PATH="$HOME/.local/opt/gnupg/bin/pinentry-mac.app/Contents/MacOS:$PATH"
fi
}
__install_git_gpg_init
__check_gpg_pubkey_exists
__check_gpg_exists
# run the command
"$HOME/.local/bin/$MY_CMD"

View File

@@ -1,11 +0,0 @@
---
title: git-gpg-init (git-config-gpg alias)
homepage: https://webinstall.dev/git-config-gpg
tagline: |
Alias for https://webinstall.dev/git-config-gpg
alias: git-config-gpg
description: |
See https://webinstall.dev/git-config-gpg
---
Alias for https://webinstall.dev/git-config-gpg

View File

@@ -1,5 +0,0 @@
#!/bin/pwsh
echo "'git-gpg-init@$Env:WEBI_TAG' is an alias for 'git-config-gpg@$Env:WEBI_VERSION'"
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
curl.exe -fsSL "$Env:WEBI_HOST/git-config-gpg@$Env:WEBI_VERSION" | powershell

View File

@@ -1,11 +0,0 @@
#!/bin/sh
set -e
set -u
__redirect_alias_git_config_gpg() {
echo "'git-gpg-init' is a deprecated alias for 'git-config-gpg'"
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL "$WEBI_HOST/git-config-gpg" | sh
}
__redirect_alias_git_config_gpg

View File

@@ -5,7 +5,11 @@ tagline: |
git: --fast-version-control
---
To update or switch versions, run `webi git@stable` (or `@v2.30`, `@beta`, etc).
## Updating `git`
```bash
webi git@stable
```
## Cheat Sheet
@@ -18,7 +22,7 @@ is a good place to get started if you're new to git.
### How to commit files
```sh
```bash
git add ./path/to/file1
git add ./path/to/file2
git commit -m "my summary for this commit"
@@ -40,13 +44,13 @@ ignore
This will branch from the branch you're currently on.
```sh
```bash
git checkout -b my-branch-name
```
### How to rebase by default
```sh
```bash
git config --global pull.rebase true
```
@@ -57,13 +61,13 @@ git config --global pull.rebase true
Rebase when fetching new updates
```sh
```bash
git pull --rebase origin master
```
Rebase a feature branch from master before a merge
```sh
```bash
# update master
git fetch
git checkout master
@@ -88,7 +92,7 @@ Abbreviated from
First, update `.gitconfig` to handle each type of git URL (git, ssh, and http)
as https:
```sh
```bash
git config --global url."https://api@github.com/".insteadOf "https://github.com/"
git config --global url."https://ssh@github.com/".insteadOf "ssh://git@github.com/"
git config --global url."https://git@github.com/".insteadOf "git@github.com:"
@@ -96,14 +100,14 @@ git config --global url."https://git@github.com/".insteadOf "git@github.com:"
Next, create a `.git-askpass`:
```sh
```bash
echo 'echo $MY_GIT_TOKEN' > $HOME/.git-askpass
chmod +x $HOME/.git-askpass
```
Finally, add the following ENVs to your deployment environment:
```sh
```bash
GIT_ASKPASS=$HOME/.git-askpass
# Relpace xxxx... with your deploy token

View File

@@ -1,8 +1,7 @@
#!/usr/bin/env pwsh
$pkg_cmd_name = "git"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
$pkg_src = "$Env:USERPROFILE\.local\opt\$pkg_cmd_name-v$Env:WEBI_VERSION"
@@ -13,6 +12,7 @@ $pkg_dst_bin = "$pkg_dst\cmd"
# Fetch archive
IF (!(Test-Path -Path "$pkg_download"))
{
# TODO: arch detection
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"

View File

@@ -1,11 +1,11 @@
#!/bin/sh
#!/bin/bash
set -e
set -u
__init_git() {
function __init_git() {
if [ -z "$(command -v git)" ]; then
if uname -a | grep -q -i darwin; then
if [[ -n "$(uname -a | grep -i darwin)" ]]; then
echo >&2 "Error: 'git' not found. You may have to re-install 'git' on Mac after every major update."
echo >&2 " for example, try: xcode-select --install"
# sudo xcodebuild -license accept

View File

@@ -21,7 +21,7 @@ Works with
To get set up, you'll want to copy the example scripts and dotenv:
```sh
```bash
# The example scripts are a good starting point
rsync -av examples/ scripts/
@@ -29,14 +29,14 @@ rsync -av examples/ scripts/
mv scripts/dotenv .env
```
```sh
```bash
gitdeploy run --listen :4483 --github-secret xxxxx --exec scripts/
```
When gitdeploy receives a webhook it runs `scripts/deploy.sh` with the following
environment variables set:
```sh
```bash
GIT_REPO_ID=github.com/my-org/my-project
GIT_CLONE_URL=https://github.com/my-org/my-project.git
@@ -64,12 +64,12 @@ scripts/github.com/YOUR_ORG/YOUR_PROJECT/deploy.sh
```
1. Create a directory that matches the `GIT_REPO_ID`:
```sh
```bash
mkdir -p scripts/github.com/YOUR_ORG/YOUR_PROJECT
```
2. Create a `deploy.sh` that builds and deploys your project:
```sh
```bash
#!/bin/bash
# Put bash in strict mode or bad things will happen.
@@ -106,7 +106,7 @@ scripts/github.com/YOUR_ORG/YOUR_PROJECT/deploy.sh
### How to set up a webhook
1. Generate a 128-bit random string:
```sh
```bash
xxd -l16 -ps /dev/urandom
```
2. Create a new Web Hook on your git platform:
@@ -118,7 +118,7 @@ scripts/github.com/YOUR_ORG/YOUR_PROJECT/deploy.sh
3. Set the content type to JSON.
4. Add the Webhook URL:
```sh
```bash
# Github
https://YOUR_DOMAIN/api/webhooks/github
@@ -134,7 +134,7 @@ scripts/github.com/YOUR_ORG/YOUR_PROJECT/deploy.sh
Most of the flags, such as `--port` and `--github-secret` can also be set as
ENVs. You can create a `.env` like this, for example:
```sh
```bash
PORT=4483
GITHUB_SECRET=xxxxxxxxxxx

View File

@@ -15,12 +15,12 @@ $pkg_src_bin = "$Env:USERPROFILE\.local\opt\gitdeploy-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\gitdeploy-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
# TODO: arch detection
echo "Downloading gitdeploy from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#!/bin/bash
__init_gitdeploy() {
function __init_gitdeploy() {
set -e
set -u
@@ -34,7 +34,7 @@ __init_gitdeploy() {
# gitdeploy v0.7.1 (be68fec) 2020-10-20T22:27:47Z)
# This trims it down to just the version number:
# 0.7.1
gitdeploy --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::'
echo "$(gitdeploy --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')"
}
}

View File

@@ -5,10 +5,13 @@ tagline: |
Gitea: Git with a cup of tea, painless self-hosted git service.
---
To update or switch versions, run `webi gitea@stable` (or `@v1.14`, `@beta`,
etc).
## Updating `gitea`
**Windows users**: You must [install git](/git) first.
```bash
webi gitea@stable
```
Use the `@beta` tag for pre-releases, or `@x.y.z` for a specific version.
## Cheat Sheet
@@ -19,7 +22,7 @@ etc).
### How to run `gitea`
```sh
```bash
gitea web --config ~/.local/opt/gitea/custom/conf/app.ini
```

View File

@@ -1,55 +0,0 @@
#!/usr/bin/env pwsh
#################
# Install gitea #
#################
# Every package should define these variables
$pkg_cmd_name = "gitea"
$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\gitea.exe"
$pkg_dst = "$pkg_dst_cmd"
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\gitea-v$Env:WEBI_VERSION\bin\gitea.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\gitea-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\gitea-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
{
echo "Downloading gitea from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}
IF (!(Test-Path -Path "$pkg_src_cmd"))
{
echo "Installing gitea"
# TODO: create package-specific temp directory
# Enter tmp
pushd .local\tmp
# Remove any leftover tmp cruft
Remove-Item -Path ".\gitea-*" -Recurse -ErrorAction Ignore
Remove-Item -Path ".\gitea.exe" -Recurse -ErrorAction Ignore
# Move single binary into root of temporary folder
& move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE" "gitea.exe"
# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"
New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
Move-Item -Path "gitea.exe" -Destination "$pkg_src_bin"
# Exit tmp
popd
}
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse

Some files were not shown because too many files have changed in this diff Show More