Skip to content

Commit b8bbc66

Browse files
committed
Merge pull request #47 from riconeitzel/fix-broken-paths
Fixed #42, Fixed #44
2 parents 7800d20 + 1463d37 commit b8bbc66

File tree

8 files changed

+47
-47
lines changed

8 files changed

+47
-47
lines changed

init_project.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ if ! echo ${vagrant_plugin_list} | grep -q 'vagrant-host-shell' ; then
2424
fi
2525

2626
# Generate random IP address and host name to prevent collisions, if not specified explicitly in local config
27-
if [ ! -f "${vagrant_dir}/etc/config.yaml" ]; then
28-
cp "${config_path}.dist" ${config_path}
27+
if [[ ! -f "${vagrant_dir}/etc/config.yaml" ]]; then
28+
cp "${config_path}.dist" "${config_path}"
2929
fi
3030
random_ip=$(( ( RANDOM % 240 ) + 12 ))
3131
forwarded_ssh_port=$(( random_ip + 3000 ))
@@ -46,48 +46,48 @@ while getopts 'fcp' flag; do
4646
*) error "Unexpected option ${flag}" ;;
4747
esac
4848
done
49-
if [ ${force_project_cleaning} -eq 1 ]; then
49+
if [[ ${force_project_cleaning} -eq 1 ]]; then
5050
vagrant destroy -f
51-
mv ${vagrant_dir}/etc/guest/.gitignore ${vagrant_dir}/etc/.gitignore.back
52-
rm -rf ${vagrant_dir}/.vagrant ${vagrant_dir}/etc/guest
53-
mkdir ${vagrant_dir}/etc/guest
54-
mv ${vagrant_dir}/etc/.gitignore.back ${vagrant_dir}/etc/guest/.gitignore
55-
if [ ${force_codebase_cleaning} -eq 1 ]; then
56-
rm -rf ${magento_ce_dir}
51+
mv "${vagrant_dir}/etc/guest/.gitignore" "${vagrant_dir}/etc/.gitignore.back"
52+
rm -rf "${vagrant_dir}/.vagrant" "${vagrant_dir}/etc/guest"
53+
mkdir "${vagrant_dir}/etc/guest"
54+
mv "${vagrant_dir}/etc/.gitignore.back" "${vagrant_dir}/etc/guest/.gitignore"
55+
if [[ ${force_codebase_cleaning} -eq 1 ]]; then
56+
rm -rf "${magento_ce_dir}"
5757
fi
5858
fi
5959

60-
if [ ! -d ${magento_ce_dir} ]; then
60+
if [[ ! -d ${magento_ce_dir} ]]; then
6161
if [[ ${host_os} == "Windows" ]]; then
6262
git config --global core.autocrlf false
6363
git config --global core.eol LF
6464
git config --global diff.renamelimit 5000
6565
fi
6666
# Check out CE repository
6767
repository_url_ce=$(bash "${vagrant_dir}/scripts/get_config_value.sh" "repository_url_ce")
68-
git clone ${repository_url_ce} ${magento_ce_dir}
68+
git clone ${repository_url_ce} "${magento_ce_dir}"
6969
# Check out EE repository
7070
# By default EE repository is not specified and EE project is not checked out
7171
repository_url_ee=$(bash "${vagrant_dir}/scripts/get_config_value.sh" "repository_url_ee")
72-
if [ -n "${repository_url_ee}" ]; then
73-
git clone ${repository_url_ee} ${magento_ee_dir}
72+
if [[ -n "${repository_url_ee}" ]]; then
73+
git clone ${repository_url_ee} "${magento_ee_dir}"
7474
fi
7575
fi
7676

7777
# Update Magento dependencies via Composer
78-
cd ${magento_ce_dir}
78+
cd "${magento_ce_dir}"
7979
bash "${vagrant_dir}/scripts/host/composer.sh" install
8080

8181
# Create vagrant project
82-
cd ${vagrant_dir}
82+
cd "${vagrant_dir}"
8383
vagrant up
8484

8585
set +x
8686
echo "Configuring PhpStorm..."
87-
if [ ${force_project_cleaning} -eq 1 ] && [ ${force_phpstorm_config_cleaning} -eq 1 ]; then
88-
rm -rf ${vagrant_dir}/.idea
87+
if [[ ${force_project_cleaning} -eq 1 ]] && [[ ${force_phpstorm_config_cleaning} -eq 1 ]]; then
88+
rm -rf "${vagrant_dir}/.idea"
8989
fi
90-
if [ ! "$(ls -A ${vagrant_dir}/.idea)" ]; then
90+
if [[ ! "$(ls -A "${vagrant_dir}/.idea")" ]]; then
9191
bash "${vagrant_dir}/scripts/host/configure_php_storm.sh"
9292
fi
9393

scripts/get_config_value.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ parse_yaml() {
55
local prefix=$2
66
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
77
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
8-
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
8+
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" "$1" |
99
awk -F$fs '{
1010
indent = length($1)/2;
1111
vname[indent] = $2;

scripts/host/composer.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@ bash "${vagrant_dir}/scripts/host/check_requirements.sh"
1616
php_executable=$(bash "${vagrant_dir}/scripts/host/get_path_to_php.sh")
1717

1818
# Setup composer if necessary
19-
if [ ! -f ${composer_phar} ]; then
20-
cd ${composer_dir}
19+
if [[ ! -f ${composer_phar} ]]; then
20+
cd "${composer_dir}"
2121
curl -sS https://getcomposer.org/installer | ${php_executable}
2222
fi
2323

2424
# Configure composer credentials
2525
auth_json_already_exists=0
26-
if [ -f "${current_dir}/auth.json" ]; then
26+
if [[ -f "${current_dir}/auth.json" ]]; then
2727
auth_json_already_exists=1
2828
fi
2929

30-
cd ${current_dir}
31-
if [ ! ${auth_json_already_exists} = 1 ] && [ -f ${composer_auth_json} ]; then
32-
cp ${composer_auth_json} "${current_dir}/auth.json"
30+
cd "${current_dir}"
31+
if [[ ! ${auth_json_already_exists} = 1 ]] && [[ -f ${composer_auth_json} ]]; then
32+
cp "${composer_auth_json}" "${current_dir}/auth.json"
3333
fi
3434

3535
host_os=$(bash "${vagrant_dir}/scripts/host/get_host_os.sh")
3636
if [[ $(bash "${vagrant_dir}/scripts/get_config_value.sh" "environment_composer_prefer_source") == 1 ]]; then
3737
# prefer-source is slow but guarantees that there will be no issues related to max path length on Windows
38-
${php_executable} ${composer_phar} --ignore-platform-reqs --prefer-source "$@"
38+
${php_executable} "${composer_phar}" --ignore-platform-reqs --prefer-source "$@"
3939
else
40-
${php_executable} ${composer_phar} --ignore-platform-reqs "$@"
40+
${php_executable} "${composer_phar}" --ignore-platform-reqs "$@"
4141
fi
4242

43-
if [ ! ${auth_json_already_exists} = 1 ] && [ -f "${current_dir}/auth.json" ]; then
43+
if [[ ! ${auth_json_already_exists} = 1 ]] && [[ -f "${current_dir}/auth.json" ]]; then
4444
rm "${current_dir}/auth.json"
4545
fi

scripts/host/configure_php_storm.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ vagrant_dir=$(cd "$(dirname "$0")/../.."; pwd)
55
# Enable trace printing and exit on the first error
66
set +x
77

8-
cd ${vagrant_dir}
8+
cd "${vagrant_dir}"
99
ssh_port=$(bash "${vagrant_dir}/scripts/get_config_value.sh" "guest_forwarded_ssh_port")
1010
magento_host_name=$(bash "${vagrant_dir}/scripts/get_config_value.sh" "magento_host_name")
1111

@@ -32,8 +32,8 @@ sed -i.back "s|<host_name>|${magento_host_name}|g" "${vagrant_dir}/.idea/deploym
3232
sed -i.back "s|<host_name>|${magento_host_name}|g" "${vagrant_dir}/.idea/deployment.xml"
3333
sed -i.back "s|<host_name>|${magento_host_name}|g" "${vagrant_dir}/.idea/.name"
3434
sed -i.back "s|<host_name>|${magento_host_name}|g" "${vagrant_dir}/.idea/modules.xml"
35-
rm -rf ${vagrant_dir}/.idea/*.back
36-
rm -f ${vagrant_dir}/.idea/.name.back
35+
rm -rf "${vagrant_dir}/.idea/*.back"
36+
rm -f "${vagrant_dir}/.idea/.name.back"
3737

3838
mv "${vagrant_dir}/.idea/host_name.iml" "${vagrant_dir}/.idea/${magento_host_name}.iml"
3939

scripts/host/get_path_to_php.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ vagrant_dir=$(cd "$(dirname "$0")/../.."; pwd)
66
set -ex
77

88
# Find path to available PHP
9-
if [ -f ${vagrant_dir}/lib/php/php.exe ]; then
9+
if [[ -f ${vagrant_dir}/lib/php/php.exe ]]; then
1010
php_executable="${vagrant_dir}/lib/php/php"
1111
else
1212
php_executable="php"

scripts/host/install_php.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ host_os=$(bash "${vagrant_dir}/scripts/host/get_host_os.sh")
77
set -ex
88

99
if [[ ${host_os} == "Windows" ]]; then
10-
curl http://windows.php.net/downloads/releases/archives/php-5.6.9-nts-Win32-VC11-x86.zip -o ${vagrant_dir}/lib/php.zip
11-
unzip -q ${vagrant_dir}/lib/php.zip -d ${vagrant_dir}/lib/php
12-
rm -f ${vagrant_dir}/lib/php.zip
10+
curl http://windows.php.net/downloads/releases/archives/php-5.6.9-nts-Win32-VC11-x86.zip -o "${vagrant_dir}/lib/php.zip"
11+
unzip -q "${vagrant_dir}/lib/php.zip" -d "${vagrant_dir}/lib/php"
12+
rm -f "${vagrant_dir}/lib/php.zip"
1313
cp "${vagrant_dir}/lib/php/php.ini-development" "${vagrant_dir}/lib/php/php.ini"
1414
sed -i.back 's|; extension_dir = "ext"|extension_dir = "ext"|g' "${vagrant_dir}/lib/php/php.ini"
1515
sed -i.back 's|;extension=php_openssl.dll|extension=php_openssl.dll|g' "${vagrant_dir}/lib/php/php.ini"
16-
rm -rf ${vagrant_dir}/lib/php/*.back
16+
rm -rf "${vagrant_dir}/lib/php/*.back"
1717
fi
1818

1919
php_executable=$(bash "${vagrant_dir}/scripts/host/get_path_to_php.sh")

scripts/provision/configure_environment.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ vagrant_dir="/vagrant"
1515
# Enable Magento virtual host
1616
custom_virtual_host_config="${vagrant_dir}/etc/magento2_virtual_host.conf"
1717
default_virtual_host_config="${vagrant_dir}/etc/magento2_virtual_host.conf.dist"
18-
if [ -f ${custom_virtual_host_config} ]; then
18+
if [[ -f ${custom_virtual_host_config} ]]; then
1919
virtual_host_config=${custom_virtual_host_config}
2020
else
2121
virtual_host_config=${default_virtual_host_config}
2222
fi
2323
enabled_virtual_host_config="/etc/apache2/sites-available/magento2.conf"
24-
cp ${virtual_host_config} ${enabled_virtual_host_config}
25-
sed -i "s|<host>|${magento_host_name}|g" ${enabled_virtual_host_config}
26-
sed -i "s|<guest_magento_dir>|${guest_magento_dir}|g" ${enabled_virtual_host_config}
24+
cp "${virtual_host_config}" "${enabled_virtual_host_config}"
25+
sed -i "s|<host>|${magento_host_name}|g" "${enabled_virtual_host_config}"
26+
sed -i "s|<guest_magento_dir>|${guest_magento_dir}|g" "${enabled_virtual_host_config}"
2727
a2ensite magento2.conf
2828

2929
# Disable default virtual host
@@ -38,8 +38,8 @@ if [ -f ${composer_auth_json} ]; then
3838
if [ ! -d /home/vagrant/.composer ] ; then
3939
sudo -H -u vagrant bash -c 'mkdir /home/vagrant/.composer'
4040
fi
41-
if [ -f ${composer_auth_json} ]; then
42-
cp ${composer_auth_json} /home/vagrant/.composer/auth.json
41+
if [[ -f ${composer_auth_json} ]]; then
42+
cp "${composer_auth_json}" "/home/vagrant/.composer/auth.json"
4343
fi
4444
fi
4545

scripts/provision/configure_environment_recurring.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function process_php_config () {
55

66
for php_ini_path in "${php_ini_paths[@]}"
77
do
8-
if [ -f ${php_ini_path} ]; then
8+
if [[ -f ${php_ini_path} ]]; then
99
echo "date.timezone = America/Chicago" >> ${php_ini_path}
1010
sed -i "s|;include_path = \".:/usr/share/php\"|include_path = \".:/usr/share/php:${guest_magento_dir}/vendor/phpunit/phpunit\"|g" ${php_ini_path}
1111
sed -i "s|display_errors = Off|display_errors = On|g" ${php_ini_path}
@@ -33,12 +33,12 @@ use_php7=$4
3333
vagrant_dir="/vagrant"
3434

3535
# Remove configs from host in case of force stop of virtual machine before linking restored ones
36-
cd ${vagrant_dir}/etc && mv guest/.gitignore guest_gitignore.back && rm -rf guest && mkdir guest && mv guest_gitignore.back guest/.gitignore
37-
bash ${vagrant_dir}/scripts/guest/link_configs
36+
cd "${vagrant_dir}/etc" && mv guest/.gitignore guest_gitignore.back && rm -rf guest && mkdir guest && mv guest_gitignore.back guest/.gitignore
37+
bash "${vagrant_dir}/scripts/guest/link_configs"
3838

3939
# Make sure configs are restored on system halt and during reboot
4040
rm -f /etc/init.d/unlink-configs
41-
cp ${vagrant_dir}/scripts/guest/unlink_configs /etc/init.d/unlink-configs
41+
cp "${vagrant_dir}/scripts/guest/unlink_configs" /etc/init.d/unlink-configs
4242
if [ ! -f /etc/rc0.d/K04-unlink-configs ]; then
4343
ln -s /etc/init.d/unlink-configs /etc/rc0.d/K04-unlink-configs
4444
ln -s /etc/init.d/unlink-configs /etc/rc1.d/S04-unlink-configs
@@ -50,7 +50,7 @@ if [ ! -f /etc/rc0.d/K04-unlink-configs ]; then
5050
fi
5151

5252
# Upgrade existing environment
53-
if [ -f ${vagrant_dir}/.idea/deployment.xml ]; then
53+
if [[ -f ${vagrant_dir}/.idea/deployment.xml ]]; then
5454
sed -i.back "s|magento2ce/var/generation|magento2ce/var|g" "${vagrant_dir}/.idea/deployment.xml"
5555
fi
5656

0 commit comments

Comments
 (0)