Skip to content
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
10 changes: 10 additions & 0 deletions docs/contribute/locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ This guide uses the first option. If you'd like to clone the repository and buil
```

This downloads the latest binary, makes it executable, and installs it to your user PATH.
You can optionally specify a specific version to install:

```sh
DOCS_BUILDER_VERSION=0.40.0 curl -sL https://ela.st/docs-builder-install | sh
```

To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub.

Expand Down Expand Up @@ -68,6 +73,11 @@ If you get a `Permission denied` error, make sure that you aren't trying to run
```

This downloads the latest binary, makes it executable, and installs it to your user PATH.
You can optionally specify a specific version to install:

```powershell
$env:DOCS_BUILDER_VERSION = '0.40.0'; iwr -useb https://ela.st/docs-builder-install.ps1 | iex
```

To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub.

Expand Down
20 changes: 14 additions & 6 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# PowerShell script to install docs-builder binary

# Use AppData\Local for user-specific installation instead of Program Files
$targetDir = Join-Path -Path $env:LOCALAPPDATA -ChildPath "docs-builder"
$targetDir = Join-Path -Path $env:LOCALAPPDATA -ChildPath "docs-builder"
$targetPath = Join-Path -Path $targetDir -ChildPath "docs-builder.exe"

$version = $env:DOCS_BUILDER_VERSION
if (-not $version) { $version = 'latest' }

# Check if docs-builder already exists
if (Test-Path -Path $targetPath) {
Write-Host "docs-builder is already installed."
Expand All @@ -20,10 +23,15 @@ if (-not (Test-Path -Path $targetDir)) {
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
}

# Download the latest Windows binary from releases
if ($version -eq 'latest') {
$downloadUrl = "https://github.com/elastic/docs-builder/releases/latest/download/docs-builder-win-x64.zip"
} else {
$downloadUrl = "https://github.com/elastic/docs-builder/releases/download/$version/docs-builder-win-x64.zip"
}

$tempZipPath = "$env:TEMP\docs-builder-win-x64.zip"
Write-Host "Downloading docs-builder binary..."
Invoke-WebRequest -Uri "https://github.com/elastic/docs-builder/releases/latest/download/docs-builder-win-x64.zip" -OutFile $tempZipPath
Invoke-WebRequest -Uri $downloadUrl -OutFile $tempZipPath

# Create a temporary directory for extraction
$tempExtractPath = "$env:TEMP\docs-builder-extract"
Expand Down Expand Up @@ -53,8 +61,8 @@ if ($currentPath -notlike "*$targetDir*") {
}

# Clean up temporary files
Remove-Item -Path $tempZipPath -Force
Remove-Item -Path $tempZipPath -Force
Remove-Item -Path $tempExtractPath -Recurse -Force

Write-Host "docs-builder has been installed successfully and is available in your PATH."
Write-Host "You may need to restart your terminal or PowerShell session for the PATH changes to take effect."
Write-Host "docs-builder ($version) has been installed successfully and is available in your PATH."
Write-Host "You may need to restart your terminal or PowerShell session for the PATH changes to take effect."
14 changes: 11 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
ARCH="arm64"
fi

VERSION="${DOCS_BUILDER_VERSION:-latest}"

# Determine binary to download based on OS
if [ "$OS" = "darwin" ]; then
BINARY="docs-builder-mac-$ARCH.zip"
Expand Down Expand Up @@ -55,8 +57,14 @@ fi

echo "Downloading docs-builder for $OS/$ARCH..."

if [ "$VERSION" = "latest" ]; then
DOWNLOAD_URL="https://github.com/elastic/docs-builder/releases/latest/download/$BINARY"
else
DOWNLOAD_URL="https://github.com/elastic/docs-builder/releases/download/$VERSION/$BINARY"
fi

# Download the appropriate binary
if ! curl -LO "https://github.com/elastic/docs-builder/releases/latest/download/$BINARY"; then
if ! curl -LO "$DOWNLOAD_URL"; then
echo "Error: Failed to download $BINARY. Please check your internet connection."
exit 1
fi
Expand Down Expand Up @@ -87,5 +95,5 @@ fi
# Clean up the downloaded zip file
rm -f "$BINARY"

echo "docs-builder has been installed successfully and is available in your PATH."
echo "You can run 'docs-builder --help' to see available commands."
echo "docs-builder ($VERSION) has been installed successfully and is available in your PATH."
echo "You can run 'docs-builder --help' to see available commands."
Loading