Last active
March 22, 2019 09:47
-
-
Save erickpatrick/2be70d68e1ef1315935f7ff008c322bf to your computer and use it in GitHub Desktop.
BASH function for daily work with Homestead+Magento2+Yarn+Webpack
This file contains hidden or 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
function setup:recompile() { | |
cd ~/code | |
php bin/magento setup:upgrade | |
php bin/magento setup:di:compile | |
cd - | |
} | |
function setup:di:compile() { | |
cd ~/code | |
php bin/magento setup:di:compile | |
cd - | |
} | |
function setup:upgrade() { | |
cd ~/code | |
php bin/magento setup:upgrade | |
cd - | |
} | |
function reindex() { | |
cd ~/code | |
php bin/magento indexer:reindex | |
cd - | |
} | |
function cache:flush() { | |
cd ~/code | |
php bin/magento cache:flush | |
cd - | |
} | |
function static:deploy() { | |
if [[ $# -lt 2 ]]; then | |
echo 'not enough arguments: theme_module locale' | |
else | |
cd ~/code | |
php bin/magento setup:static-content:deploy -f $2 -t $1 | |
cd - | |
fi | |
} | |
function theme:folder() { | |
if [[ $# -lt 2 ]]; then | |
echo 'not enough arguments: theme_module locale' | |
else | |
cd ~/code/pub/static/frontend/Nintendo/$1/$2/Nintendo_Head/js/ | |
fi | |
} | |
function static:install() { | |
if [[ $# -lt 2 ]]; then | |
echo 'not enough arguments: theme locale' | |
else | |
cd ~/code/pub/static/frontend/Nintendo/$1/$2/Nintendo_Head/js/ | |
yarn | |
cd - | |
fi | |
} | |
function static:unit() { | |
if [[ $# -lt 2 ]]; then | |
echo 'not enough arguments: theme locale' | |
else | |
cd ~/code/pub/static/frontend/Nintendo/$1/$2/Nintendo_Head/js/ | |
yarn run unit | |
cd - | |
fi | |
} | |
function static:dev() { | |
if [[ $# -lt 2 ]]; then | |
echo 'not enough arguments: theme locale' | |
else | |
cd ~/code/pub/static/frontend/Nintendo/$1/$2/Nintendo_Head/js/ | |
yarn run dev | |
cd - | |
fi | |
} | |
function static:build() { | |
if [[ $# -lt 2 ]]; then | |
echo 'not enough arguments: theme locale' | |
else | |
cd ~/code/pub/static/frontend/Nintendo/$1/$2/Nintendo_Head/js/ | |
yarn run build | |
cache:flush | |
cd - | |
fi | |
} | |
function magento:test:clean() { | |
if [[ $# -lt 1 ]]; then | |
echo 'not enough arguments: path_to_test_to_run OR "testsuite name"' | |
else | |
clear | |
echo 'Cleaning sandbox...' | |
echo yes | rm -rf dev/tests/$1/tmp/* | |
echo 'Cleaning complete! Happy testing =)' | |
fi | |
} | |
function magento:test:integration() { | |
clear | |
if [[ $# -lt 1 ]]; then | |
echo 'not enough arguments: path_to_test_to_run OR "testsuite name"' | |
else | |
php vendor/phpunit/phpunit/phpunit -c `pwd`/dev/tests/integration/phpunit.xml $1 | |
fi | |
} | |
function magento:test:unit() { | |
clear | |
if [[ $# -lt 1 ]]; then | |
echo 'not enough arguments: path_to_test_to_run OR "testsuite name"' | |
else | |
php vendor/phpunit/phpunit/phpunit -c `pwd`/dev/tests/unit/phpunit.xml $1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment