Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 0 additions & 118 deletions .bash_xp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
XP_TOOLS_DIR=~/tools/Magento-2-Bash-Localhost-Installation-Script

function phpswitch() {
bash "$XP_TOOLS_DIR/phpswitch.sh" $1
}

function create_website() {
bash "$XP_TOOLS_DIR/install.sh" $1 $2 $3 $4
}
Expand All @@ -28,10 +24,6 @@ function update_modules() {
bash "$XP_TOOLS_DIR/update_modules.sh"
}

function code_quality() {
bash "$XP_TOOLS_DIR/code_quality.sh" $1 $2 $3
}

function import_website() {
bash "$XP_TOOLS_DIR/import.sh" $1
}
Expand All @@ -40,116 +32,6 @@ function update_website() {
bash "$XP_TOOLS_DIR/update.sh" $1
}

function git_import_website() {
bash "$XP_TOOLS_DIR/git_import.sh" $1 $2
}

function replace_images() {
bash "$XP_TOOLS_DIR/replace_images.sh" $1
}

#source "$XP_TOOLS_DIR/environment_tools.sh"

_site ()
{
local cur=${COMP_WORDS[COMP_CWORD]};
COMPREPLY=($(compgen -W "$(ls ~/domains)" -- $cur))
}

site ()
{
if [ $# -eq 0 ]; then
DOMAIN=`pwd | cut --delimiter="/" -f 5`;
else
DOMAIN="$@";
fi;
if [ -d ~/domains/$DOMAIN ]; then
cd ~/domains/$DOMAIN;
else
echo "Given website does not exists";
fi
}
complete -F _site site

bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

# Magerun aliasses
alias m='magerun'
alias m2='magerun2'
alias mc='magento-cloud'
alias c='php bin/connector'
alias cf='$COMPOSER_HOME/vendor/bin/cache-clean.js'
alias b='php bin/magento'
alias s='php bin/console'

# PHP aliasses
alias php7='php7.0'
alias composer7='php7 /usr/bin/composer'
alias php71='php7.1'
alias composer71='php71 /usr/bin/composer'

# PhpStorm aliasses
alias p='phpstorm'

# PHPX - Xdebug
alias phpx='XDEBUG_CONFIG="idekey=PHPSTORM" php -dxdebug.remote_enable=on -f'
alias xphp='XDEBUG_CONFIG="idekey=PHPSTORM" php -dxdebug.remote_enable=on -f'
alias phpx7='XDEBUG_CONFIG="idekey=PHPSTORM" php7.0 -dxdebug.remote_enable=on -f'
alias xphp7='XDEBUG_CONFIG="idekey=PHPSTORM" php7.0 -dxdebug.remote_enable=on -f'
alias xb='phpx bin/magento'
alias bx='phpx bin/magento'
alias xc='phpx bin/connector'
alias cx='phpx bin/connector'
alias sx='phpx bin/console'
alias xs='phpx bin/console'

# Git aliasses
alias gs='git status'
alias gc='git commit'
alias ga='git add'
alias gb='git branch'
alias gl='git log'
alias gco='git checkout'
alias gcom='git checkout master'
alias gam='git commit --amend --no-edit'
alias gp='git push'
alias gpom='git push origin master'
alias gm='git merge'
alias gd='git diff'

# Composer Lib Development alias
alias cld='composer_lib_development'

# Update Developer Programs Linux
alias update_postman='sudo rm -rf /opt/Postman/; wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz; sudo tar -xzf postman.tar.gz -C /opt; rm postman.tar.gz'

# Environment tools
alias emnt=mount_site
alias eumnt=umount_site
alias edbg=debug_site

# Custom prompt
function parse_git_branch() { # Git Branch
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
echo "[${BRANCH}]"
else
echo ""
fi
}

function parse_git_tag() { # Git Tag
TAG=`git describe --abbrev=0 --tags 2> /dev/null`
if [ ! "${TAG}" == "" ]
then
echo "[${TAG}]"
else
echo ""
fi
}

# PS1 Line
PS1="\[\e[00;33m\]\u\[\e[0m\]\[\e[00;37m\]@\h:\[\e[0m\]\[\e[0;31m\]\`parse_git_branch\`\[\e[m\]\[\e[0m\]\[\e[0;38m\]\`parse_git_tag\`\[\e[m\]\[\e[00;36m\][\w]\[\e[0m\]\[\e[00;32m\]\nbash> \[\e[0m\]"
export COMPOSER_HOME=~/.composer
129 changes: 1 addition & 128 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,7 @@ Make a copy of the config.sample.sh file, rename it to config.sh and update acco

### Different PHP Versions Support

Magento 2.1 requires php7.0 but Magento 2.3 requires php7.1. To run both environments you have to create a switch in your NGINX but also in the installation.

Set the PHP7 and COMPOSER_PHP7 variables in the config.sh.

Additional information:

- Install Different PHP Versions see for Example for Ubuntu:
https://www.tecmint.com/install-different-php-versions-in-ubuntu/
- Alternative switch PHP version for Linux users:
- after installing different versions of php-fpm use the following command to switch php-version:
```phpswitch 7.0```
- Make a manual switch in NGINX
- Set the fastcgi_pass for Magento 2.1
- fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
- Set the fastcgi_pass for Magento 2.3
- fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
- **IMPORTANT: Magento 2.2 can fun on both php versions**
**Deprecated: just use `valet use 7.2`**

### Use the simplified aliases
Include .bash_xp in .bashrc or .bash_aliases, include example:
Expand All @@ -48,11 +32,6 @@ fi
- [Create Website](#create-website)
- [Add Module](#add-module)
- [Update Modules](#update-modules)
- [Code Quality Scan](#code-quality-scan)
- [Site Search Command](#site-search-command)
- [Composer Lib Development](#composer-lib-development)
- [Aliases](#aliases)
- [Githooks](#githooks)



Expand Down Expand Up @@ -131,29 +110,6 @@ usage (run in Magento 2 Root):
update_modules
```


### Code Quality Scan

```
$1 = path
$2 = severity
$3 = mode ('fix' will run phpcbf)
```

```
code_quality $1 $2 $3
```

usage (run in Magento 2 Root):

```
code_quality app/code/MyModule/Helloworld 7
```

```
code_quality app/code/MyModule/Helloworld 7 fix
```

### Import Website from Backup
**This feature also supports import for a Magento 1 Webshop**

Expand All @@ -172,95 +128,12 @@ Requires the following files to be in the destination domain folder: structure.s
update_website name
```

### Site Search Command
When you have installed your websites in ~/domains you can search through them with the following command. This functionality also supports autofill.

```
site <domain>
```

### Composer Lib Development

If you want to use the composer_lib_development command to make symbolic links for vendor modules follow the following steps:

```
1. sudo ln -s ~/tools/Magento-2-Bash-Localhost-Installation-Script/composer_lib_development /usr/local/bin/composer_lib_development
2. sudo chmod +x /usr/local/bin/composer_lib_development

```

Now run the command from the Magento root:

```
composer_lib_development
```

*Additional Alias is `cld`


### Aliases
#### Magerun aliasses
```
alias m='magerun'
alias m2='magerun2'
```

#### PHP aliases
```
alias php7='php7.0'
alias composer7='php7 /usr/bin/composer'
alias php71='php7.1'
alias composer71='php71 /usr/bin/composer'
```

#### PhpStorm aliasses
```
alias p='phpstorm'
```

#### PHPX - Xdebug
```
alias phpx='XDEBUG_CONFIG="idekey=PHPSTORM" php -dxdebug.remote_enable=on -f'
alias xphp='XDEBUG_CONFIG="idekey=PHPSTORM" php -dxdebug.remote_enable=on -f'
alias phpx7='XDEBUG_CONFIG="idekey=PHPSTORM" php7.0 -dxdebug.remote_enable=on -f'
alias xphp7='XDEBUG_CONFIG="idekey=PHPSTORM" php7.0 -dxdebug.remote_enable=on -f'
```

#### Git aliasses
```
alias gs='git status'
alias gc='git commit'
alias ga='git add'
alias gb='git branch'
alias gl='git log'
alias gco='git checkout'
alias gcom='git checkout master'
alias gam='git commit --amend --no-edit'
alias gp='git push'
alias gpom='git push origin master'
alias gm='git merge'
alias gd='git diff'
```

#### Composer Lib Development alias
```
alias cld='composer_lib_development'
```


#### Update Developer Programs Linux
```
alias update_postman='sudo rm -rf /opt/Postman/; wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz; sudo tar -xzf postman.tar.gz -C /opt; rm postman.tar.gz'
```

### Githooks
Added a simple pre-push githook to generate a CHANGELOG.md based on git version tags.

Start using the githooks of this repository by running the following command:
```
git config --global core.hooksPath ~/tools/Magento-2-Bash-Localhost-Installation-Script/githooks
```

### NFS

Please install mage2tv/magento-cache-clean globally with composer so you can enable all cache and just run cf -w
Expand Down
31 changes: 0 additions & 31 deletions code_quality.sh

This file was deleted.

Loading