From 224f6b4abc6ccfe209c677445ec0257ceefc4d64 Mon Sep 17 00:00:00 2001 From: 3onyc <3onyc@x3tech.com> Date: Sun, 21 Aug 2016 18:46:30 +0200 Subject: [PATCH 1/4] Don't hide output from 'git pull' command --- bin/phpenv-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/phpenv-install.sh b/bin/phpenv-install.sh index f639138..3fcafbb 100755 --- a/bin/phpenv-install.sh +++ b/bin/phpenv-install.sh @@ -48,7 +48,7 @@ update_phpenv() { local cwd=$(pwd) cd "$install_location" - git pull origin master &> /dev/null + git pull origin master cd "$cwd" } From aa1e1567f1f84be29256ca9eeeb03ba7ae886989 Mon Sep 17 00:00:00 2001 From: 3onyc <3onyc@x3tech.com> Date: Sun, 21 Aug 2016 18:47:17 +0200 Subject: [PATCH 2/4] Move sed replacements into function --- bin/phpenv-install.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/bin/phpenv-install.sh b/bin/phpenv-install.sh index 3fcafbb..eb93f21 100755 --- a/bin/phpenv-install.sh +++ b/bin/phpenv-install.sh @@ -58,6 +58,19 @@ clone_rbenv() { git clone "$RBENV_REPO" "$install_location" > /dev/null } +replace_rbenv() { + local install_location="$1" + + sed -i -e 's/rbenv/phpenv/g' "$install_location"/completions/rbenv.{bash,zsh} + sed -i -s 's/\.rbenv-version/.phpenv-version/g' "$install_location"/libexec/rbenv-local + sed -i -s 's/\.rbenv-version/.phpenv-version/g' "$install_location"/libexec/rbenv-version-file + sed -i -s 's/\.ruby-version/.php-version/g' "$install_location"/libexec/rbenv-local + sed -i -s 's/\.ruby-version/.php-version/g' "$install_location"/libexec/rbenv-version-file + sed -i -e 's/\(^\|[^/]\)rbenv/\1phpenv/g' "$install_location"/libexec/rbenv-init + sed -i -e 's/\phpenv-commands/rbenv-commands/g' "$install_location"/libexec/rbenv-init + sed -i -e 's/\Ruby/PHP/g' "$install_location"/libexec/rbenv-which +} + if [ -z "$PHPENV_ROOT" ]; then PHPENV_ROOT="$HOME/.phpenv" fi @@ -73,14 +86,7 @@ else echo "Installing phpenv in $PHPENV_ROOT" if [ "$CHECKOUT" = "yes" ]; then clone_rbenv "$PHPENV_ROOT" - sed -i -e 's/rbenv/phpenv/g' "$PHPENV_ROOT"/completions/rbenv.{bash,zsh} - sed -i -s 's/\.rbenv-version/.phpenv-version/g' "$PHPENV_ROOT"/libexec/rbenv-local - sed -i -s 's/\.rbenv-version/.phpenv-version/g' "$PHPENV_ROOT"/libexec/rbenv-version-file - sed -i -s 's/\.ruby-version/.php-version/g' "$PHPENV_ROOT"/libexec/rbenv-local - sed -i -s 's/\.ruby-version/.php-version/g' "$PHPENV_ROOT"/libexec/rbenv-version-file - sed -i -e 's/\(^\|[^/]\)rbenv/\1phpenv/g' "$PHPENV_ROOT"/libexec/rbenv-init - sed -i -e 's/\phpenv-commands/rbenv-commands/g' "$PHPENV_ROOT"/libexec/rbenv-init - sed -i -e 's/\Ruby/PHP/g' "$PHPENV_ROOT"/libexec/rbenv-which + replace_rbenv "$PHPENV_ROOT" fi fi From 9e3736879d91781ea8aae4e7a240401cc8ffb331 Mon Sep 17 00:00:00 2001 From: 3onyc <3onyc@x3tech.com> Date: Sun, 21 Aug 2016 18:47:51 +0200 Subject: [PATCH 3/4] Fix update functionality --- bin/phpenv-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/phpenv-install.sh b/bin/phpenv-install.sh index eb93f21..5530c92 100755 --- a/bin/phpenv-install.sh +++ b/bin/phpenv-install.sh @@ -48,6 +48,7 @@ update_phpenv() { local cwd=$(pwd) cd "$install_location" + git checkout . git pull origin master cd "$cwd" @@ -82,6 +83,7 @@ fi if [ "$UPDATE" = "yes" ]; then echo "Updating phpenv in $PHPENV_ROOT" update_phpenv "$PHPENV_ROOT" + replace_rbenv "$PHPENV_ROOT" else echo "Installing phpenv in $PHPENV_ROOT" if [ "$CHECKOUT" = "yes" ]; then From 27c64eac03e79854dcd3e155e8aa12e249ea5002 Mon Sep 17 00:00:00 2001 From: 3onyc <3onyc@x3tech.com> Date: Sun, 21 Aug 2016 18:50:50 +0200 Subject: [PATCH 4/4] Replace RBENV_VERSION env vars with PHPENV_VERSION --- bin/phpenv-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/phpenv-install.sh b/bin/phpenv-install.sh index 5530c92..7eb390d 100755 --- a/bin/phpenv-install.sh +++ b/bin/phpenv-install.sh @@ -70,6 +70,7 @@ replace_rbenv() { sed -i -e 's/\(^\|[^/]\)rbenv/\1phpenv/g' "$install_location"/libexec/rbenv-init sed -i -e 's/\phpenv-commands/rbenv-commands/g' "$install_location"/libexec/rbenv-init sed -i -e 's/\Ruby/PHP/g' "$install_location"/libexec/rbenv-which + sed -i -e 's/RBENV_VERSION/PHPENV_VERSION/g' "$PHPENV_ROOT"/libexec/rbenv-* } if [ -z "$PHPENV_ROOT" ]; then