Skip to content
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

chore(element-template): Add a script to copy all ETs into the Desktop modeler directory #2831

Merged
merged 5 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
34 changes: 34 additions & 0 deletions connectors/copy-element-templates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# This script copies all element templates from the connectors directory to the Camunda Desktop Modeler's element templates directory.

# Define color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# Get the directory where the script is located
SCRIPT_PATH="$(readlink -f "$0")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"

# Change to the script's directory
cd "$SCRIPT_DIR" || exit

echo -e "${BLUE}Starting to copy element templates to ~/Library/Application\ Support/camunda-modeler/resources/element-templates${NC}"
# Find all .json files in element-templates directories and copy them to /tmp/json
find . -type d -name "element-templates" | while read -r dir; do
find "$dir" -type f -name "*.json" | while read -r file; do
dest_dir=~/Library/Application\ Support/camunda-modeler/resources/element-templates/
dest_file="$dest_dir$(basename "$file")"
# Remove the existing symlink if it exists
if [ -L "$dest_file" ]; then
rm "$dest_file"
fi
# Create the new symlink
ln -s "$SCRIPT_DIR/$file" "$dest_file"
echo -e "${YELLOW}Created symlink for [$file]${NC}"
done
done

echo -e "${GREEN}All element templates have been copied to ~/Library/Application\ Support/camunda-modeler/resources/element-templates${NC}"
17 changes: 17 additions & 0 deletions connectors/install-copy-element-templates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Define the source script and destination
SCRIPT_NAME="copy-element-templates.sh"
DEST_DIR="/usr/local/bin"
LINK_NAME="copy-all-ets"
LINK_PATH="$DEST_DIR/$LINK_NAME"

# Check if a symlink already exists and remove it
if [ -L "$LINK_PATH" ]; then
sudo rm "$LINK_PATH"
fi

# Create a symbolic link
sudo ln -s "$(pwd)/$SCRIPT_NAME" "$LINK_PATH"

echo "Symbolic link has been created at $LINK_PATH"