Skip to content

Commit

Permalink
refactor: Binaries directory
Browse files Browse the repository at this point in the history
  • Loading branch information
leocavalcante committed Dec 14, 2023
1 parent 8c9d906 commit ff33ded
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ test:

.PHONY: install
install:
@sudo ln -sf $(shell pwd)/composer /usr/local/bin/composer
@sudo ln -sf $(shell pwd)/php /usr/local/bin/php
@sudo ln -sf $(shell pwd)/phpctl /usr/local/bin/pctl
@sudo ln -sf $(shell pwd)/phpctl /usr/local/bin/phpctl
@sudo ln -sf $(shell pwd)/phpunit /usr/local/bin/phpunit
@sudo ln -sf $(shell pwd)/bin/composer /usr/local/bin/composer
@sudo ln -sf $(shell pwd)/bin/php /usr/local/bin/php
@sudo ln -sf $(shell pwd)/bin/phpctl /usr/local/bin/pctl
@sudo ln -sf $(shell pwd)/bin/phpctl /usr/local/bin/phpctl
@sudo ln -sf $(shell pwd)/bin/phpunit /usr/local/bin/phpunit
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion phpctl → bin/phpctl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
PHPCTL_DIR=$(dirname "$(realpath "$0")")
PHPCTL_DIR=$(dirname "$(realpath "$0")")/../
if [ -s .phpctlrc ]; then
set -a
. .phpctlrc
Expand Down
File renamed without changes.
20 changes: 10 additions & 10 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
INSTALL_DIR=~/.phpctl

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

echo "\033[0;33mInstalling phpctl at \033[0m$INSTALL_DIR"
Expand All @@ -21,10 +21,10 @@ if [ "$answer" != "${answer#[Yy]}" ]; then
else
echo "\033[0;31mTo use phpclt globally, link the cloned script to your bin directory, like:\033[0m"
echo ""
echo " sudo ln -sf ${INSTALL_DIR}/composer /usr/local/bin/composer"
echo " sudo ln -sf ${INSTALL_DIR}/php /usr/local/bin/php"
echo " sudo ln -sf ${INSTALL_DIR}/phpctl /usr/local/bin/pctl"
echo " sudo ln -sf ${INSTALL_DIR}/phpctl /usr/local/bin/phpctl"
echo " sudo ln -sf ${INSTALL_DIR}/phpunit /usr/local/bin/phpunit"
echo " sudo ln -sf ${INSTALL_DIR}/bin/composer /usr/local/bin/composer"
echo " sudo ln -sf ${INSTALL_DIR}/bin/php /usr/local/bin/php"
echo " sudo ln -sf ${INSTALL_DIR}/bin/phpctl /usr/local/bin/pctl"
echo " sudo ln -sf ${INSTALL_DIR}/bin/phpctl /usr/local/bin/phpctl"
echo " sudo ln -sf ${INSTALL_DIR}/bin/phpunit /usr/local/bin/phpunit"
echo ""
fi
2 changes: 1 addition & 1 deletion tests/doctor_test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
function test_doctor() {
assert_contains "PHPCTL_IMAGE=" "$(./phpctl doctor)"
assert_contains "PHPCTL_IMAGE=" "$(./bin/phpctl doctor)"
}
2 changes: 1 addition & 1 deletion tests/help_test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
function test_help_is_default() {
assert_contains "phpctl <command> [arguments]" "$(./phpctl)"
assert_contains "phpctl <command> [arguments]" "$(./bin/phpctl)"
}
8 changes: 4 additions & 4 deletions tests/php_test.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
function test_php_version_is_default() {
assert_contains "Copyright (c) The PHP Group" "$(./phpctl php)"
assert_contains "Copyright (c) The PHP Group" "$(./bin/phpctl php)"
}

function test_php_accepts_arguments() {
assert_contains "[PHP Modules]" "$(./phpctl php -m)"
assert_contains "Configuration File (php.ini) " "$(./phpctl php --ini)"
assert_contains "[PHP Modules]" "$(./bin/phpctl php -m)"
assert_contains "Configuration File (php.ini) " "$(./bin/phpctl php --ini)"
}

function test_composer() {
assert_contains "version" "$(./phpctl composer --version)"
assert_contains "version" "$(./bin/phpctl composer --version)"
}
4 changes: 2 additions & 2 deletions tests/sh_test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function test_sh_commands() {
assert_contains "/opt" "$(./phpctl sh pwd)"
assert_contains "test" "$(./phpctl sh echo test)"
assert_contains "/opt" "$(./bin/phpctl sh pwd)"
assert_contains "test" "$(./bin/phpctl sh echo test)"
}

0 comments on commit ff33ded

Please sign in to comment.