Skip to content

Commit 32c98b6

Browse files
authored
Merge pull request #53 from paliarush/Improvements
Improvements
2 parents 6b1d3e2 + a8ea4e5 commit 32c98b6

File tree

7 files changed

+37
-7
lines changed

7 files changed

+37
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1414
- Removed requirement for public github token due to Composer limitations (issue is fixed on Composer side)
1515
- Changed requirement for minimum box version from 1.0 to 1.1
1616
- Upgraded PHP 5.5.9 to PHP 5.6
17+
- When [init_project.sh](init_project.sh) is executed, EE will be installed by default, if EE repository is specified in [etc/config.yaml.dist](etc/config.yaml.dist)
1718

1819
### Fixed
1920

@@ -29,6 +30,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2930
- Added ability to modify guest config files (PHP, Apache etc) directly from host IDE
3031
- Added ability to choose if PhpStorm configs should be removed during project reinitialization
3132
- Added ability to switch PHP version without destroying the project ("vagrant reload" is required)
33+
- Added ability to do force switch to CE or EE (even if already switched to target edition)
3234
- Added ability to use Varnish full page caching automatically. (Using "vagrant reload" or m-varnish script)
3335

3436
## [v2.0.0] - 2016-02-05

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ Note, that semantic versioning is only used for `x.0` branches (not for `develop
134134
1. ![](docs/images/linux-icon.png)![](docs/images/osx-icon.png) On OSX and \*nix hosts NFS will be used by default to sync your project files with guest. On some hosts Vagrant cannot configure NFS properly, in this case it is possible to deploy project without NFS by setting `use_nfs` option in [config.yaml](etc/config.yaml.dist) to `0` <br />
135135
1. ![](docs/images/windows-icon.png) On Windows hosts you might face `Composer Install Error: ZipArchive::extractTo(): Full extraction path exceed MAXPATHLEN (260)` exception during `composer install`. This can be fixed in 2 ways: decrease path length to the project directory or set `composer_prefer_source` option in [config.yaml](etc/config.yaml.dist) to `1`
136136
1. Make sure that you used `vagrant-magento` directory as project root in PHP Storm (not `vagrant-magento/magento2ce`)
137+
1. If project opened in PhpStorm looks broken, close PhpStorm and remove `vagrant-magento/.idea`. After opening project in PhpStorm again everything should look good
137138
1. If code is not synchronized properly on Windows hosts (or when NFS mode is disabled in [config.yaml](etc/config.yaml.dist) explicitly), make sure that PhpStorm is running before making any changes in the code. This is important because otherwise PhpStorm will not be able to detect changes and upload them to the guest machine
138139
1. Please make sure that currently installed software, specified in [requirements section](#requirements), meets minimum version requirement
139140
1. If MySQL fails to start and Magento reinstallation fails with `ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)`, try to run login to virtual machine using `vagrant ssh` and then run `sudo dpkg-reconfigure mysql-server-5.6`, then `sudo service mysql restart.`
@@ -169,6 +170,9 @@ bash m-switch-to-ce
169170
OR
170171
bash m-switch-to-ee
171172
```
173+
174+
Force switch can be done using `-f` flag even if already switched to the target edition. May be helpful to relink EE modules after switching between branches.
175+
172176
:information_source: On Windows hosts (or when NFS mode is disabled in [config.yaml](etc/config.yaml.dist) explicitly) you will be asked to wait until code is uploaded to guest machine by PhpStorm (PhpStorm must be lunched). To continue the process press any key.
173177

174178
### Update Composer dependencies

Vagrantfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ Vagrant.configure(VAGRANT_API_VERSION) do |config|
101101
config.vm.provision "guest_remove_compressed_code", type: "shell", inline: "rm -f /vagrant/scripts/host/magento2ce.tar"
102102
end
103103

104-
config.vm.provision "install_magento", type: "shell", inline: "m-reinstall"
105-
106104
# Host manager plugin configuration
107105
config.hostmanager.enabled = true
108106
config.hostmanager.manage_host = true

init_project.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ bash "${vagrant_dir}/scripts/host/composer.sh" install
8383
cd "${vagrant_dir}"
8484
vagrant up
8585

86+
if [[ -n "${repository_url_ee}" ]]; then
87+
bash "${vagrant_dir}/m-switch-to-ee" -f
88+
else
89+
bash "${vagrant_dir}/m-switch-to-ce" -f
90+
fi
91+
8692
set +x
8793
echo "Configuring PhpStorm..."
8894
if [[ ${force_project_cleaning} -eq 1 ]] && [[ ${force_phpstorm_config_cleaning} -eq 1 ]]; then

m-switch-to-ce

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@ php_executable=$(bash "${vagrant_dir}/scripts/host/get_path_to_php.sh")
1010
set -ex
1111

1212
if [[ ! -f ${magento_ee_dir}/app/etc/aliases_to_classes_map.json ]]; then
13+
set +x
1314
echo "EE codebase is not available"
1415
exit 0
1516
fi
1617

17-
if [[ ! -f ${magento_ce_dir}/app/etc/aliases_to_classes_map.json ]]; then
18-
echo "Already switched to CE"
18+
force_switch=0
19+
while getopts 'f' flag; do
20+
case "${flag}" in
21+
f) force_switch=1 ;;
22+
*) error "Unexpected option ${flag}" ;;
23+
esac
24+
done
25+
26+
if [[ ! -f ${magento_ce_dir}/app/etc/aliases_to_classes_map.json ]] && [[ ${force_switch} -eq 0 ]]; then
27+
set +x
28+
echo "Already switched to CE. Use 'm-switch-to-ce -f' to switch anyway."
1929
exit 0
2030
fi
2131

m-switch-to-ee

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@ php_executable=$(bash "${vagrant_dir}/scripts/host/get_path_to_php.sh")
1010
set -ex
1111

1212
if [[ ! -f ${magento_ee_dir}/app/etc/aliases_to_classes_map.json ]]; then
13+
set +x
1314
echo "EE codebase is not available"
1415
exit 0
1516
fi
1617

17-
if [[ -f ${magento_ce_dir}/app/etc/aliases_to_classes_map.json ]]; then
18-
echo "Already switched to EE"
18+
force_switch=0
19+
while getopts 'f' flag; do
20+
case "${flag}" in
21+
f) force_switch=1 ;;
22+
*) error "Unexpected option ${flag}" ;;
23+
esac
24+
done
25+
26+
if [[ -f ${magento_ce_dir}/app/etc/aliases_to_classes_map.json ]] && [[ ${force_switch} -eq 0 ]]; then
27+
set +x
28+
echo "Already switched to EE. Use 'm-switch-to-ce -f' to switch anyway."
1929
exit 0
2030
fi
2131

scripts/guest/m-reinstall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ install_cmd="./bin/magento setup:install \
6363
--use-rewrites=1"
6464

6565
# Configure Rabbit MQ
66-
if [[ -f "${MAGENTO_ROOT}/app/etc/enterprise/di.xml" ]] && [[ -d "${MAGENTO_ROOT}/app/code/Magento/Amqp" ]]; then
66+
if [[ -f "${MAGENTO_ROOT}/app/etc/enterprise/di.xml" ]]; then
6767
install_cmd="${install_cmd} \
6868
--amqp-host=${setupOptions[amqp_host]} \
6969
--amqp-port=${setupOptions[amqp_port]} \

0 commit comments

Comments
 (0)