Skip to content

Instantly share code, notes, and snippets.

@0m3r
Last active May 21, 2021 11:23
Show Gist options
  • Save 0m3r/954fc98bda36f90e4580e7eee641cc05 to your computer and use it in GitHub Desktop.
Save 0m3r/954fc98bda36f90e4580e7eee641cc05 to your computer and use it in GitHub Desktop.
Fast deploy for all Swissup modules (for developer only)

Fast deploy for all Swissup modules (for developer only)

Usage

(curl -s https://gist.githubusercontent.com/0m3r/954fc98bda36f90e4580e7eee641cc05/raw/b327e5644af562a403b26ff8bf44504192e20e65/install.bash > install.bash) && chmod +x install.bash && ./install.bash && rm -rf install.bash

Warning

Doesn't work without access to private SwissupLabs GitHub Repos

#!/bin/bash
# Check is magento root dir
[ -x 'bin/magento' ] || { echo >&2 "The script requires installed \"Magento 2\" "; pwd; exit 1; }
# Check availability of composer
hash composer 2>/dev/null || { echo >&2 "The script requires \"composer\" (https://getcomposer.org/download/)"; exit 1; }
composer config repositories.swissup composer https://docs.swissuplabs.com/packages/
composer config repositories.packagist false
packages=$(composer show --available | grep "swissup/module-\|swissup/theme-" | cut -d ' ' -f 1 | tr '\n\012\015' ' ');
composer config --unset repositories.packagist
for PACKAGE in $packages; do
echo "Installing $PACKAGE"
composer require --prefer-source --ignore-platform-reqs $PACKAGE
done
MAGENTO_BIN='php bin/magento';
if [ -x 'vendor/bin/dockerizer' ]
then
vendor/bin/dockerizer restart
MAGENTO_BIN='vendor/bin/dockerizer bin/magento';
fi
# Enable new modules
DISABLED_MODULES=$($MAGENTO_BIN module:status --disabled | grep Swissup_)
MODULES=$($MAGENTO_BIN module:status | grep Swissup_)
$MAGENTO_BIN module:enable $MODULES
$MAGENTO_BIN module:disable $DISABLED_MODULES
# Initialize repository in `vendor/swissup` folder and add each subfolder as git submodule
cd vendor/swissup
if [ ! -d '.git' ]
then
git init
for module in *; do
# echo $module
git submodule add "./$module"
done;
git add .
git commit -m "Initial commit"
fi
# Update all modules
for module in *; do
cd $module
git checkout master
git pull
cd ../
done;
cd ../..
# Run magento upgrade scripts
$MAGENTO_BIN setup:upgrade
sudo rm -rf pub/static/_requirejs var/view_preprocessed pub/static/frontend/ pub/static/adminhtml/ generated/code/
$MAGENTO_BIN setup:static-content:deploy -f
$MAGENTO_BIN setup:di:compile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment