premiers tests ok
This commit is contained in:
47
resources/Homestead.json
Normal file
47
resources/Homestead.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"ip": "192.168.56.56",
|
||||
"memory": 2048,
|
||||
"cpus": 2,
|
||||
"provider": "virtualbox",
|
||||
"authorize": "~/.ssh/id_rsa.pub",
|
||||
"keys": [
|
||||
"~/.ssh/id_rsa"
|
||||
],
|
||||
"folders": [
|
||||
{
|
||||
"map": "~/code",
|
||||
"to": "/home/vagrant/code"
|
||||
}
|
||||
],
|
||||
"sites": [
|
||||
{
|
||||
"map": "homestead.test",
|
||||
"to": "/home/vagrant/code/public"
|
||||
}
|
||||
],
|
||||
"databases": [
|
||||
"homestead"
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
"mysql": true
|
||||
},
|
||||
{
|
||||
"mariadb": false
|
||||
},
|
||||
{
|
||||
"postgresql": false
|
||||
},
|
||||
{
|
||||
"ohmyzsh": false
|
||||
},
|
||||
{
|
||||
"webdriver": false
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"mysql": true
|
||||
}
|
||||
]
|
||||
}
|
47
resources/Homestead.yaml
Normal file
47
resources/Homestead.yaml
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
ip: "192.168.56.56"
|
||||
memory: 2048
|
||||
cpus: 2
|
||||
provider: virtualbox
|
||||
|
||||
authorize: ~/.ssh/id_rsa.pub
|
||||
|
||||
keys:
|
||||
- ~/.ssh/id_rsa
|
||||
|
||||
folders:
|
||||
- map: ~/code
|
||||
to: /home/vagrant/code
|
||||
|
||||
sites:
|
||||
- map: homestead.test
|
||||
to: /home/vagrant/code/public
|
||||
|
||||
databases:
|
||||
- homestead
|
||||
|
||||
features:
|
||||
- mariadb: false
|
||||
- postgresql: false
|
||||
- ohmyzsh: false
|
||||
- webdriver: false
|
||||
|
||||
services:
|
||||
- enabled:
|
||||
- "mysql"
|
||||
# - disabled:
|
||||
# - "postgresql@11-main"
|
||||
|
||||
# ports:
|
||||
# - send: 33060 # MySQL/MariaDB
|
||||
# to: 3306
|
||||
# - send: 4040
|
||||
# to: 4040
|
||||
# - send: 54320 # PostgreSQL
|
||||
# to: 5432
|
||||
# - send: 8025 # Mailpit
|
||||
# to: 8025
|
||||
# - send: 9600
|
||||
# to: 9600
|
||||
# - send: 27017
|
||||
# to: 27017
|
23
resources/after.sh
Normal file
23
resources/after.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
# If you would like to do some extra provisioning you may
|
||||
# add any commands you wish to this file and they will
|
||||
# be run after the Homestead machine is provisioned.
|
||||
#
|
||||
# If you have user-specific configurations you would like
|
||||
# to apply, you may also create user-customizations.sh,
|
||||
# which will be run after this script.
|
||||
|
||||
|
||||
# If you're not quite ready for the latest Node.js version,
|
||||
# uncomment these lines to roll back to a previous version
|
||||
|
||||
# Remove current Node.js version:
|
||||
#sudo apt-get -y purge nodejs
|
||||
#sudo rm -rf /usr/lib/node_modules/npm/lib
|
||||
#sudo rm -rf //etc/apt/sources.list.d/nodesource.list
|
||||
|
||||
# Install Node.js Version desired (i.e. v13)
|
||||
# More info: https://github.com/nodesource/distributions/blob/master/README.md#debinstall
|
||||
#curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
|
||||
#sudo apt-get install -y nodejs
|
357
resources/aliases
Normal file
357
resources/aliases
Normal file
@@ -0,0 +1,357 @@
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
|
||||
alias h='cd ~'
|
||||
alias c='clear'
|
||||
alias art=artisan
|
||||
|
||||
alias codecept='vendor/bin/codecept'
|
||||
alias phpspec='vendor/bin/phpspec'
|
||||
alias pint='vendor/bin/pint'
|
||||
alias serve=serve-laravel
|
||||
|
||||
alias xoff='sudo phpdismod -s cli xdebug'
|
||||
alias xon='sudo phpenmod -s cli xdebug'
|
||||
|
||||
alias nrd="npm run dev"
|
||||
alias nrw="npm run watch"
|
||||
alias nrwp="npm run watch-poll"
|
||||
alias nrh="npm run hot"
|
||||
alias nrp="npm run production"
|
||||
|
||||
alias yrd="yarn dev"
|
||||
alias yrw="yarn watch"
|
||||
alias yrwp="yarn watch-poll"
|
||||
alias yrh="yarn hot"
|
||||
alias yrp="yarn production"
|
||||
|
||||
function artisan() {
|
||||
php artisan "$@"
|
||||
}
|
||||
|
||||
function dusk() {
|
||||
pids=$(pidof /usr/bin/Xvfb)
|
||||
|
||||
if [ ! -n "$pids" ]; then
|
||||
Xvfb :0 -screen 0 1280x960x24 &
|
||||
fi
|
||||
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
php artisan dusk
|
||||
else
|
||||
php artisan dusk --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function p() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest "$@"
|
||||
else
|
||||
vendor/bin/phpunit "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function pf() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest --filter "$@"
|
||||
else
|
||||
vendor/bin/phpunit --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function php56() {
|
||||
sudo update-alternatives --set php /usr/bin/php5.6
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config5.6
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize5.6
|
||||
}
|
||||
|
||||
function php70() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.0
|
||||
}
|
||||
|
||||
function php71() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.1
|
||||
}
|
||||
|
||||
function php72() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.2
|
||||
}
|
||||
|
||||
function php73() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.3
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.3
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.3
|
||||
}
|
||||
|
||||
function php74() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.4
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.4
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.4
|
||||
}
|
||||
|
||||
function php80() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.0
|
||||
}
|
||||
|
||||
function php81() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.1
|
||||
}
|
||||
|
||||
function php82() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.2
|
||||
}
|
||||
|
||||
function php83() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.3
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.3
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.3
|
||||
}
|
||||
|
||||
function serve-apache() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/apache.sh
|
||||
sudo bash /vagrant/scripts/site-types/apache.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-apache domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-apache-proxy() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/apache-proxy.sh
|
||||
sudo bash /vagrant/scripts/site-types/apache-proxy.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-apache-proxy domain port"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-laravel() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/laravel.sh
|
||||
sudo bash /vagrant/scripts/site-types/laravel.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-proxy() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/proxy.sh
|
||||
sudo bash /vagrant/scripts/site-types/proxy.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-proxy domain port"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-silverstripe() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/silverstripe.sh
|
||||
sudo bash /vagrant/scripts/site-types/silverstripe.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-silverstripe domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-spa() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/spa.sh
|
||||
sudo bash /vagrant/scripts/site-types/spa.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-spa domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-statamic() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/statamic.sh
|
||||
sudo bash /vagrant/scripts/site-types/statamic.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-statamic domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony2() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/symfony2.sh
|
||||
sudo bash /vagrant/scripts/site-types/symfony2.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony2 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony4() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/symfony4.sh
|
||||
sudo bash /vagrant/scripts/site-types/symfony4.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony4 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-pimcore() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/pimcore.sh
|
||||
sudo bash /vagrant/scripts/site-types/pimcore.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-pimcore domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function share() {
|
||||
if [[ "$1" ]]
|
||||
then
|
||||
ngrok http ${@:2} $1:80 --host-header=rewrite
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " share domain"
|
||||
echo "Invocation with extra params passed directly to ngrok"
|
||||
echo " share domain -region=eu -subdomain=test1234"
|
||||
fi
|
||||
}
|
||||
|
||||
function sshare() {
|
||||
if [[ "$1" ]]
|
||||
then
|
||||
ngrok http ${@:2} $1:443 --host-header=rewrite
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " sshare domain"
|
||||
echo "Invocation with extra params passed directly to ngrok"
|
||||
echo " sshare domain --subdomain=test1234"
|
||||
fi
|
||||
}
|
||||
|
||||
function flip() {
|
||||
sudo bash /vagrant/scripts/flip-webserver.sh
|
||||
}
|
||||
|
||||
function __has_pv() {
|
||||
$(hash pv 2>/dev/null);
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
function __pv_install_message() {
|
||||
if ! __has_pv; then
|
||||
echo $1
|
||||
echo "Install pv with \`sudo apt-get install -y pv\` then run this command again."
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
function dbexport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
# This gives an estimate of the size of the SQL file
|
||||
# It appears that 80% is a good approximation of
|
||||
# the ratio of estimated size to actual size
|
||||
SIZE_QUERY="select ceil(sum(data_length) * 0.8) as size from information_schema.TABLES"
|
||||
|
||||
__pv_install_message "Want to see export progress?"
|
||||
|
||||
echo "Exporting databases to '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
ADJUSTED_SIZE=$(mysql --vertical -uhomestead -psecret -e "$SIZE_QUERY" 2>/dev/null | grep 'size' | awk '{print $2}')
|
||||
HUMAN_READABLE_SIZE=$(numfmt --to=iec-i --suffix=B --format="%.3f" $ADJUSTED_SIZE)
|
||||
|
||||
echo "Estimated uncompressed size: $HUMAN_READABLE_SIZE"
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | pv --size=$ADJUSTED_SIZE | gzip > "$FILE"
|
||||
else
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | gzip > "$FILE"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function dbimport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
__pv_install_message "Want to see import progress?"
|
||||
|
||||
echo "Importing databases from '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
pv "$FILE" --progress --eta | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
else
|
||||
cat "$FILE" | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function xphp() {
|
||||
(php -m | grep -q xdebug)
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
XDEBUG_ENABLED=true
|
||||
else
|
||||
XDEBUG_ENABLED=false
|
||||
fi
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xon; fi
|
||||
|
||||
HOST_IP=$(last --limit=1 | grep -oP '\d+(\.\d+){3}')
|
||||
|
||||
php \
|
||||
-dxdebug.client_host=${HOST_IP} \
|
||||
-dxdebug.start_with_request=yes \
|
||||
"$@"
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xoff; fi
|
||||
}
|
53
resources/localized/Vagrantfile
vendored
Normal file
53
resources/localized/Vagrantfile
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
|
||||
VAGRANTFILE_API_VERSION ||= "2"
|
||||
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
|
||||
|
||||
homesteadYamlPath = File.expand_path("Homestead.yaml", File.dirname(__FILE__))
|
||||
homesteadJsonPath = File.expand_path("Homestead.json", File.dirname(__FILE__))
|
||||
afterScriptPath = "after.sh"
|
||||
customizationScriptPath = "user-customizations.sh"
|
||||
aliasesPath = "aliases"
|
||||
|
||||
require File.expand_path(confDir + '/scripts/homestead.rb')
|
||||
|
||||
Vagrant.require_version '>= 2.2.4'
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
if File.exist? aliasesPath then
|
||||
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
|
||||
config.vm.provision "shell" do |s|
|
||||
s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases"
|
||||
end
|
||||
end
|
||||
|
||||
if File.exist? homesteadYamlPath then
|
||||
settings = YAML::load(File.read(homesteadYamlPath))
|
||||
elsif File.exist? homesteadJsonPath then
|
||||
settings = JSON::parse(File.read(homesteadJsonPath))
|
||||
else
|
||||
abort "Homestead settings file not found in " + File.dirname(__FILE__)
|
||||
end
|
||||
|
||||
Homestead.configure(config, settings)
|
||||
|
||||
if File.exist? afterScriptPath then
|
||||
config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
|
||||
end
|
||||
|
||||
if File.exist? customizationScriptPath then
|
||||
config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
|
||||
end
|
||||
|
||||
if Vagrant.has_plugin?('vagrant-hostsupdater')
|
||||
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
|
||||
elsif Vagrant.has_plugin?('vagrant-hostmanager')
|
||||
config.hostmanager.enabled = true
|
||||
config.hostmanager.manage_host = true
|
||||
config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
|
||||
end
|
||||
end
|
321
resources/localized/aliases
Normal file
321
resources/localized/aliases
Normal file
@@ -0,0 +1,321 @@
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
|
||||
alias h='cd ~'
|
||||
alias c='clear'
|
||||
alias art=artisan
|
||||
|
||||
alias codecept='vendor/bin/codecept'
|
||||
alias phpspec='vendor/bin/phpspec'
|
||||
alias serve=serve-laravel
|
||||
|
||||
alias xoff='sudo phpdismod -s cli xdebug'
|
||||
alias xon='sudo phpenmod -s cli xdebug'
|
||||
|
||||
function artisan() {
|
||||
php artisan "$@"
|
||||
}
|
||||
|
||||
function dusk() {
|
||||
pids=$(pidof /usr/bin/Xvfb)
|
||||
|
||||
if [ ! -n "$pids" ]; then
|
||||
Xvfb :0 -screen 0 1280x960x24 &
|
||||
fi
|
||||
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
php artisan dusk
|
||||
else
|
||||
php artisan dusk --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function p() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest "$@"
|
||||
else
|
||||
vendor/bin/phpunit "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function pf() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest --filter "$@"
|
||||
else
|
||||
vendor/bin/phpunit --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function php56() {
|
||||
sudo update-alternatives --set php /usr/bin/php5.6
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config5.6
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize5.6
|
||||
}
|
||||
|
||||
function php70() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.0
|
||||
}
|
||||
|
||||
function php71() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.1
|
||||
}
|
||||
|
||||
function php72() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.2
|
||||
}
|
||||
|
||||
function php73() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.3
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.3
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.3
|
||||
}
|
||||
|
||||
function php74() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.4
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.4
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.4
|
||||
}
|
||||
|
||||
function php80() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.0
|
||||
}
|
||||
|
||||
function php81() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.1
|
||||
}
|
||||
|
||||
function php82() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.2
|
||||
}
|
||||
|
||||
function serve-apache() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/apache.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/apache.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-apache domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-laravel() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/laravel.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/laravel.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-proxy() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/proxy.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/proxy.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-proxy domain port"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-silverstripe() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/silverstripe.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/silverstripe.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-silverstripe domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-spa() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/spa.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/spa.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-spa domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-statamic() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/statamic.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/statamic.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-statamic domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony2() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/symfony2.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/symfony2.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony2 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony4() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/symfony4.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/symfony4.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony4 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-pimcore() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/pimcore.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/pimcore.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-pimcore domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function share() {
|
||||
if [[ "$1" ]]
|
||||
then
|
||||
ngrok http ${@:2} $1:80
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " share domain"
|
||||
echo "Invocation with extra params passed directly to ngrok"
|
||||
echo " share domain -region=eu -subdomain=test1234"
|
||||
fi
|
||||
}
|
||||
|
||||
function flip() {
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/flip-webserver.sh
|
||||
}
|
||||
|
||||
function __has_pv() {
|
||||
$(hash pv 2>/dev/null);
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
function __pv_install_message() {
|
||||
if ! __has_pv; then
|
||||
echo $1
|
||||
echo "Install pv with \`sudo apt-get install -y pv\` then run this command again."
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
function dbexport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
# This gives an estimate of the size of the SQL file
|
||||
# It appears that 80% is a good approximation of
|
||||
# the ratio of estimated size to actual size
|
||||
SIZE_QUERY="select ceil(sum(data_length) * 0.8) as size from information_schema.TABLES"
|
||||
|
||||
__pv_install_message "Want to see export progress?"
|
||||
|
||||
echo "Exporting databases to '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
ADJUSTED_SIZE=$(mysql --vertical -uhomestead -psecret -e "$SIZE_QUERY" 2>/dev/null | grep 'size' | awk '{print $2}')
|
||||
HUMAN_READABLE_SIZE=$(numfmt --to=iec-i --suffix=B --format="%.3f" $ADJUSTED_SIZE)
|
||||
|
||||
echo "Estimated uncompressed size: $HUMAN_READABLE_SIZE"
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | pv --size=$ADJUSTED_SIZE | gzip > "$FILE"
|
||||
else
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | gzip > "$FILE"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function dbimport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
__pv_install_message "Want to see import progress?"
|
||||
|
||||
echo "Importing databases from '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
pv "$FILE" --progress --eta | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
else
|
||||
cat "$FILE" | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function xphp() {
|
||||
(php -m | grep -q xdebug)
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
XDEBUG_ENABLED=true
|
||||
else
|
||||
XDEBUG_ENABLED=false
|
||||
fi
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xon; fi
|
||||
|
||||
php \
|
||||
-dxdebug.client_host=192.168.10.1 \
|
||||
-dxdebug.start_with_request=yes \
|
||||
"$@"
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xoff; fi
|
||||
}
|
||||
|
||||
function update-socket-wrench() {
|
||||
cd /var/www/socket-wrench
|
||||
git pull origin release
|
||||
composer install
|
||||
php artisan migrate --force
|
||||
}
|
||||
|
||||
function seed-socket-wrench() {
|
||||
cd /var/www/socket-wrench
|
||||
php artisan db:seed
|
||||
}
|
Reference in New Issue
Block a user