diff --git a/.goreleaser.yaml b/.goreleaser.yaml index e2f96ad..d304008 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -13,12 +13,24 @@ builds: - "amd64" - "386" archives: - - format: "binary" - name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" + - name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}" checksum: name_template: "checksums.txt" changelog: skip: true +nfpms: + - builds: + - stew + vendor: marwanhawari + homepage: "https://github.com/marwanhawari/stew" + maintainer: "Marwan Hawari " + description: "An independent package manager for compiled binaries" + license: MIT + formats: + - apk + - deb + - rpm + bindir: /usr/bin brews: - tap: owner: marwanhawari diff --git a/README.md b/README.md index cf6bc68..f8149af 100644 --- a/README.md +++ b/README.md @@ -43,35 +43,58 @@ ![demo](https://github.com/marwanhawari/stew/raw/main/assets/demo.gif) # Installation -Stew supports Linux, macOS, and Windows. - -### Install a pre-compiled binary: - -* Install using `curl`: -``` -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/marwanhawari/stew/main/install.sh)" -``` - -* Install using `brew`: -``` -brew install marwanhawari/tap/stew -``` - -* Download a pre-compiled binary from the [releases page](https://github.com/marwanhawari/stew/releases). - -### Install from source: - -* Install the latest released version: -``` -go install github.com/marwanhawari/stew@latest -``` - -* Install the latest unreleased source: -``` -git clone https://github.com/marwanhawari/stew -cd stew -go install . -``` +Stew supports macOS, Linux, and Windows. + +### Install using a package manager +
+ macOS + + ```sh + brew install marwanhawari/tap/stew + ``` +
+ +
+ Debian/Ubuntu + + ```sh + apt update && apt install -y software-properties-common + add-apt-repository ppa:marwanhawari/stew + apt update && apt install -y stew + ``` +
+ +
+ Arch + + ```sh + git clone https://aur.archlinux.org/stew.git + cd stew + makepkg -sric + ``` +
+ +### Download a compiled binary +Compiled binaries can be downloaded from the [releases page](https://github.com/marwanhawari/stew/releases). + +### Install using Go +
+ Install the latest released version + + ```sh + go install github.com/marwanhawari/stew@latest + ``` +
+ +
+ Install the latest unreleased source + + ```sh + git clone https://github.com/marwanhawari/stew + cd stew + go install . + ``` +
# Usage ### Install diff --git a/install.sh b/install.sh deleted file mode 100755 index d5fb943..0000000 --- a/install.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash - -# This install script does 3 things: -# 1. Create the stew directory structure -# 2. Download the stew binary -# 3. Add the stew binary path to PATH in ~/.zshrc or ~/.bashrc - -os="" -arch="" -exe="" -defaultStewPath="" -defaultStewBinPath="" -configPath="" - -# Detect os -case "$(uname -s)" in - Darwin) - os="darwin" - - if [ -z "$XDG_DATA_HOME" ] - then - defaultStewPath="$HOME/.local/share/stew" - else - defaultStewPath="$XDG_DATA_HOME/stew" - fi - - defaultStewBinPath="$HOME/.local/bin" - - if [ -z "$XDG_CONFIG_HOME" ] - then - configPath="$HOME/.config/stew" - else - configPath="$XDG_CONFIG_HOME/stew" - fi - ;; - Linux) - os="linux" - if [ -z "$XDG_DATA_HOME" ] - then - defaultStewPath="$HOME/.local/share/stew" - else - defaultStewPath="$XDG_DATA_HOME/stew" - fi - - defaultStewBinPath="$HOME/.local/bin" - - if [ -z "$XDG_CONFIG_HOME" ] - then - configPath="$HOME/.config/stew" - else - configPath="$XDG_CONFIG_HOME/stew" - fi - ;; - CYGWIN*|MSYS*|MINGW*) - os="windows" - exe=".exe" - defaultStewPath="$HOME/AppData/Local/stew" - defaultStewBinPath="$HOME/AppData/Local/stew/bin" - configPath="$HOME/AppData/Local/stew/Config" - ;; -esac - -# Detect arch -case "$(uname -m)" in - amd64|x86_64) - arch="amd64" - ;; - arm64|aarch64) - arch="arm64" - ;; - *386) - arch="386" - ;; -esac - -if [ "$os" = "" ] || [ "$arch" = "" ] -then - echo "" - echo "|||||||||||||||||||||" - echo "|| Error ||" - echo "|||||||||||||||||||||" - echo "" - echo "Your current OS/arch is not supported by stew" - echo "" - exit 1 -fi - -# 1. Create the stew directory structure -stewPath="" -stewBinPath="" - -read -r -t 60 -p "Set the stewPath. This will contain all stew data other than the binaries. (${defaultStewPath}): " stewPathInput - -if [ -z "$stewPathInput" ] -then - stewPath="${defaultStewPath}" -else - stewPath="${stewPathInput/#~/$HOME}" - stewPath="${stewPath/#\$HOME/$HOME}" - stewPath="${stewPath/#\$PWD/$PWD}" - if [ -x "$(command -v dirname)" ] && [ -x "$(command -v basename)" ] - then - stewPath="$(cd "$(dirname "$stewPath")" || exit; pwd)/$(basename "$stewPath")" - fi -fi - -read -r -t 60 -p "Set the stewBinPath. This is where the binaries will be installed by stew. (${defaultStewBinPath}): " stewBinPathInput - -if [ -z "$stewBinPathInput" ] -then - stewBinPath="${defaultStewBinPath}" -else - stewBinPath="${stewBinPathInput/#~/$HOME}" - stewBinPath="${stewBinPath/#\$HOME/$HOME}" - stewBinPath="${stewBinPath/#\$PWD/$PWD}" - if [ -x "$(command -v dirname)" ] && [ -x "$(command -v basename)" ] - then - stewBinPath="$(cd "$(dirname "$stewBinPath")" || exit; pwd)/$(basename "$stewBinPath")" - fi -fi - -mkdir -p "${stewPath}/pkg" -mkdir -p "${stewBinPath}" -mkdir -p "${configPath}" - -echo "{ - \"stewPath\": \"${stewPath}\", - \"stewBinPath\": \"${stewBinPath}\" -}" > "${configPath}/stew.config.json" - -# 2. Download the stew binary -curl -o "${stewBinPath}/stew${exe}" -fsSL https://github.com/marwanhawari/stew/releases/latest/download/stew-${os}-${arch}${exe} -chmod +x "${stewBinPath}/stew${exe}" - -# 3. Add the stew binary path to PATH in ~/.zshrc or ~/.bashrc -if [ -f "$HOME"/.zshrc ] -then - echo "export PATH=\"${stewBinPath}:\$PATH\"" >> "$HOME"/.zshrc -elif [ -f "$HOME"/.bashrc ] -then - echo "export PATH=\"${stewBinPath}:\$PATH\"" >> "$HOME"/.bashrc -else - echo "Make sure to add ${stewBinPath} to PATH" -fi - -echo "" -echo "|||||||||||||||||||||" -echo "|| Success ||" -echo "|||||||||||||||||||||" -echo "" -echo "Start a new terminal session to start using stew" -echo ""