From d3ad29b205f02017ecdfbbcc6abb875a3b1a0f8c Mon Sep 17 00:00:00 2001 From: warman Date: Fri, 9 May 2025 16:51:46 -0400 Subject: [PATCH 1/3] chore: add install script --- install.ps1 | 51 +++++++++++ install.sh | 189 +++++++++++++++++++++++++++++++++++++++++ tests/install_test.ps1 | 36 ++++++++ tests/install_test.sh | 20 +++++ 4 files changed, 296 insertions(+) create mode 100644 install.ps1 create mode 100644 install.sh create mode 100644 tests/install_test.ps1 create mode 100644 tests/install_test.sh diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..b0ab240 --- /dev/null +++ b/install.ps1 @@ -0,0 +1,51 @@ +#!/usr/bin/env pwsh +# Copyright 2019-2025 the Deno authors. All rights reserved. MIT license. +# Copyright 2025 runreal. All rights reserved. MIT license. +# Adopted from https://github.com/denoland/deno_install + +$ErrorActionPreference = 'Stop' + +if ($v) { + $Version = "v${v}" +} +if ($Args.Length -eq 1) { + $Version = $Args.Get(0) +} + +$RunrealInstall = $env:RUNREAL_INSTALL +$BinDir = if ($RunrealInstall) { + "${RunrealInstall}\bin" +} else { + "${Home}\.runreal\bin" +} + +$RunrealExe = "$BinDir\runreal.exe" +$Target = 'win-x64' + +$Version = if (!$Version) { + curl.exe --ssl-revoke-best-effort -s "https://api.github.com/repos/runreal/cli/releases/latest" | + ConvertFrom-Json | + Select-Object -ExpandProperty tag_name +} else { + $Version +} + +Write-Output "Installing runreal ${Version} for ${Target}" + +$DownloadUrl = "https://github.com/runreal/cli/releases/download/${Version}/runreal-${Target}.exe" + +if (!(Test-Path $BinDir)) { + New-Item $BinDir -ItemType Directory | Out-Null +} + +curl.exe --ssl-revoke-best-effort -Lo $RunrealExe $DownloadUrl + +$User = [System.EnvironmentVariableTarget]::User +$Path = [System.Environment]::GetEnvironmentVariable('Path', $User) +if (!(";${Path};".ToLower() -like "*;${BinDir};*".ToLower())) { + [System.Environment]::SetEnvironmentVariable('Path', "${Path};${BinDir}", $User) + $Env:Path += ";${BinDir}" +} + +Write-Output "runreal was installed successfully to ${RunrealExe}" +Write-Output "Run 'runreal --help' to get started" diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..d017bf9 --- /dev/null +++ b/install.sh @@ -0,0 +1,189 @@ +#!/bin/sh +# Copyright 2019-2025 the Deno authors. All rights reserved. MIT license. +# Copyright 2025 runreal. All rights reserved. MIT license. +# Adopted from https://github.com/denoland/deno_install + +set -e + +if [ "$OS" = "Windows_NT" ]; then + target="win-x64.exe" +else + case $(uname -sm) in + "Darwin arm64") target="macos-arm" ;; + "Linux x86_64") target="linux-x64" ;; + *) target="unknown" ;; + esac +fi + +if [ "$target" = "unknown" ]; then + echo "Note: runreal is not supported on this platform" + exit 0 +fi + +print_help_and_exit() { + echo "Setup script for installing runreal + +Options: + -y, --yes + Skip interactive prompts and accept defaults + --no-modify-path + Don't add runreal to the PATH environment variable + -h, --help + Print help +" + echo "Note: runreal was not installed" + exit 0 +} + +get_latest_version() { + curl --ssl-revoke-best-effort -s https://api.github.com/repos/runreal/cli/releases/latest | awk -F'"' '/"tag_name":/{print substr($4,1)}' +} + +# Initialize variables +should_run_shell_setup=false +no_modify_path=false + +# Simple arg parsing - look for help flag, otherwise +# ignore args starting with '-' and take the first +# positional arg as the deno version to install +for arg in "$@"; do + case "$arg" in + "-h") + print_help_and_exit + ;; + "--help") + print_help_and_exit + ;; + "-y") + should_run_shell_setup=true + ;; + "--yes") + should_run_shell_setup=true + ;; + "--no-modify-path") + no_modify_path=true + ;; + "-"*) ;; + *) + if [ -z "$runreal_version" ]; then + runreal_version="$arg" + fi + ;; + esac +done + +if [ -z "$runreal_version" ]; then + runreal_version=$(get_latest_version) +fi + +echo "Installing runreal-${runreal_version} for ${target}" + +runreal_uri="https://github.com/runreal/cli/releases/download/${runreal_version}/runreal-${target}" +runreal_install="${RUNREAL_INSTALL:-$HOME/.runreal}" +bin_dir="$runreal_install/bin" +exe="$bin_dir/runreal" + +if [ ! -d "$bin_dir" ]; then + mkdir -p "$bin_dir" +fi + +curl --fail --location --progress-bar --output "$exe" "$runreal_uri" +chmod +x "$exe" + +echo "runreal was installed successfully to $exe" + +run_shell_setup() { + local rc_files="" + local current_shell="" + + # Try to detect the current shell more reliably + if [ -n "$SHELL" ]; then + current_shell=$(basename "$SHELL") + elif [ -n "$ZSH_VERSION" ]; then + current_shell="zsh" + elif [ -n "$BASH_VERSION" ]; then + current_shell="bash" + elif [ -n "$KSH_VERSION" ]; then + current_shell="ksh" + elif [ -n "$FISH_VERSION" ]; then + current_shell="fish" + else + current_shell="sh" + fi + + # Determine which rc files to modify based on shell + case "$current_shell" in + zsh) + rc_files="$HOME/.zshrc" + ;; + bash) + rc_files="$HOME/.bashrc" + # Add .bash_profile for login shells on macOS + if [ "$(uname -s)" = "Darwin" ]; then + rc_files="$rc_files $HOME/.bash_profile" + fi + ;; + fish) + # Fish has a different way of setting PATH + mkdir -p "$HOME/.config/fish/conf.d" + echo "set -gx RUNREAL_INSTALL \"$runreal_install\"" > "$HOME/.config/fish/conf.d/runreal.fish" + echo "set -gx PATH \$RUNREAL_INSTALL/bin \$PATH" >> "$HOME/.config/fish/conf.d/runreal.fish" + echo "Added runreal to PATH in fish configuration" + return + ;; + *) + # Default to .profile for other shells + rc_files="$HOME/.profile" + ;; + esac + + # Add setup line to each rc file + for rc_file in $rc_files; do + if [ ! -f "$rc_file" ]; then + touch "$rc_file" + fi + + if ! grep -q "$runreal_install/bin" "$rc_file"; then + echo "" >> "$rc_file" + echo "# runreal setup" >> "$rc_file" + echo "export RUNREAL_INSTALL=\"$runreal_install\"" >> "$rc_file" + echo "export PATH=\"\$RUNREAL_INSTALL/bin:\$PATH\"" >> "$rc_file" + echo "Added runreal to PATH in $rc_file" + else + echo "runreal already in PATH in $rc_file" + fi + done + + echo "Restart your shell or run 'source $rc_file' to use runreal" +} + +# Add runreal to PATH for non-Windows if needed +if [ "$OS" != "Windows_NT" ] && [ "$no_modify_path" = false ]; then + # If not automatic setup, but interactive is possible, ask user + if [ "$should_run_shell_setup" = false ] && [ -t 0 ]; then + echo "" + echo "Do you want to add runreal to your PATH? [y/N]" + read -r answer + if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then + should_run_shell_setup=true + fi + fi + + if [ "$should_run_shell_setup" = true ]; then + run_shell_setup + else + echo "" + echo "To manually add runreal to your path:" + echo " export RUNREAL_INSTALL=\"$runreal_install\"" + echo " export PATH=\"\$RUNREAL_INSTALL/bin:\$PATH\"" + echo "" + echo "To do this automatically in the future, run with -y or --yes" + fi +fi + +if command -v runreal >/dev/null; then + echo "Run 'runreal --help' to get started" +else + echo "Run '$exe --help' to get started" +fi +echo diff --git a/tests/install_test.ps1 b/tests/install_test.ps1 new file mode 100644 index 0000000..dc64220 --- /dev/null +++ b/tests/install_test.ps1 @@ -0,0 +1,36 @@ +#!/usr/bin/env pwsh + +$ErrorActionPreference = 'Stop' + +# Test that we can install the latest version at the default location. +Remove-Item "~\.runreal" -Recurse -Force -ErrorAction SilentlyContinue +$env:RUNREAL_INSTALL = "" +$v = $null; .\install.ps1 +~\.runreal\bin\runreal.exe --version + +# Test that we can install a specific version at a custom location. +Remove-Item "~\runreal-1.5.0" -Recurse -Force -ErrorAction SilentlyContinue +$env:RUNREAL_INSTALL = "$Home\runreal-1.5.0" +$v = "1.5.0"; .\install.ps1 +$RunrealVersion = ~\runreal-1.5.0\bin\runreal.exe --version +if (!($RunrealVersion -like '*1.5.0*')) { + throw $RunrealVersion +} + +# Test that we can install at a relative custom location. +Remove-Item "bin" -Recurse -Force -ErrorAction SilentlyContinue +$env:RUNREAL_INSTALL = "." +$v = "1.5.0"; .\install.ps1 +$RunrealVersion = bin\runreal.exe --version +if (!($RunrealVersion -like '*1.5.0*')) { + throw $RunrealVersion +} + +# Test that the old temp file installer still works. +Remove-Item "~\runreal-1.5.0" -Recurse -Force -ErrorAction SilentlyContinue +$env:RUNREAL_INSTALL = "$Home\runreal-1.5.0" +$v = $null; .\install.ps1 v1.5.0 +$RunrealVersion = ~\runreal-1.5.0\bin\runreal.exe --version +if (!($RunrealVersion -like '*1.5.0*')) { + throw $RunrealVersion +} diff --git a/tests/install_test.sh b/tests/install_test.sh new file mode 100644 index 0000000..514b9f8 --- /dev/null +++ b/tests/install_test.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +# Test that we can install the latest version at the default location. +rm -f ~/.runreal/bin/runreal +unset RUNREAL_INSTALL +sh ./install.sh +~/.runreal/bin/runreal --version + +# Test that we can install a specific version at a custom location. +rm -rf ~/runreal-1.5.0 +export RUNREAL_INSTALL="$HOME/runreal-1.5.0" +./install.sh v1.5.0 +~/runreal-1.5.0/bin/runreal --version | grep 1.5.0 + +# Test that we can install at a relative custom location. +export RUNREAL_INSTALL="." +./install.sh v1.5.0 +bin/runreal --version | grep 1.5.0 From b9ce6677a0a6edf834c9aeb588a707150481bd6a Mon Sep 17 00:00:00 2001 From: warman Date: Fri, 9 May 2025 16:51:54 -0400 Subject: [PATCH 2/3] docs: update README --- .gitignore | 3 ++- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 5888e2b..6e536f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build scratch/ # This file is generated by the runreal CLI during the test -.runreal/dist/script.esm.js +.runreal .DS_Store +docs/ \ No newline at end of file diff --git a/README.md b/README.md index 6e8aead..4bf4923 100644 --- a/README.md +++ b/README.md @@ -10,21 +10,81 @@ Website · Twitter + · + Discord

-- **Unreal Engine**: Configure engines, build projects, and run UAT/UBT commands. -- **Buildgraph**: Generate reports from your buildgraphs. +- **Unreal Engine**: Configure your engine, build projects, and run UAT/UBT commands. +- **Buildgraph**: Easily work with BuildGraph. +- **Project**: Compile, package, and run projects easily. +- **Workflow**: Execute custom workflows for your Unreal Engine projects. +- **Asset Management**: Work with Unreal assets using the uasset commands. + +## Getting Started +```sh +# Compile the editor +runreal project compile Editor + +# Compile your project +runreal project compile YourProject + +# List available build targets +runreal list-targets + +# Run your game +runreal project run + +# Package your project +runreal project pkg -p Win64 -c Development +# Execute a buildgraph script +runreal buildgraph run + +# Run UAT commands +runreal uat run BuildCookRun -project=YourProject.uproject + +# Run UBT commands +runreal ubt run -Mode=QueryTargets +``` ## Installation Download the latest release from the [Releases](https://github.com/runreal/cli/releases/latest) page. +### Install Latest Version + +**With PowerShell:** + +```powershell +irm https://raw.githubusercontent.com/runreal/cli/refs/heads/main/install.ps1 | iex +``` + +**With Shell:** + +```sh +curl -fsSL https://raw.githubusercontent.com/runreal/cli/refs/heads/main/install.sh | sh +``` + +### Install Specific Version + +**With PowerShell:** + +```powershell +$v="1.0.0"; irm https://raw.githubusercontent.com/runreal/cli/refs/heads/main/install.ps1 | iex +``` + +**With Shell:** + +```sh +curl -fsSL https://raw.githubusercontent.com/runreal/cli/refs/heads/main/install.sh | sh -s v1.0.0 +``` ## Building from source +`deno` is required. See [deno getting started](https://docs.deno.com/runtime/getting_started/installation/). + 1. Clone the cli ```bash From af63c5672df4c84a0b1c191975f690d2851c2710 Mon Sep 17 00:00:00 2001 From: warman Date: Fri, 9 May 2025 17:04:20 -0400 Subject: [PATCH 3/3] docs: update README --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4bf4923..4f40409 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ # Compile the editor runreal project compile Editor -# Compile your project -runreal project compile YourProject +# Compile your project targets +runreal project compile Client # List available build targets runreal list-targets @@ -81,6 +81,54 @@ $v="1.0.0"; irm https://raw.githubusercontent.com/runreal/cli/refs/heads/main/in curl -fsSL https://raw.githubusercontent.com/runreal/cli/refs/heads/main/install.sh | sh -s v1.0.0 ``` +## Usage +```sh +runreal --help + +Usage: runreal +Version: 1.6.0 + +Description: + + the Unreal Engine runner + +Options: + + -h, --help - Show this help. + -V, --version - Show the version number for this program. + --session-id - Session Id (Default: "01JTVDP0Z1N2ES4703Y44MQTFQ") + --log-level - Log level (Default: "DEBUG", Values: "DEBUG", "INFO", "ERROR") + -c, --config-path - Path to config file + --engine-path - Path to engine folder + --project-path - Path to project folder + --build-id - Overide build ID + --build-path - Path to save build outputs + --build-ts - Overide build timestamp + +Commands: + + init - init + debug - debug + list-targets - list-targets + engine - engine + uat [args...] - uat + ubt [args...] - ubt + buildgraph - buildgraph + workflow - workflow + script - script + auth [args...] - auth + uasset - uasset + project - project + +Environment variables: + + RUNREAL_ENGINE_PATH - Overide path to engine folder + RUNREAL_PROJECT_PATH - Overide path to project folder + RUNREAL_BUILD_ID - Overide build ID + RUNREAL_BUILD_PATH - Overide path to build output folder + RUNREAL_BUILD_TS - Overide build timestamp +``` + ## Building from source `deno` is required. See [deno getting started](https://docs.deno.com/runtime/getting_started/installation/).