From f2660a6e070fc7ecf67b975d9b05f74c1bff4521 Mon Sep 17 00:00:00 2001 From: Mathilde Date: Thu, 23 Jan 2025 11:17:17 +0100 Subject: [PATCH 1/4] update dev installation --- Dockerfile | 3 ++- Makefile | 9 ++++++++- README.md | 2 ++ docker-compose.yml | 5 ++--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 61610d9..54e4ed0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,5 @@ RUN echo 'APT::Install-Recommends "0" ; APT::Install-Suggests "0" ;' > /etc/apt/ apt-get --yes autoremove --purge && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -COPY --from=composer:2 /usr/bin/composer /usr/bin/composer +# Install Composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ No newline at end of file diff --git a/Makefile b/Makefile index 4441199..07798b1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,13 @@ .PHONY: test -DOCKER_RUN = docker-compose run --rm php +DOCKER_COMPOSE = docker compose +DOCKER_RUN = $(DOCKER_COMPOSE) run --rm php + +install: + $(DOCKER_COMPOSE) build --no-cache + +up: + $(DOCKER_COMPOSE) up --remove-orphans -d --build vendor: ${DOCKER_RUN} composer install --no-interaction diff --git a/README.md b/README.md index d88fe34..07d503b 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ You can develop out of the box thanks to the provided `docker-compose.yml` and ` To install the app: ```bash + $ make install + $ make up $ make vendor ``` diff --git a/docker-compose.yml b/docker-compose.yml index be92ae9..888bf99 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,10 @@ -version: '3' - services: php: build: context: . - image: php:8.1-cli container_name: coupling_detector volumes: - ./:/opt/app + - '${HOST_COMPOSER_CACHE_DIR:-~/.cache/composer}:/home/composer/.cache/composer' + - '${HOST_COMPOSER_HOME:-~/.config/composer}:/home/composer/.config/composer' working_dir: /opt/app From 17fed3e877b2999dd588733a3a5edeefde182c26 Mon Sep 17 00:00:00 2001 From: Mathilde Date: Thu, 23 Jan 2025 11:28:42 +0100 Subject: [PATCH 2/4] fix command signature --- src/Console/Command/DetectCommand.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Console/Command/DetectCommand.php b/src/Console/Command/DetectCommand.php index 893b88a..2d53211 100644 --- a/src/Console/Command/DetectCommand.php +++ b/src/Console/Command/DetectCommand.php @@ -68,7 +68,7 @@ protected function configure() /** * {@inheritedDoc}. */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $output->setFormatter(new OutputFormatter($output->isDecorated())); @@ -115,10 +115,8 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * @param ViolationInterface[] $violations - * - * @return int */ - private function determineExitCode(array $violations) + private function determineExitCode(array $violations): int { if (0 === count($violations)) { return 0; @@ -137,10 +135,8 @@ private function determineExitCode(array $violations) /** * @param string $filePath - * - * @return Configuration */ - private function loadConfiguration($filePath) + private function loadConfiguration($filePath): Configuration { if (!is_file($filePath)) { throw new \InvalidArgumentException(sprintf('The configuration file "%s" does not exit', $filePath)); From b5926c86db4ec978e11fa322f5db02a43b50b117 Mon Sep 17 00:00:00 2001 From: Mathilde Date: Thu, 23 Jan 2025 14:54:18 +0100 Subject: [PATCH 3/4] fix install --- Dockerfile | 3 +-- Makefile | 4 +--- README.md | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 54e4ed0..978ec83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,5 +11,4 @@ RUN echo 'APT::Install-Recommends "0" ; APT::Install-Suggests "0" ;' > /etc/apt/ apt-get --yes autoremove --purge && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ No newline at end of file +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer \ No newline at end of file diff --git a/Makefile b/Makefile index 07798b1..7b357f9 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,7 @@ DOCKER_RUN = $(DOCKER_COMPOSE) run --rm php install: $(DOCKER_COMPOSE) build --no-cache - -up: - $(DOCKER_COMPOSE) up --remove-orphans -d --build + ${MAKE} vendor -B vendor: ${DOCKER_RUN} composer install --no-interaction diff --git a/README.md b/README.md index 07d503b..8bd6085 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,6 @@ To install the app: ```bash $ make install - $ make up $ make vendor ``` From 7c02ff0136e781af97b942bf1c855e1ed54612c0 Mon Sep 17 00:00:00 2001 From: Mathilde Date: Thu, 23 Jan 2025 15:11:04 +0100 Subject: [PATCH 4/4] last line --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 978ec83..61610d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,4 @@ RUN echo 'APT::Install-Recommends "0" ; APT::Install-Suggests "0" ;' > /etc/apt/ apt-get --yes autoremove --purge && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -COPY --from=composer:2 /usr/bin/composer /usr/bin/composer \ No newline at end of file +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer