diff --git a/docs/getting-started.md b/docs/getting-started.md index 46b5650..08ccd19 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -4,34 +4,20 @@ === "Linux" - ``` c - #include - - int main(void) { - printf("Hello world!\n"); - return 0; - } + ``` bash title="Install Gookme" + curl -sSL https://raw.githubusercontent.com/LMaxence/gookme/main/scripts/install.sh | bash ``` === "MacOS" - ``` c++ - #include - - int main(void) { - std::cout << "Hello world!" << std::endl; - return 0; - } + ``` bash title="Install Gookme" + curl -sSL https://raw.githubusercontent.com/LMaxence/gookme/main/scripts/install.sh | bash ``` === "Windows" - ``` c++ - #include - - int main(void) { - std::cout << "Hello world!" << std::endl; - return 0; - } + ``` bash title="Install Gookme" + Invoke-WebRequest -Uri https://raw.githubusercontent.com/LMaxence/gookme/main/scripts/install.ps1 -OutFile install.ps1 + .\install.ps1 ``` ## Configuration diff --git a/packages/meta/version.go b/packages/meta/version.go index ff07eae..021d06e 100644 --- a/packages/meta/version.go +++ b/packages/meta/version.go @@ -1,3 +1,3 @@ package meta -const GOOKME_CLI_VERSION = "0.3.2" +const GOOKME_CLI_VERSION = "0.3.3" diff --git a/scripts/install.ps1 b/scripts/install.ps1 new file mode 100644 index 0000000..ba456f2 --- /dev/null +++ b/scripts/install.ps1 @@ -0,0 +1,34 @@ +# Define variables +$repoOwner = "LMaxence" +$repoName = "gookme" +$binaryName = "gookme" +$version = "latest" + +# Determine the architecture +$arch = if ([System.Environment]::Is64BitOperatingSystem) { "amd64" } else { "arm64" } + +# Construct the download URL +$url = "https://github.com/$repoOwner/$repoName/releases/$version/download/$binaryName-windows-$arch.exe" + +# Define the destination path +$destinationPath = "$env:USERPROFILE\Downloads\$binaryName.exe" + +# Download the binary +Write-Host "Downloading $binaryName from $url..." +Invoke-WebRequest -Uri $url -OutFile $destinationPath + +# Make the binary executable (not necessary on Windows, but we'll move it to a PATH directory) +$installPath = "$env:ProgramFiles\$binaryName" +if (-Not (Test-Path -Path $installPath)) { + New-Item -ItemType Directory -Path $installPath +} +Move-Item -Path $destinationPath -Destination "$installPath\$binaryName.exe" + +# Add the install path to the system PATH if not already present +$path = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine) +if ($path -notlike "*$installPath*") { + [System.Environment]::SetEnvironmentVariable("Path", "$path;$installPath", [System.EnvironmentVariableTarget]::Machine) + Write-Host "Added $installPath to the system PATH." +} + +Write-Host "$binaryName installed successfully." \ No newline at end of file diff --git a/scripts/install.sh b/scripts/install.sh index 02f256b..64fda20 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -7,6 +7,15 @@ BINARY_NAME="gookme" # Determine the OS and architecture OS=$(uname | tr '[:upper:]' '[:lower:]') +# OS is darwin on MacOS and default to linux for all other OSes +if [ "$OS" == "darwin" ]; then + echo "Downloading Gookme for MacOS..." + OS="macos" +else + echo "Downloading Gookme for Linux..." + OS="linux" +fi + ARCH=$(uname -m) # Map architecture names to the expected format @@ -23,25 +32,18 @@ case $ARCH in ;; esac -# Determine the file extension for Windows -EXT="" -if [ "$OS" = "mingw64_nt-10.0" ] || [ "$OS" = "msys_nt-10.0" ]; then - OS="windows" - EXT=".exe" -fi - # Construct the download URL for the latest release -URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest/download/$BINARY_NAME-$OS-$ARCH$EXT" +URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest/download/$BINARY_NAME-$OS-$ARCH" # Download the binary echo "Downloading $BINARY_NAME from $URL..." -curl -L -o "$BINARY_NAME$EXT" "$URL" +curl -L -o "$BINARY_NAME" "$URL" # Make the binary executable -chmod +x "$BINARY_NAME$EXT" +chmod +x "$BINARY_NAME" # Move the binary to a directory in the PATH -mv "$BINARY_NAME$EXT" "/usr/local/bin/$BINARY_NAME$EXT" +mv "$BINARY_NAME" "/usr/local/bin/$BINARY_NAME" gookme --version echo "Successfully installed Gookme." \ No newline at end of file