Skip to content

Commit

Permalink
refactor(installer): Improved
Browse files Browse the repository at this point in the history
  • Loading branch information
leocavalcante committed Dec 6, 2023
1 parent 677b9e3 commit c9aeab2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

### Install
```shell
wget https://raw.githubusercontent.com/opencodeco/phpctl/main/installer.sh -qO- | sh
wget https://raw.githubusercontent.com/opencodeco/phpctl/main/installer.sh -qO- | bash
```

## Usage
Expand Down Expand Up @@ -48,17 +48,12 @@ phpctl sh echo 'Hello, World!' # To run arbitrary sh commands inside the contain
| `server [port] [directory]` | Runs PHP's built-in web-server (default port is `80` and default directory is current `.`). |

### Useful
| Command | Description |
|-------------------|----------------------------------------------------------------------|
| `sh [commands]` | Starts an interactive Shell session or runs `sh` commands. |
| `repl` | Starts a PHP REPL session (powered by [PsySH](https://psysh.org/)). |
| `fix [arguments]` | Runs PHP CS Fixer on the given directory. |

### Starters
| Command | Description |
|------------------------------|---------------------------------------------------------------------|
| `install` | Installs `phpctl` (and `pctl`) globally in your system. |
| `new [template] [directory]` | Creates a new project from a template (`composer create-project`). |
| Command | Description |
|------------------------------|------------------------------------------------------------------------|
| `sh [commands]` | Starts an interactive Shell session or runs `sh` commands. |
| `repl` | Starts a PHP REPL session (powered by [PsySH](https://psysh.org/)). |
| `fix [arguments]` | Runs PHP CS Fixer on the given directory. |
| `new [template] [directory]` | Creates a new project from a template (`composer create-project`). |

### Helpers
| Command | Description |
Expand Down
24 changes: 20 additions & 4 deletions installer.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
#!/usr/bin/env sh
git clone https://github.com/opencodeco/phpctl.git ~/.phpctl
cd ~/.phpctl
./phpctl install
#!/usr/bin/env bash

INSTALL_DIR=~/.phpctl

symlink() {
sudo ln -sf "${INSTALL_DIR}/phpctl" /usr/local/bin/phpctl
sudo ln -sf "${INSTALL_DIR}/phpctl" /usr/local/bin/pctl
}

echo -e "\033[0;33mInstalling phpctl at \033[0m$INSTALL_DIR"
rm -rf $INSTALL_DIR
git clone --quiet https://github.com/opencodeco/phpctl.git $INSTALL_DIR

echo -e "Sudo will be prompted to symlink the phpctl files. \033[0;32mDo you want to continue?\033[0m"
select yn in "Yes" "No"; do
case $yn in
Yes ) symlink; break;;
No ) exit;;
esac
done
1 change: 0 additions & 1 deletion src/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ help() {
echo -e "\033[0;32m sh [commands] \033[0m Starts an interactive Shell session or runs sh commands"
echo -e "\033[0;32m repl \033[0m Starts a PHP REPL session (powered by PsySH)"
echo -e "\033[0;32m fix [arguments] \033[0m Runs PHP CS Fixer on the given directory."
echo -e "\033[0;32m install \033[0m Installs phpctl (and pctl) globally in you system"
echo -e "\033[0;32m new [template] [directory] \033[0m Creates a new project from a template (composer create-project)"
echo -e "\033[0;32m help or man \033[0m Displays this help message"
echo -e "\033[0;32m doctor \033[0m Inspects the current PHP_VERSION and PHPCTL_IMAGE"
Expand Down
4 changes: 0 additions & 4 deletions src/install.sh

This file was deleted.

0 comments on commit c9aeab2

Please sign in to comment.