Compare commits

..

5 commits
1.1.0 ... main

9 changed files with 32 additions and 18 deletions

View file

@ -2,6 +2,15 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [1.1.2] - 2025-04-26
### Fixed
- Fixed a critical bug where environments would not build correctly if using a SQLite database.
## [1.1.1] - 2025-04-26
### Fixed
- Fixed a critical bug where environments could not be destroyed if using a MySQL database.
- Fixed a critical bug where PDO extensions were not installed in the container, causing MySQL driver errors.
## [1.1.0] - 2025-04-24 ## [1.1.0] - 2025-04-24
### Added ### Added
- New database option: MySQL. - New database option: MySQL.
@ -23,7 +32,7 @@ All notable changes to this project will be documented in this file.
- Added information on `spin:down` command to README. - Added information on `spin:down` command to README.
### Changed ### Changed
- Minor documentation tweak to include link to Wiki on Packagist. - Minor documentation tweak to include a link to the Wiki on Packagist.
## [1.0.1] - 2025-04-24 ## [1.0.1] - 2025-04-24
### Changed ### Changed

View file

@ -5,7 +5,7 @@
# Loom Spinner CLI # Loom Spinner CLI
<p> <p>
<img src="https://img.shields.io/badge/Version-1.1.0-blue" alt="Version 1.1.0"> <img src="https://img.shields.io/badge/Version-1.1.2-blue" alt="Version 1.1.2">
</p> </p>
A streamlined environment management tool for PHP developers. A streamlined environment management tool for PHP developers.

View file

@ -1,7 +1,7 @@
{ {
"name": "loomlabs/loom-spinner-cli", "name": "loomlabs/loom-spinner-cli",
"description": "A simple command-line Docker environment spinner for PHP.", "description": "A simple command-line Docker environment spinner for PHP.",
"version": "1.1.0", "version": "1.1.2",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Loom\\Spinner\\": "src/" "Loom\\Spinner\\": "src/"
@ -13,13 +13,9 @@
} }
}, },
"require": { "require": {
"loomlabs/utility.collection": "^1.1",
"symfony/console": "^7.2", "symfony/console": "^7.2",
"symfony/yaml": "^7.2" "symfony/yaml": "^7.2"
}, },
"require-dev": {
"phpunit/phpunit": "^12.1"
},
"bin": [ "bin": [
"bin/loom" "bin/loom"
], ],

View file

@ -9,4 +9,8 @@ services:
environment: environment:
MYSQL_ROOT_PASSWORD: ${ROOT_PASSWORD} MYSQL_ROOT_PASSWORD: ${ROOT_PASSWORD}
volumes: volumes:
- ./data/${PROJECT_NAME}/mysql:/var/lib/mysql:cached - mysql_data:/var/lib/mysql:cached
container_name: ${PROJECT_NAME}-mysql
volumes:
mysql_data:

View file

@ -2,9 +2,9 @@ services:
nginx: nginx:
build: build:
context: ./nginx context: ./nginx
container_name: ${PROJECT_NAME}-nginx
ports: ports:
- ${SERVER_PORT}:80 - ${SERVER_PORT}:80
volumes: volumes:
- ${PROJECT_DIRECTORY}:/var/www/html:cached - ${PROJECT_DIRECTORY}:/var/www/html:cached
- ./nginx/conf.d:/etc/nginx/conf.d - ./nginx/conf.d:/etc/nginx/conf.d
container_name: ${PROJECT_NAME}-nginx

View file

@ -0,0 +1 @@
RUN docker-php-ext-install mysqli pdo pdo_mysql > /dev/null 2>&1

View file

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Loom\Spinner\Classes\File; namespace Loom\Spinner\Classes\File;
use Loom\Spinner\Classes\Config\Config; use Loom\Spinner\Classes\Config\Config;
use Loom\Utility\FilePath\FilePath;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
class DockerComposeFileBuilder extends AbstractFileBuilder class DockerComposeFileBuilder extends AbstractFileBuilder
@ -25,6 +24,9 @@ class DockerComposeFileBuilder extends AbstractFileBuilder
{ {
$this->content = $this->config->getConfigFileContents('php.yaml'); $this->content = $this->config->getConfigFileContents('php.yaml');
if ($this->config->isServerEnabled($input)) {
$this->addNginxConfig();
}
if ($this->config->isDatabaseEnabled($input)) { if ($this->config->isDatabaseEnabled($input)) {
$databaseDriver = strtolower($this->config->getDatabaseDriver($input)); $databaseDriver = strtolower($this->config->getDatabaseDriver($input));
@ -37,10 +39,6 @@ class DockerComposeFileBuilder extends AbstractFileBuilder
} }
} }
if ($this->config->isServerEnabled($input)) {
$this->addNginxConfig();
}
return $this; return $this;
} }

View file

@ -36,13 +36,18 @@ class PHPDockerFileBuilder extends AbstractFileBuilder
$this->addNewLine(); $this->addNewLine();
$this->content .= $this->config->getConfigFileContents('php-fpm/Sqlite.Dockerfile'); $this->content .= $this->config->getConfigFileContents('php-fpm/Sqlite.Dockerfile');
} }
if ($this->config->getDatabaseDriver($input) ==='mysql') {
$this->addNewLine();
$this->content .= $this->config->getConfigFileContents('php-fpm/MySQL.Dockerfile');
}
} }
$this->content = str_replace('${NODE_VERSION}', (string) $this->config->getNodeVersion($input), $this->content); $this->content = str_replace('${NODE_VERSION}', (string) $this->config->getNodeVersion($input), $this->content);
if ($this->config->isXdebugEnabled($input)) { if ($this->config->isXdebugEnabled($input)) {
$this->addNewLine(); $this->addNewLine();
$this->content .= $this->config->getConfigFileContents('php-fpm/Xdebug.Dockerfile'); $this->content .= $this->config->getConfigFileContents('php-fpm/XDebug.Dockerfile');
file_put_contents( file_put_contents(
$this->config->getDataDirectory() . '/php-fpm/xdebug.ini', $this->config->getDataDirectory() . '/php-fpm/xdebug.ini',
$this->config->getConfigFileContents('php-fpm/xdebug.ini') $this->config->getConfigFileContents('php-fpm/xdebug.ini')

View file

@ -29,7 +29,8 @@ class DestroyCommand extends AbstractSpinnerCommand
return Command::FAILURE; return Command::FAILURE;
} }
$this->config = new Config($input->getArgument('name')); $projectName = $input->getArgument('name');
$this->config = new Config($projectName);
if (!file_exists($this->config->getDataDirectory())) { if (!file_exists($this->config->getDataDirectory())) {
$this->style->error('No project found with the provided name.'); $this->style->error('No project found with the provided name.');
@ -38,7 +39,7 @@ class DestroyCommand extends AbstractSpinnerCommand
} }
try { try {
passthru($this->buildDockerComposeCommand('down', false, false)); passthru($this->buildDockerComposeCommand('down -v', false, false));
recursive_rmdir($this->config->getDataDirectory()); recursive_rmdir($this->config->getDataDirectory());
} catch (\Exception $exception) { } catch (\Exception $exception) {
$this->style->error('An error occurred while destroying the project: ' . $exception->getMessage()); $this->style->error('An error occurred while destroying the project: ' . $exception->getMessage());