Last active
February 6, 2017 06:25
-
-
Save mfdj/3e107df3bd8fc92a635ae5fa9e708841 to your computer and use it in GitHub Desktop.
shell helpers for inside and outside VMs using Copious Magento 2 Starter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: Copious convention is to move typical Magento 2 project-root into a ./magento subdirectory | |
# default to vagrant folder when starting shell sessions in VM | |
cd /vagrant | |
# allow aliases to be used | |
shopt -s expand_aliases | |
# add magento and composer bins | |
export PATH+=:magento/bin | |
export PATH+=:magento/vendor/bin | |
alias mage=magento | |
alias magerun=n98-magerun2 | |
alias ll='ls -lA --color' | |
# assumes systemd and centos7 conventions (should be fairly portable to other OSes that use systemd?) | |
alias xdebugon="sudo sed -i 's~;zend_extension~zend_extension~' /etc/php.d/*xdebug.ini; sudo systemctl restart php-fpm" | |
alias xdebugoff="sudo sed -i 's~^zend_extension~;zend_extension~' /etc/php.d/*xdebug.ini; sudo systemctl restart php-fpm" | |
alias xdebugstatus="php -m | grep xdebug || echo xdebug not-enabled" | |
# shims that handle Copious ./magento convetion seamlessly | |
composer() { | |
if [[ ! -f composer.json && -f magento/composer.json ]]; then | |
(cd magento; command composer "$@") | |
else | |
command composer "$@" | |
fi | |
} | |
# warning: dashes for function names not portable http://unix.stackexchange.com/a/168222/29364 | |
n98-magerun2() { | |
local cmd | |
# juggle weird naming temporarily | |
command -v n98-magerun2 > /dev/null && cmd=n98-magerun2 | |
command -v n98-magerun > /dev/null && cmd=n98-magerun | |
if [[ ! -f composer.json && -f magento/composer.json ]]; then | |
(cd magento; command "$cmd" "$@") | |
else | |
command "$cmd" "$@" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment