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
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
35 changes: 35 additions & 0 deletions connectors/create-element-templates-symlinks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# This script creates symlinks for all element templates in the current directory to the Camunda 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 "${YELLOW}NOTE: This script can be run only once. Until you create new element templates, you don't need to run this script again.${NC}"
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
echo -e "${YELLOW}Creating symlink for [$dir]${NC}"
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"
done
done

echo -e "${GREEN}All element templates have been copied to ~/Library/Application\ Support/camunda-modeler/resources/element-templates${NC}"