This repository was archived by the owner on Oct 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathm-switch-to-ce
executable file
·60 lines (49 loc) · 1.9 KB
/
m-switch-to-ce
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
#!/usr/bin/env bash
vagrant_dir=$(cd "$(dirname "$0")"; pwd)
magento_ce_dir="${vagrant_dir}/magento2ce"
magento_ee_dir="${magento_ce_dir}/magento2ee"
host_os=$(bash "${vagrant_dir}/scripts/host/get_host_os.sh")
php_executable=$(bash "${vagrant_dir}/scripts/host/get_path_to_php.sh")
# Enable trace printing and exit on the first error
set -ex
with_sample_data=0
while [ "$1" != "" ]; do
case $1 in
-s | --sample-data ) with_sample_data=1
;;
* ) ;;
esac
shift
done
if [ ! -f ${magento_ee_dir}/app/etc/aliases_to_classes_map.json ]; then
echo "EE codebase is not available"
exit 0
fi
if [ ! -f ${magento_ce_dir}/app/etc/aliases_to_classes_map.json ]; then
echo "Already switched to CE"
exit 0
fi
${php_executable} -f ${magento_ee_dir}/dev/tools/build-ee.php -- --command=unlink --ee-source="${magento_ee_dir}" --ce-source="${magento_ce_dir}"
cd ${magento_ce_dir}
git checkout composer.json
git checkout composer.lock
if [[ ${host_os} == "Windows" || $(bash "${vagrant_dir}/scripts/get_config_value.sh" "guest_use_nfs") == 0 ]]; then
# Prevent issues on Windows with incorrect symlinks to files
if [ -f ${magento_ce_dir}/app/etc/aliases_to_classes_map.json ]; then
rm ${magento_ce_dir}/app/etc/aliases_to_classes_map.json
fi
if [ -f ${magento_ce_dir}/app/etc/enterprise/di.xml ]; then
rm ${magento_ce_dir}/app/etc/enterprise/di.xml
fi
fi
bash "${vagrant_dir}/m-clear-cache"
bash -c "${vagrant_dir}/m-composer install"
echo "Magento installation..."
if [[ ${host_os} == "Windows" || $(bash "${vagrant_dir}/scripts/get_config_value.sh" "guest_use_nfs") == 0 ]]; then
read -p "Wait while Magento2 code is uploaded in PhpStorm and press any key to continue..." -n1 -s
fi
if [ ${with_sample_data} = 1 ]; then
bash "${vagrant_dir}/m-reinstall" --sample-data
else
bash "${vagrant_dir}/m-reinstall"
fi