Skip to content

Commit

Permalink
Merge branch 'main' into feature-pdo-pgsql
Browse files Browse the repository at this point in the history
  • Loading branch information
leocavalcante authored Mar 13, 2024
2 parents 0457bb3 + 98e3f5a commit b5de407
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 82 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,25 @@
Seamlessly run and switch between different versions of PHP, with different installed extensions, thanks to the power of containers.
Take the advantage of goodie commands like `phpctl create` to start a new project, `phpctl repl` to start a REPL, `phpctl init` to initialize a new configuration file **and a lot more**.

### Just install
```shell
/bin/bash -c "$(curl -fsSL https://phpctl.dev/install.sh)"
```
### And that is it!
Try it out:
```shell
phpctl doctor
php --version
composer --version
```

## Getting started

- [Installation](https://phpctl.dev/#installation)
- [Usage](https://phpctl.dev/#usage)
- [Installation guide](https://phpctl.dev/#installation)
- [How to use](https://phpctl.dev/#usage)
- [Available commands](https://phpctl.dev/commands)
- [The `.phpctlrc` file](https://phpctl.dev/phpctlrc)
- [The `phpctl.ini` file](https://phpctl.dev/phpctlini)
- [Available extensions](https://phpctl.dev/extensions)
- [Why it exists?](https://phpctl.dev/why)

Expand Down
5 changes: 2 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ Take the advantage of goodies commands like `phpctl create` to start a new proje
### Installation

```shell
wget -q https://phpctl.dev/phpctl-installer.sh && \
bash phpctl-installer.sh && rm phpctl-installer.sh
/bin/bash -c "$(curl -fsSL https://phpctl.dev/install.sh)"
```

**That is it!** Now you have `phpctl` available in your system.

#### Custom installation
You can also pass an argument to install at a custom location (e.g. `~/bin`), but you have to make sure that folder is in your `$PATH` variable.
```shell
bash phpctl-installer.sh ~/bin
/bin/bash -c "$(curl -fsSL https://phpctl.dev/install.sh)" ~/bin
```

#### Homebrew
Expand Down
10 changes: 5 additions & 5 deletions docs/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi
echo -e "\033[0;33mInstalling phpctl at \033[0m$INSTALL_DIR"
if [ -d "$INSTALL_DIR" ]; then
echo "The install directory is not empty. Attempting to remove it..."
rm -rI $INSTALL_DIR
rm -rf $INSTALL_DIR
fi

echo -n ""
Expand All @@ -32,15 +32,15 @@ if [ -z "$1" ]; then
else
echo -n "Files will be symlinked to ${SYMLINK_DIR}."
fi
echo -e -n " \033[0;32mDo you want to continue? (y/n)\033[0m "
echo -e -n " \033[0;32mDo you want to continue? (Y/n)\033[0m "
read -r answer
if [ "$answer" != "${answer#[Yy]}" ]; then
$SUDO ${INSTALL_DIR}/scripts/symlink-bins.sh ${INSTALL_DIR}
else
if [ "$answer" != "${answer#[Nn]}" ]; then
echo -e "\033[0;31mTo use phpctl globally, link the cloned script to your bin directory, like:\033[0m"
echo ""
for file in "${INSTALL_DIR}"/bin/*; do
bin=$(basename "$file")
echo " ${SUDO} ln -sf ${INSTALL_DIR}/bin/$bin ${SYMLINK_DIR}/$bin"
done
else
$SUDO ${INSTALL_DIR}/scripts/symlink-bins.sh ${INSTALL_DIR}
fi
46 changes: 0 additions & 46 deletions docs/phpctl-installer.sh

This file was deleted.

19 changes: 2 additions & 17 deletions tests/install/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
.PHONY: default
default: build run

.PHONY: build
build:
docker build -t phpctl-${OS}-test -f ${OS}.Dockerfile .

.PHONY: run
run:
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock phpctl-${OS}-test bash

.PHONY: install
install:
wget -q https://phpctl.dev/phpctl-installer.sh && \
bash phpctl-installer.sh && rm phpctl-installer.sh
@parallel --line-buffer ./build {} ::: alpine archlinux ubuntu

.PHONY: test
test:
ls -lha /usr/local/bin
phpctl doctor
php --version
composer --version
@parallel --line-buffer ./test {} ::: alpine archlinux ubuntu
6 changes: 3 additions & 3 deletions tests/install/alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine
RUN apk add bash docker git make openssl sudo
WORKDIR /usr/local/src
COPY Makefile .
RUN apk add bash curl docker git make neofetch openssl sudo
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
6 changes: 3 additions & 3 deletions tests/install/archlinux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM archlinux
RUN pacman -Syu --noconfirm docker make wget sudo git
WORKDIR /usr/local/src
COPY Makefile .
RUN pacman -Syu --noconfirm curl docker git make neofetch sudo
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
4 changes: 4 additions & 0 deletions tests/install/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
echo -e "[$1] \033[0;32mBuilding...\033[0m"
docker build -t "phpctl-$1-test" -f "$1.Dockerfile" . &> /dev/null
echo -e "[$1] \033[0;32mDone!\033[0m"
7 changes: 7 additions & 0 deletions tests/install/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
neofetch
/bin/bash -c "$(curl -fsSL https://phpctl.dev/install.sh)"
echo ""
notty phpctl doctor
notty php --version
notty composer --version
3 changes: 3 additions & 0 deletions tests/install/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
echo -e "[$1] \033[0;32mTesting...\033[0m"
echo -e "$(docker run --rm -v /var/run/docker.sock:/var/run/docker.sock "phpctl-$1-test")"
6 changes: 3 additions & 3 deletions tests/install/ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu
RUN apt update && apt install -y bash docker.io git make openssl sudo wget
WORKDIR /usr/local/src
COPY Makefile .
RUN apt update && apt install -y bash curl docker.io git make neofetch openssl sudo
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]

0 comments on commit b5de407

Please sign in to comment.