8000 Deprecates MacOS installation using the script in favor of Homebrew by Schniz · Pull Request #131 · Schniz/fnm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Deprecates MacOS installation using the script in favor of Homebrew #131

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@

set -e

OS=$(uname -s)

if [ "$OS" == "Darwin" ]; then
FILENAME="fnm-macos"
elif [ "$OS" == "Linux" ]; then
FILENAME="fnm-linux"
else
echo "OS $OS is not supported."
echo "If you think that's a bug - please file an issue to https://github.com/Schniz/fnm/issues"
exit 1
fi

INSTALL_DIR="$HOME/.fnm"

# Parse Flags
Expand All @@ -31,6 +19,11 @@ parse_args() {
SKIP_SHELL="true"
shift # past argument
;;
--force-install)
echo "\`--force-install\`: I hope you know what you're doing." >&2
FORCE_INSTALL="true"
shift
;;
*)
echo "Unrecognized argument $key"
exit 1
Expand All @@ -39,6 +32,29 @@ parse_args() {
done
}

set_filename() {
local OS

OS=$(uname -s)

if [ "$OS" == "Linux" ]; then
FILENAME="fnm-linux"
elif [ "$OS" == "Darwin" ] && [ "$FORCE_INSTALL" == "true" ]; then
FILENAME="fnm-macos"
elif [ "$OS" == "Darwin" ]; then
echo "Hey! Thanks for trying fnm."
echo "MacOS installation works better using Homebrew."
echo "Please consider installing using:"
echo " $ brew install Schniz/tap/fnm"
echo "or run the script again with the \`--force-install\` option."
exit 1
else
echo "OS $OS is not supported."
echo "If you think that's a bug - please file an issue to https://github.com/Schniz/fnm/issues"
exit 1
fi
}

download_fnm() {
URL=https://github.com/Schniz/fnm/releases/latest/download/$FILENAME.zip
DOWNLOAD_DIR=$(mktemp -d)
Expand Down Expand Up @@ -134,6 +150,7 @@ setup_shell() {
}

parse_args "$@"
set_filename
check_dependencies
download_fnm
if [ "$SKIP_SHELL" != "true" ]; then
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For `bash`, `zsh` and `fish` shells, there's an [automatic installation script](
curl -fsSL https://github.com/Schniz/fnm/raw/master/.ci/install.sh | bash
```

### Upgrade
### Upgrade

Upgrading `fnm` is almost the same as installing it. To prevent duplication in your shell config file add `--skip-shell` to install command.

Expand All @@ -50,6 +50,10 @@ Set a custom directory for fnm to be installed. The default is `$HOME/.fnm`.

Skip appending shell specific loader to shell config file, based on the current user shell, defined in `$SHELL`. e.g. for Bash, `$HOME/.bashrc`. `$HOME/.zshrc` for Zsh. For Fish - `$HOME/.config/fish/config.fish`

`--force-install`

MacOS installations using the installation script are deprecated in favor of the Homebrew formula, but this forces the script to install using it anyway.

Example:

```bash
Expand Down
0