|
|
|
@ -1,6 +1,6 @@ |
|
|
|
#Olivero Sub-theme commands |
|
|
|
# Olivero Sub-theme commands |
|
|
|
|
|
|
|
|
|
|
|
##Clone the old theme |
|
|
|
## Clone the old theme |
|
|
|
|
|
|
|
|
|
|
|
Clone the theme and remove the .git file |
|
|
|
Clone the theme and remove the .git file |
|
|
|
`rm -rf .git` |
|
|
|
`rm -rf .git` |
|
|
|
@ -11,19 +11,19 @@ Swap old themename with new: |
|
|
|
Replace theme names within the files: |
|
|
|
Replace theme names within the files: |
|
|
|
`perl -pi -w -e 's/livesimagined/livesvoices/g;' **/*.*` |
|
|
|
`perl -pi -w -e 's/livesimagined/livesvoices/g;' **/*.*` |
|
|
|
|
|
|
|
|
|
|
|
##Clone the block placement |
|
|
|
## Clone the block placement |
|
|
|
|
|
|
|
|
|
|
|
do a fresh export of the configs with drush |
|
|
|
do a fresh export of the configs with drush |
|
|
|
`drush config:export` |
|
|
|
`drush config:export` |
|
|
|
|
|
|
|
|
|
|
|
copy all of the `block.block.*.yml` files to a temp dir outside of the sync dir and |
|
|
|
copy all of the `block.block.*.yml` files to a temp dir outside of the sync dir and |
|
|
|
remove the configs for the ones that are not the islandora related |
|
|
|
remove the configs for the ones that are not the islandora related |
|
|
|
|
|
|
|
|
|
|
|
remove the uuid at the top of each of these files: |
|
|
|
remove the uuid at the top of each of these files: |
|
|
|
`sed -i '1d'` * (this removes the first line of each file which is the uuid) |
|
|
|
`sed -i '1d'` _ (this removes the first line of each file which is the uuid) |
|
|
|
macos: `sed -i '' '1d' *.yml` |
|
|
|
macos: `sed -i '' '1d' _.yml` |
|
|
|
|
|
|
|
|
|
|
|
change the theme defined in each: |
|
|
|
change the theme defined in each: |
|
|
|
`perl -pi -w -e 's/olivero/vre2024/g;' **/*.*` |
|
|
|
`perl -pi -w -e 's/olivero/vre2024/g;' **/*.*` |
|
|
|
|
|
|
|
|
|
|
|
confirm block region for placement and swap if required: |
|
|
|
confirm block region for placement and swap if required: |
|
|
|
@ -35,54 +35,65 @@ the block ID's need to be unique in these new configs so prepend the old ID's wi |
|
|
|
copy these files back into the sync folder and run: |
|
|
|
copy these files back into the sync folder and run: |
|
|
|
`drush config:import` |
|
|
|
`drush config:import` |
|
|
|
|
|
|
|
|
|
|
|
*You should now see the blocks in the block layout for the new theme but don't make it default yet. |
|
|
|
\*You should now see the blocks in the block layout for the new theme but don't make it default yet. |
|
|
|
|
|
|
|
|
|
|
|
*Manually configure the Display contexts so the viewers are placed in the new theme |
|
|
|
\*Manually configure the Display contexts so the viewers are placed in the new theme |
|
|
|
|
|
|
|
|
|
|
|
<!--Below is a bask script that will copy a theme dir and rename all files in and out:--> |
|
|
|
<!--Below is a bask script that will copy a theme dir and rename all files in and out:--> |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
# !/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
# Prompt for source directory |
|
|
|
# Prompt for source directory |
|
|
|
|
|
|
|
|
|
|
|
read -p "Enter the source directory path: " SOURCE_DIR |
|
|
|
read -p "Enter the source directory path: " SOURCE_DIR |
|
|
|
|
|
|
|
|
|
|
|
# Check if source directory exists |
|
|
|
# Check if source directory exists |
|
|
|
|
|
|
|
|
|
|
|
if [ ! -d "$SOURCE_DIR" ]; then |
|
|
|
if [ ! -d "$SOURCE_DIR" ]; then |
|
|
|
echo "Error: Source directory '$SOURCE_DIR' does not exist." |
|
|
|
echo "Error: Source directory '$SOURCE_DIR' does not exist." |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Prompt for new directory name |
|
|
|
# Prompt for new directory name |
|
|
|
|
|
|
|
|
|
|
|
read -p "Enter the new directory name: " NEW_DIR |
|
|
|
read -p "Enter the new directory name: " NEW_DIR |
|
|
|
|
|
|
|
|
|
|
|
# Prompt for old theme name to replace |
|
|
|
# Prompt for old theme name to replace |
|
|
|
|
|
|
|
|
|
|
|
read -p "Enter the old theme name to replace: " OLD_THEME |
|
|
|
read -p "Enter the old theme name to replace: " OLD_THEME |
|
|
|
|
|
|
|
|
|
|
|
# Prompt for new theme name |
|
|
|
# Prompt for new theme name |
|
|
|
|
|
|
|
|
|
|
|
read -p "Enter the new theme name: " NEW_THEME |
|
|
|
read -p "Enter the new theme name: " NEW_THEME |
|
|
|
|
|
|
|
|
|
|
|
# Extract the parent directory from SOURCE_DIR to place the new directory there |
|
|
|
# Extract the parent directory from SOURCE_DIR to place the new directory there |
|
|
|
|
|
|
|
|
|
|
|
PARENT_DIR=$(dirname "$SOURCE_DIR") |
|
|
|
PARENT_DIR=$(dirname "$SOURCE_DIR") |
|
|
|
NEW_PATH="$PARENT_DIR/$NEW_DIR" |
|
|
|
NEW_PATH="$PARENT_DIR/$NEW_DIR" |
|
|
|
|
|
|
|
|
|
|
|
# Check if new directory already exists |
|
|
|
# Check if new directory already exists |
|
|
|
|
|
|
|
|
|
|
|
if [ -d "$NEW_PATH" ]; then |
|
|
|
if [ -d "$NEW_PATH" ]; then |
|
|
|
echo "Error: Directory '$NEW_PATH' already exists." |
|
|
|
echo "Error: Directory '$NEW_PATH' already exists." |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Copy the source directory to the new directory |
|
|
|
# Copy the source directory to the new directory |
|
|
|
|
|
|
|
|
|
|
|
echo "Copying '$SOURCE_DIR' to '$NEW_PATH'..." |
|
|
|
echo "Copying '$SOURCE_DIR' to '$NEW_PATH'..." |
|
|
|
cp -r "$SOURCE_DIR" "$NEW_PATH" |
|
|
|
cp -r "$SOURCE_DIR" "$NEW_PATH" |
|
|
|
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then |
|
|
|
if [ $? -ne 0 ]; then |
|
|
|
echo "Error: Failed to copy the directory." |
|
|
|
echo "Error: Failed to copy the directory." |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Change to the new directory |
|
|
|
# Change to the new directory |
|
|
|
|
|
|
|
|
|
|
|
cd "$NEW_PATH" || exit 1 |
|
|
|
cd "$NEW_PATH" || exit 1 |
|
|
|
|
|
|
|
|
|
|
|
# Generate case variations of OLD_THEME and NEW_THEME |
|
|
|
# Generate case variations of OLD_THEME and NEW_THEME |
|
|
|
|
|
|
|
|
|
|
|
OLD_THEME_LOWER=$(echo "$OLD_THEME" | tr '[:upper:]' '[:lower:]') |
|
|
|
OLD_THEME_LOWER=$(echo "$OLD_THEME" | tr '[:upper:]' '[:lower:]') |
|
|
|
OLD_THEME_UPPER=$(echo "$OLD_THEME" | tr '[:lower:]' '[:upper:]') |
|
|
|
OLD_THEME_UPPER=$(echo "$OLD_THEME" | tr '[:lower:]' '[:upper:]') |
|
|
|
OLD_THEME_FIRSTCAP=$(echo "$OLD_THEME" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') |
|
|
|
OLD_THEME_FIRSTCAP=$(echo "$OLD_THEME" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') |
|
|
|
@ -92,6 +103,7 @@ NEW_THEME_UPPER=$(echo "$NEW_THEME" | tr '[:lower:]' '[:upper:]') |
|
|
|
NEW_THEME_FIRSTCAP=$(echo "$NEW_THEME" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') |
|
|
|
NEW_THEME_FIRSTCAP=$(echo "$NEW_THEME" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') |
|
|
|
|
|
|
|
|
|
|
|
# Escape special characters for sed |
|
|
|
# Escape special characters for sed |
|
|
|
|
|
|
|
|
|
|
|
OLD_THEME_LOWER_ESC=$(echo "$OLD_THEME_LOWER" | sed 's/[\/&]/\\&/g') |
|
|
|
OLD_THEME_LOWER_ESC=$(echo "$OLD_THEME_LOWER" | sed 's/[\/&]/\\&/g') |
|
|
|
OLD_THEME_UPPER_ESC=$(echo "$OLD_THEME_UPPER" | sed 's/[\/&]/\\&/g') |
|
|
|
OLD_THEME_UPPER_ESC=$(echo "$OLD_THEME_UPPER" | sed 's/[\/&]/\\&/g') |
|
|
|
OLD_THEME_FIRSTCAP_ESC=$(echo "$OLD_THEME_FIRSTCAP" | sed 's/[\/&]/\\&/g') |
|
|
|
OLD_THEME_FIRSTCAP_ESC=$(echo "$OLD_THEME_FIRSTCAP" | sed 's/[\/&]/\\&/g') |
|
|
|
@ -103,16 +115,17 @@ NEW_THEME_FIRSTCAP_ESC=$(echo "$NEW_THEME_FIRSTCAP" | sed 's/[\/&]/\\&/g') |
|
|
|
echo "Matching: '$OLD_THEME_LOWER' → '$NEW_THEME_LOWER', '$OLD_THEME_UPPER' → '$NEW_THEME_UPPER', '$OLD_THEME_FIRSTCAP' → '$NEW_THEME_FIRSTCAP'" |
|
|
|
echo "Matching: '$OLD_THEME_LOWER' → '$NEW_THEME_LOWER', '$OLD_THEME_UPPER' → '$NEW_THEME_UPPER', '$OLD_THEME_FIRSTCAP' → '$NEW_THEME_FIRSTCAP'" |
|
|
|
|
|
|
|
|
|
|
|
# Rename files by replacing each case variation of OLD_THEME with corresponding NEW_THEME |
|
|
|
# Rename files by replacing each case variation of OLD_THEME with corresponding NEW_THEME |
|
|
|
|
|
|
|
|
|
|
|
echo "Renaming files..." |
|
|
|
echo "Renaming files..." |
|
|
|
find . -type f \( -name "*$OLD_THEME_LOWER*" -o -name "*$OLD_THEME_UPPER*" -o -name "*$OLD_THEME_FIRSTCAP*" \) | while IFS= read -r file; do |
|
|
|
find . -type f \( -name "_$OLD_THEME_LOWER_" -o -name "_$OLD_THEME_UPPER_" -o -name "_$OLD_THEME_FIRSTCAP_" \) | while IFS= read -r file; do |
|
|
|
new_file=$(echo "$file" | sed "s/$OLD_THEME_LOWER_ESC/$NEW_THEME_LOWER_ESC/g; s/$OLD_THEME_UPPER_ESC/$NEW_THEME_UPPER_ESC/g; s/$OLD_THEME_FIRSTCAP_ESC/$NEW_THEME_FIRSTCAP_ESC/g") |
|
|
|
new_file=$(echo "$file" | sed "s/$OLD_THEME_LOWER_ESC/$NEW_THEME_LOWER_ESC/g; s/$OLD_THEME_UPPER_ESC/$NEW_THEME_UPPER_ESC/g; s/$OLD_THEME_FIRSTCAP_ESC/$NEW_THEME_FIRSTCAP_ESC/g") |
|
|
|
if [ "$file" != "$new_file" ]; then |
|
|
|
if [ "$file" != "$new_file" ]; then |
|
|
|
mv -v "$file" "$new_file" |
|
|
|
mv -v "$file" "$new_file" |
|
|
|
fi |
|
|
|
fi |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Replace each case variation of OLD_THEME with corresponding NEW_THEME in file contents |
|
|
|
# Replace each case variation of OLD_THEME with corresponding NEW_THEME in file contents |
|
|
|
|
|
|
|
|
|
|
|
echo "Replacing in file contents..." |
|
|
|
echo "Replacing in file contents..." |
|
|
|
find . -type f -exec sed -i '' -e "s/$OLD_THEME_LOWER_ESC/$NEW_THEME_LOWER_ESC/g" -e "s/$OLD_THEME_UPPER_ESC/$NEW_THEME_UPPER_ESC/g" -e "s/$OLD_THEME_FIRSTCAP_ESC/$NEW_THEME_FIRSTCAP_ESC/g" {} \; |
|
|
|
find . -type f -exec sed -i '' -e "s/$OLD_THEME_LOWER_ESC/$NEW_THEME_LOWER_ESC/g" -e "s/$OLD_THEME_UPPER_ESC/$NEW_THEME_UPPER_ESC/g" -e "s/$OLD_THEME_FIRSTCAP_ESC/$NEW_THEME_FIRSTCAP_ESC/g" {} \; |
|
|
|
|
|
|
|
|
|
|
|
|