-
Notifications
You must be signed in to change notification settings - Fork 5
docs: update install instructions #72
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||
| set -e | ||||||||||||||
|
|
||||||||||||||
| echo "👉 Detecting platform..." | ||||||||||||||
|
|
||||||||||||||
| # Detect OS | ||||||||||||||
| OS="$(uname -s)" | ||||||||||||||
| case "$OS" in | ||||||||||||||
| Linux*) PLATFORM="Linux";; | ||||||||||||||
| Darwin*) PLATFORM="Darwin";; | ||||||||||||||
| MINGW*|MSYS*|CYGWIN*|Windows_NT) PLATFORM="Windows";; | ||||||||||||||
| *) echo "❌ Unsupported OS: $OS"; exit 1;; | ||||||||||||||
| esac | ||||||||||||||
|
|
||||||||||||||
| # Detect architecture | ||||||||||||||
| ARCH="$(uname -m)" | ||||||||||||||
| case "$ARCH" in | ||||||||||||||
| x86_64) ARCH="x86_64";; | ||||||||||||||
| amd64) ARCH="x86_64";; # Just in case | ||||||||||||||
| arm64|aarch64) ARCH="arm64";; | ||||||||||||||
| *) echo "❌ Unsupported architecture: $ARCH"; exit 1;; | ||||||||||||||
| esac | ||||||||||||||
|
|
||||||||||||||
| echo "✅ Platform: $PLATFORM" | ||||||||||||||
| echo "✅ Architecture: $ARCH" | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| # https://github.com/formancehq/numscript/releases/download/v0.0.18/numscript_.0.0.18_Darwin_arm64.tar.gz | ||||||||||||||
| # Get latest release tag | ||||||||||||||
| LATEST_TAG=$(curl -sI https://github.com/formancehq/numscript/releases/latest | grep -i location | awk -F '/' '{print $NF}' | tr -d '\r') | ||||||||||||||
|
|
||||||||||||||
| echo "📦 Latest tag: $LATEST_TAG" | ||||||||||||||
|
|
||||||||||||||
| # Determine file extension | ||||||||||||||
| if [ "$PLATFORM" = "Windows" ]; then | ||||||||||||||
| EXT="zip" | ||||||||||||||
| else | ||||||||||||||
| EXT="tar.gz" | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| # Build file name and URL | ||||||||||||||
| FILENAME="numscript_.${LATEST_TAG#v}_${PLATFORM}_${ARCH}.${EXT}" | ||||||||||||||
| URL="https://github.com/formancehq/numscript/releases/download/$LATEST_TAG/$FILENAME" | ||||||||||||||
|
|
||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| echo "⬇️ Downloading: $URL" | ||||||||||||||
| curl -L -o "$FILENAME" "$URL" | ||||||||||||||
|
|
||||||||||||||
| # Extract and install | ||||||||||||||
| if [ "$PLATFORM" = "Windows" ]; then | ||||||||||||||
| unzip "$FILENAME" | ||||||||||||||
| BIN="numscript.exe" | ||||||||||||||
| else | ||||||||||||||
| tar -xf "$FILENAME" numscript | ||||||||||||||
| BIN="numscript" | ||||||||||||||
| fi | ||||||||||||||
|
Comment on lines
+53
to
+55
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extraction will fail: missing - tar -xf "$FILENAME" numscript
+ tar -xzf "$FILENAME" numscript📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| INSTALL_PATH="$HOME/.local/bin" | ||||||||||||||
| mkdir -p "$INSTALL_PATH" | ||||||||||||||
|
|
||||||||||||||
| mv "$BIN" "$INSTALL_PATH" | ||||||||||||||
| chmod +x "$INSTALL_PATH/$BIN" | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+58
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Installation path & chmod are not Windows-friendly
Consider computing a platform-specific default such as: if [ "$PLATFORM" = "Windows" ]; then
INSTALL_PATH="$USERPROFILE/bin"
mkdir -p "$INSTALL_PATH"
mv "$BIN" "$INSTALL_PATH"
else
INSTALL_PATH="$HOME/.local/bin"
mkdir -p "$INSTALL_PATH"
mv "$BIN" "$INSTALL_PATH"
chmod +x "$INSTALL_PATH/$BIN"
fi🤖 Prompt for AI Agents |
||||||||||||||
| rm "$FILENAME" | ||||||||||||||
|
|
||||||||||||||
| echo "✅ Installed $BIN to $INSTALL_PATH" | ||||||||||||||
| echo "🎉 Done!" | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the dot normal?