File tree Expand file tree Collapse file tree 7 files changed +52
-33
lines changed Expand file tree Collapse file tree 7 files changed +52
-33
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ guest_memory = config_data['guest']['memory']
34
34
# NFS will be used for *nix and OSX hosts, if not disabled explicitly in config
35
35
use_nfs_for_synced_folders = !OS . is_windows && ( config_data [ 'guest' ] [ 'use_nfs' ] == 1 )
36
36
37
- host_magento_dir = Dir . pwd + '/magento2ce'
37
+ host_vagrant_dir = Dir . pwd + ''
38
+ host_magento_dir = host_vagrant_dir + '/magento2ce'
38
39
39
40
VAGRANT_API_VERSION = 2
40
41
Vagrant . configure ( VAGRANT_API_VERSION ) do |config |
@@ -64,7 +65,8 @@ Vagrant.configure(VAGRANT_API_VERSION) do |config|
64
65
magento_host_name , #3
65
66
config_data [ 'environment' ] [ 'use_php7' ] , #4
66
67
host_magento_dir , #5
67
- OS . is_windows ? "1" : "0" #6
68
+ OS . is_windows ? "1" : "0" , #6
69
+ host_vagrant_dir #7
68
70
]
69
71
70
72
config . vm . provision "configure_environment" , type : "shell" do |s |
Original file line number Diff line number Diff line change @@ -80,7 +80,24 @@ bash "${vagrant_dir}/scripts/host/composer.sh" install
80
80
cd ${vagrant_dir}
81
81
vagrant up
82
82
83
+ set +x
84
+ echo " Configuring PhpStorm..."
83
85
if [ ${force_project_cleaning} -eq 1 ]; then
84
86
rm -rf ${vagrant_dir} /.idea/*
85
87
fi
86
88
bash " ${vagrant_dir} /scripts/host/configure_php_storm.sh"
89
+
90
+ bold=$( tput bold)
91
+ regular=$( tput sgr0)
92
+ echo "
93
+ ${bold} [Important]${regular}
94
+ Please use ${bold}${vagrant_dir}${regular} directory as PhpStorm project root, NOT ${bold}${magento_ce_dir}${regular} ."
95
+
96
+ use_nfs=$( bash " ${vagrant_dir} /scripts/get_config_value.sh" " guest_use_nfs" )
97
+ if [[ ${host_os} == " Windows" || ${use_nfs} == 0 ]]; then
98
+ echo "
99
+ ${bold} [Optional]${regular}
100
+ To verify that deployment configuration for ${bold}${magento_ce_dir}${regular} in PhpStorm is correct,
101
+ use instructions provided here: ${bold} https://github.com/paliarush/magento2-vagrant-for-developers/blob/2.0/docs/phpstorm-configuration-windows-hosts.md${regular} .
102
+ If not using PhpStorm, you can set up synchronization using rsync"
103
+ fi
Original file line number Diff line number Diff line change @@ -7,12 +7,14 @@ set -ex
7
7
# Make guest configs visible and editable in the host IDE
8
8
9
9
# Configs located under /etc/*
10
- configs=( apache2 php mysql varnish rabbitmq init.d crontab cron.d timezone hosts )
10
+ configs=( apache2 php mysql varnish rabbitmq crontab cron.d timezone hosts profile profile.d )
11
11
for config in " ${configs[@]} "
12
12
do
13
13
if [ ! -d /vagrant/etc/guest/${config} ] && [ ! -f /vagrant/etc/guest/${config} ]; then
14
- mv /etc/${config} /vagrant/etc/guest/${config}
15
- ln -s /vagrant/etc/guest/${config} /etc/${config}
14
+ if [ -d /etc/${config} ] || [ -f /etc/${config} ]; then
15
+ mv /etc/${config} /vagrant/etc/guest/${config}
16
+ ln -s /vagrant/etc/guest/${config} /etc/${config}
17
+ fi
16
18
fi
17
19
done
18
20
@@ -21,7 +23,9 @@ configs=( .bashrc .composer .profile )
21
23
for config in " ${configs[@]} "
22
24
do
23
25
if [ ! -d /vagrant/etc/guest/${config} ] && [ ! -f /vagrant/etc/guest/${config} ]; then
24
- mv /home/vagrant/${config} /vagrant/etc/guest/${config}
25
- ln -s /vagrant/etc/guest/${config} /home/vagrant/${config}
26
+ if [ -d /home/vagrant/${config} ] || [ -f /home/vagrant/${config} ]; then
27
+ mv /home/vagrant/${config} /vagrant/etc/guest/${config}
28
+ ln -s /vagrant/etc/guest/${config} /home/vagrant/${config}
29
+ fi
26
30
fi
27
31
done
Original file line number Diff line number Diff line change @@ -4,14 +4,12 @@ echo "Clearing Magento cache..."
4
4
5
5
rm -f ${MAGENTO_ROOT} /app/etc/paths.php
6
6
# clear var
7
- for dir in ` ls ${MAGENTO_ROOT} /var` ; do
8
- rm -rf ${MAGENTO_ROOT} /var/${dir} /* ;
9
- done
7
+ cd ${MAGENTO_ROOT} && mv var/.htaccess var_htaccess.back && rm -rf var/* var/.[^.]* && mv var_htaccess.back var/.htaccess
10
8
# clear pub/statics
11
- cd ${MAGENTO_ROOT} /pub && mv static/.htaccess static_htaccess.back && rm -rf static/ * && mv static_htaccess.back static/.htaccess
9
+ cd ${MAGENTO_ROOT} /pub && mv static/.htaccess static_htaccess.back && rm -rf static && mkdir static && mv static_htaccess.back static/.htaccess
12
10
# clear integration tests tmp
13
- cd ${MAGENTO_ROOT} /dev/tests/integration && mv tmp/.gitignore tmp_gitignore.back && rm -rf tmp/ * && mv tmp_gitignore.back tmp/.gitignore
11
+ cd ${MAGENTO_ROOT} /dev/tests/integration && mv tmp/.gitignore tmp_gitignore.back && rm -rf tmp && mkdir tmp && mv tmp_gitignore.back tmp/.gitignore
14
12
# clear unit tests tmp
15
- cd ${MAGENTO_ROOT} /dev/tests/unit && rm -rf tmp/ *
13
+ cd ${MAGENTO_ROOT} /dev/tests/unit && rm -rf tmp && mkdir tmp
16
14
17
15
echo " Magento cache cleared."
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ install_cmd="./bin/magento setup:install \
63
63
--use-rewrites=1"
64
64
65
65
# Configure Rabbit MQ
66
- if [ -f " ${MAGENTO_ROOT} /app/code/Magento/Amqp/registration.php " ]; then
66
+ if [ -f " ${MAGENTO_ROOT} /app/etc/enterprise/di.xml " ] && [ -d " ${MAGENTO_ROOT} /app/ code/Magento/Amqp" ]; then
67
67
install_cmd=" ${install_cmd} \
68
68
--amqp-host=${setupOptions[amqp_host]} \
69
69
--amqp-port=${setupOptions[amqp_port]} \
@@ -93,15 +93,6 @@ sed -i "s|${MAGENTO_ROOT}|${MAGENTO_ROOT_HOST}|g" "/vagrant/.idea/misc.xml"
93
93
set +x
94
94
echo "
95
95
Magento application was deployed to ${MAGENTO_ROOT} and installed successfully
96
+
96
97
Access storefront at ${setupOptions[base_url]}
97
98
Access admin panel at ${setupOptions[base_url]}${setupOptions[admin_frontname]} /"
98
-
99
- if [[ ${is_windows_host} == 1 || ${use_nfs} == 0 ]]; then
100
- echo "
101
- [Optional] To finish developer environment set up:
102
- 1. Please create new PhpStorm project using 'magento2ce' directory on your host
103
- (this directory should already contain Magento repository cloned earlier)
104
-
105
- 2. Use instructions provided here https://github.com/paliarush/vagrant-magento/blob/2.0/docs/phpstorm-configuration-windows-hosts.md
106
- to set up synchronization in PhpStorm (or using rsync) with ${MAGENTO_ROOT} directory"
107
- fi
Original file line number Diff line number Diff line change @@ -70,12 +70,6 @@ if [ -f ${composer_auth_json} ]; then
70
70
fi
71
71
fi
72
72
73
- # Declare path to scripts supplied with vagrant and Magento
74
- echo " export PATH=\$ PATH:${vagrant_dir} /scripts/guest:${guest_magento_dir} /bin" >> /etc/profile
75
- echo " export MAGENTO_ROOT=${guest_magento_dir} " >> /etc/profile
76
- echo " export MAGENTO_ROOT_HOST=${host_magento_dir} " >> /etc/profile
77
- echo " export IS_WINDOWS_HOST=${is_windows_host} " >> /etc/profile
78
-
79
73
# Set permissions to allow Magento codebase upload by Vagrant provision script
80
74
if [ ${use_nfs_for_synced_folders} -eq 0 ]; then
81
75
chown -R vagrant:vagrant /var/www
Original file line number Diff line number Diff line change 6
6
guest_magento_dir=$2
7
7
host_magento_dir=$5
8
8
is_windows_host=$6
9
+ host_vagrant_dir=$7
10
+ vagrant_dir=" /vagrant"
9
11
10
- export MAGENTO_ROOT=${guest_magento_dir}
11
- export MAGENTO_ROOT_HOST=${host_magento_dir}
12
- export IS_WINDOWS_HOST=${is_windows_host}
12
+ if ! cat /etc/profile | grep -q ' export PATH=' ; then
13
+ echo " export PATH=\$ PATH:${vagrant_dir} /scripts/guest:${guest_magento_dir} /bin" >> /etc/profile
14
+ fi
15
+
16
+ if ! cat /etc/profile | grep -q ' export MAGENTO_ROOT=' ; then
17
+ echo " export MAGENTO_ROOT=${guest_magento_dir} " >> /etc/profile
18
+ echo " export MAGENTO_ROOT_HOST=${host_magento_dir} " >> /etc/profile
19
+ echo " export IS_WINDOWS_HOST=${is_windows_host} " >> /etc/profile
20
+ fi
21
+
22
+ if ! cat /etc/profile | grep -q ' export VAGRANT_ROOT=' ; then
23
+ echo " export VAGRANT_ROOT=${vagrant_dir} " >> /etc/profile
24
+ echo " export VAGRANT_ROOT_HOST=${host_vagrant_dir} " >> /etc/profile
25
+ fi
You can’t perform that action at this time.
0 commit comments