Skip to content

Commit 96f3800

Browse files
author
Alexander Paliarush
committed
- Added ability to force switch to CE or EE edition
- EE is installed by default if EE repository is specified in config.yaml
1 parent 837adfc commit 96f3800

File tree

7 files changed

+36
-7
lines changed

7 files changed

+36
-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

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

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ bash m-switch-to-ce
168168
OR
169169
bash m-switch-to-ee
170170
```
171+
172+
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.
173+
171174
: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.
172175

173176
### 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)