forked from acquia/blt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert-to-composer.sh
executable file
·85 lines (72 loc) · 2.51 KB
/
convert-to-composer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
if [ "`basename "/$SHELL"`" = "zsh" ]; then
DETECTED_PROFILE="$HOME/.zshrc"
elif [ -f "$HOME/.bashrc" ]; then
DETECTED_PROFILE="$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then
DETECTED_PROFILE="$HOME/.bash_profile"
elif [ -f "$HOME/.profile" ]; then
DETECTED_PROFILE="$HOME/.profile"
fi
if [ ! -z "$DETECTED_PROFILE" ]; then
if [ "`grep 'function blt' $DETECTED_PROFILE`" ]; then
echo "Alias for blt exists in $DETECTED_PROFILE"
echo "Please remove it and then re-run this script."
exit 1
fi
fi
echo "This script will update your project to use a composerized version of BLT."
echo "It will do the following:"
echo "* Add a blt alias to $DETECTED_PROFILE"
echo "* Remove and modify files in your codebase."
echo "* Update your composer dependencies."
echo ""
read -p "Continue? (y/n) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
# composer require acquia/blt:~8
# Move values from custom/build.yml to project.yml.
# @todo Check if this exists and if it exactly matches core value.
if [[ ! -z build/custom/phing/build.yml ]]; then
echo "Moving custom Phing properties to project.yml."
echo "" >> project.yml
cat build/custom/phing/build.yml >> project.yml
fi
# Move build/custom/files to new locations (e.g., deploy excludes or .gitignores).
echo "Moving custom Phing files from build/custom to blt."
mkdir blt
mv build/custom blt
# Remove unneeded files.
echo "Removing deprecated BLT files from project."
rm -rf build blt.sh tests/phpunit/blt
# Removing old docs.
rm acsf-setup.md
rm architecture.md
rm best-practices.md
rm deploy.md
rm dev-workflow.md
rm features-workflow.md
rm local-development.md
rm onboarding.md
rm project-tasks.md
rm release-process.md
rm repo-architecture.md
rm views.md
# Install (new) alias
echo "Installing blt alias"
yes | ./vendor/acquia/blt/blt.sh install-alias
./vendor/acquia/blt/blt.sh init
./vendor/acquia/blt/blt.sh configure
composer update
echo "Update complete. Please do the following:"
echo ""
echo "* Restart your terminal session to register your new blt alias."
echo "* Review your codebase and commit the desired changes."
echo "* If you have a custom Phing build file, you will likely need to update it and add it to project.yml under the 'import' key. See readme/extending-blt.md."
echo "* If you are not using Lightning, remove lightning-specific target-hooks from project.yml."
# .travis.yml
# hash salt in settings.php
# readme overrides
else
exit 1
fi