Skip to content

Commit 98a021e

Browse files
author
Alexander Paliarush
committed
Merge remote-tracking branch 'remotes/origin/2.0' into Email-Logging
# Conflicts: # init_project.sh
2 parents daaa3b2 + b8bbc66 commit 98a021e

File tree

8 files changed

+48
-48
lines changed

8 files changed

+48
-48
lines changed

init_project.sh

Lines changed: 19 additions & 19 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,49 +46,49 @@ 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-
cd ${vagrant_dir}/log && mv email/.gitignore email_gitignore.back && rm -rf email && mkdir email && mv email_gitignore.back email/.gitignore
56-
if [ ${force_codebase_cleaning} -eq 1 ]; then
57-
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+
cd "${vagrant_dir}/log" && mv email/.gitignore email_gitignore.back && rm -rf email && mkdir email && mv email_gitignore.back email/.gitignore
56+
if [[ ${force_codebase_cleaning} -eq 1 ]]; then
57+
rm -rf "${magento_ce_dir}"
5858
fi
5959
fi
6060

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

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

8282
# Create vagrant project
83-
cd ${vagrant_dir}
83+
cd "${vagrant_dir}"
8484
vagrant up
8585

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

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}
@@ -32,12 +32,12 @@ use_php7=$4
3232
vagrant_dir="/vagrant"
3333

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

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

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

0 commit comments

Comments
 (0)