Skip to content

Commit 47006e5

Browse files
committed
feat: Create project script now integrates with multiple drupal versions and don't try to change files that doesn't exists.
1 parent d8035ce commit 47006e5

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

commands/host/includes/create_project.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
# Constants
55
DRUSH_ALIASES_FOLDER="./drush/sites"
6+
BEHAT_LOCAL_FOLDER="./tests/behat/local"
7+
DRUPAL_VERSION=d11
8+
PROJECT_TYPE=drupal11
9+
PHP_VERSION="8.3"
610

711
CYAN='\033[0;36m'
812
GREEN='\033[0;32m'
@@ -44,41 +48,40 @@ configure_project() {
4448
read PROJECT_NAME_INPUT
4549
fi
4650

47-
ddev config --php-version 8.3
51+
if [ "$AUTO" == "0" ]; then
52+
echo -e "${CYAN}By default, Drupal 11 will be installed. Do you want to install Drupal 10 instead?${NC} [y/N]"
53+
read INSTALL_DRUPAL_10
54+
if [ "$INSTALL_DRUPAL_10" == "y" ] || [ "$INSTALL_DRUPAL_10" == "Y" ]; then
55+
DRUPAL_VERSION=d10
56+
PROJECT_TYPE=drupal10
57+
echo "** Drupal 10 will be installed **"
58+
else
59+
echo "** Drupal 11 will be installed **"
60+
fi
61+
fi
4862

4963
echo "Configuring ddev environment"
50-
5164
if [ -z "$PROJECT_NAME_INPUT" ]; then
5265
PROJECT_NAME_INPUT=${DDEV_PROJECT}
5366
fi
54-
5567
PROJECT_NAME=$PROJECT_NAME_INPUT
5668

5769
echo "Configuring ddev project $PROJECT_NAME"
58-
ddev config --project-type=drupal --project-name $PROJECT_NAME --docroot 'web' --auto
70+
ddev config --project-type=$PROJECT_TYPE --php-version $PHP_VERSION --project-name $PROJECT_NAME --docroot 'web' --auto
5971

6072
echo "Preparing Aljibe config file"
6173
cp ${DDEV_APPROOT}/.ddev/aljibe.yaml.example ${DDEV_APPROOT}/.ddev/aljibe.yaml
6274
sed -i "s/default_site\: self/default_site\: $PROJECT_NAME/g" ${DDEV_APPROOT}/.ddev/aljibe.yaml
6375

6476
echo "Copying Aljibe Kickstart project files"
65-
ddev aljibe-kickstart --yes
77+
ddev aljibe-kickstart --yes $DRUPAL_VERSION
6678

6779
echo "Setting up Drush aliases file"
6880
cp "$DRUSH_ALIASES_FOLDER/sitename.site.yml.example" "$DRUSH_ALIASES_FOLDER/$PROJECT_NAME.site.yml"
6981
sed -i "s/example/$PROJECT_NAME/g" $DRUSH_ALIASES_FOLDER/$PROJECT_NAME.site.yml
7082

7183
echo "Setting up behat.yml file"
72-
sed -i "s/example/$PROJECT_NAME/g" ./behat.yml
73-
74-
echo "Setting up BackstopJS' cookies.json file"
75-
sed -i "s/example/$PROJECT_NAME/g" ./tests/functional/backstopjs/backstop_data/engine_scripts/cookies.json
76-
77-
echo "Setting up phpunit.xml"
78-
cp "./phpunit.xml.dist" "./phpunit.xml"
79-
80-
echo "Setting up phpmd.xml"
81-
cp "./phpmd.xml.dist" "./phpmd.xml"
84+
sed -i "s/example/$PROJECT_NAME/g" $BEHAT_LOCAL_FOLDER/behat.yml
8285
}
8386

8487
# Setup git repo

0 commit comments

Comments
 (0)