Skip to content

Commit 07d06e2

Browse files
author
Alexander Paliarush
committed
Added ability to reset project without clearing codebase
1 parent 762c709 commit 07d06e2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

init_project.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,22 @@ sed -i.back "s|host_name: \"magento2.vagrant2\"|host_name: \"magento2.vagrant${r
3434
sed -i.back "s|forwarded_ssh_port: 3000|forwarded_ssh_port: ${forwarded_ssh_port}|g" "${config_path}"
3535
rm -f "${config_path}.back"
3636

37-
# Clean up the project before initialization if "-f" option was specified
37+
# Clean up the project before initialization if "-f" option was specified. Remove codebase if "-fc" is used.
3838
force_project_cleaning=0
39-
while getopts 'f' flag; do
39+
force_codebase_cleaning=0
40+
while getopts 'fc' flag; do
4041
case "${flag}" in
4142
f) force_project_cleaning=1 ;;
43+
c) force_codebase_cleaning=1 ;;
4244
*) error "Unexpected option ${flag}" ;;
4345
esac
4446
done
4547
if [ ${force_project_cleaning} -eq 1 ]; then
4648
vagrant destroy -f
47-
rm -rf ${magento_ce_dir} ${vagrant_dir}/.idea ${vagrant_dir}/.vagrant
49+
rm -rf ${vagrant_dir}/.idea ${vagrant_dir}/.vagrant
50+
if [ ${force_codebase_cleaning} -eq 1 ]; then
51+
rm -rf ${magento_ce_dir}
52+
fi
4853
fi
4954

5055
if [ ! -d ${magento_ce_dir} ]; then

0 commit comments

Comments
 (0)