From 5eba34af192c73bc8eed91a60737242dbb9f1de8 Mon Sep 17 00:00:00 2001 From: Assaf Attias Date: Fri, 25 Aug 2023 15:31:59 +0300 Subject: [PATCH 1/2] Add automatic installation option --- README.md | 21 ++++------ src/main/resources/installOIS.sh | 71 ++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/installOIS.sh diff --git a/README.md b/README.md index 08125c5..4f8f715 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,9 @@ Simplify development and distribution and embrace a more streamlined process. The plugin is not available in Maven central yet, required to be installed locally
+Manual installation ---- -Install locally OIS core library - +Install locally OIS core library 1. Clone the [core library](https://github.com/attiasas/open-interactive-simulation-core) ```bash git clone https://github.com/attiasas/open-interactive-simulation-core.git @@ -55,15 +54,8 @@ The plugin is not available in Maven central yet, required to be installed local ```bash ./gradlew publishToMavenLocal ``` - ---- -
- -
- ---- -Install locally the plugin +Install locally the plugin 1. Clone this repository ```bash git clone https://github.com/attiasas/open-interactive-simulation-deployer.git @@ -73,9 +65,14 @@ The plugin is not available in Maven central yet, required to be installed local ./gradlew publishToMavenLocal ``` ----
+Download the installation bash [script](src/main/resources/installOIS.sh) and run it: +```bash +./installOIS.sh +``` + +--- 1. Add at the top of your `settings.gradle` the following snippet ```groovy pluginManagement { diff --git a/src/main/resources/installOIS.sh b/src/main/resources/installOIS.sh new file mode 100644 index 0000000..6e3fd3c --- /dev/null +++ b/src/main/resources/installOIS.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +# Determine the operating system +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + OS="linux" +elif [[ "$OSTYPE" == "darwin"* ]]; then + OS="mac" +elif [[ "$OSTYPE" == "cygwin" ]]; then + OS="windows" +elif [[ "$OSTYPE" == "msys" ]]; then + OS="windows" +elif [[ "$OSTYPE" == "win32" ]]; then + OS="windows" +else + OS="unknown" +fi + +# Set the base directory for cloning +base_dir="$HOME/.ois" +mkdir -p "$base_dir" + +# Define the tags for cloning +CORE_TAG="master" +DEPLOYER_TAG="master" + +# Function to check if directory exists and is not empty +directory_exists_and_not_empty() { + dir_path=$1 + + if [ -d "$dir_path" ] && [ -n "$(ls -A "$dir_path")" ]; then + return 0 # Directory exists and is not empty + else + return 1 # Directory doesn't exist or is empty + fi +} + +# Function to clone and publish a repository to Maven Local +clone_and_publish() { + repo_url=$1 + tag=$2 + repo_name=$(basename $repo_url .git) + clone_dir="$base_dir/$repo_name" + + # Check if the directory exist and not empty + if directory_exists_and_not_empty "$clone_dir"; then + echo "$clone_dir exists and is not empty. Skipping cloning." + else + mkdir -p "$clone_dir" + echo "cloning $repo_url ${tag}." + # Clone the repository with the specified tag or master if not specified + git clone --branch ${tag} $repo_url "$clone_dir" + fi + + cd "$clone_dir" + + # Publish the repository to Maven Local + echo "publishing to mavenLocal $repo_url." + if [[ "$OS" == "windows" ]]; then + ./gradlew.bat publishToMavenLocal + else + ./gradlew publishToMavenLocal + fi + + cd .. +} + +# Clone and publish the core library +clone_and_publish https://github.com/attiasas/open-interactive-simulation-core.git $CORE_TAG + +# Clone and publish the deployer repository +clone_and_publish https://github.com/attiasas/open-interactive-simulation-deployer.git $DEPLOYER_TAG From a6e12dcc81caa66fe9c27a64bd065dbc38ccdd1d Mon Sep 17 00:00:00 2001 From: Assaf Attias Date: Fri, 25 Aug 2023 15:35:09 +0300 Subject: [PATCH 2/2] update readme --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 4f8f715..ffae110 100644 --- a/README.md +++ b/README.md @@ -135,10 +135,7 @@ For instance: "Green" : "org.example.GreenState" }, "publish" : { - "platforms" : [ "Desktop" ], - - "publishedName" : "optional-published-project-name", - "iconsDir" : "optional-path-to-your-icon-directory" + "platforms" : [ "Desktop" ] } } ```