2018-05-04 16:25:15 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-01-30 15:15:19 +03:00
|
|
|
if [ -z $ROOT_DIR ]; then
|
|
|
|
exit 0;
|
2018-05-04 16:25:15 +03:00
|
|
|
fi
|
|
|
|
|
2021-01-30 15:15:19 +03:00
|
|
|
MAGE_ROOT=$ROOT_DIR/../magento2
|
2018-05-04 16:25:15 +03:00
|
|
|
|
|
|
|
create_db() {
|
2021-01-30 15:15:19 +03:00
|
|
|
mysqladmin create "magento2_test" --user="root" --password="root"
|
2018-05-04 16:25:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
magento_clone() {
|
2021-01-30 15:15:19 +03:00
|
|
|
cd ..
|
|
|
|
git clone https://github.com/magento/magento2
|
|
|
|
cd magento2
|
|
|
|
git checkout $BRANCH
|
2020-05-18 12:19:01 +03:00
|
|
|
|
2021-01-30 15:15:19 +03:00
|
|
|
touch auth.json
|
|
|
|
echo '
|
2020-05-18 12:19:01 +03:00
|
|
|
{
|
|
|
|
"http-basic": {
|
|
|
|
"repo.magento.com": {
|
|
|
|
"username": "<public-key>",
|
|
|
|
"password": "<private-key>"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-01-30 15:15:19 +03:00
|
|
|
' > auth.json
|
2020-05-18 12:19:01 +03:00
|
|
|
|
2021-01-30 15:15:19 +03:00
|
|
|
sudo sed -e "s?<public-key>?$PUBLIC_KEY?g" --in-place auth.json
|
|
|
|
sudo sed -e "s?<private-key>?$PRIVATE_KEY?g" --in-place auth.json
|
2020-05-18 12:19:01 +03:00
|
|
|
|
2021-01-30 15:15:19 +03:00
|
|
|
composer install --no-interaction --prefer-dist
|
|
|
|
composer require retailcrm/api-client-php
|
2018-05-04 16:25:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
magento_install() {
|
2021-01-30 15:15:19 +03:00
|
|
|
cd $MAGE_ROOT
|
|
|
|
php bin/magento setup:install \
|
|
|
|
--db-host="localhost" \
|
|
|
|
--db-name="magento2_test" \
|
|
|
|
--db-user="root" \
|
|
|
|
--db-password="root" \
|
|
|
|
--admin-firstname="admin_firstname" \
|
|
|
|
--admin-lastname="admin_lastname" \
|
|
|
|
--admin-email="example@email.com" \
|
|
|
|
--admin-user="admin" \
|
|
|
|
--admin-password="admin123" \
|
|
|
|
--language="en_US" \
|
|
|
|
--currency="USD" \
|
|
|
|
--timezone="Europe/Moscow"
|
2018-05-04 16:25:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
module_install() {
|
2021-01-30 15:15:19 +03:00
|
|
|
cd $MAGE_ROOT
|
|
|
|
mkdir -p app/code/Retailcrm/Retailcrm
|
|
|
|
cp -R $ROOT_DIR/src/* app/code/Retailcrm/Retailcrm
|
2018-05-04 16:25:15 +03:00
|
|
|
|
2021-01-30 15:15:19 +03:00
|
|
|
php bin/magento module:enable Retailcrm_Retailcrm
|
|
|
|
php bin/magento setup:upgrade
|
|
|
|
php bin/magento setup:di:compile
|
2018-05-04 16:25:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
create_db
|
|
|
|
magento_clone
|
|
|
|
magento_install
|
|
|
|
module_install
|