Skip to content

Commit

Permalink
Config: Remove support for "project_directory"
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Oct 7, 2023
1 parent c44a9ed commit cff2ea7
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 26 deletions.
10 changes: 5 additions & 5 deletions .castor/qa.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ function all(): void
#[AsTask(description: 'Installs tooling')]
function install(): void
{
docker_compose_run('composer install -o', workDir: '/home/app/root/tools/php-cs-fixer');
docker_compose_run('composer install -o', workDir: '/home/app/root/tools/phpstan');
docker_compose_run('composer install -o --working-dir=tools/php-cs-fixer');
docker_compose_run('composer install -o --working-dir=tools/phpstan');
}

#[AsTask(description: 'Runs PHPStan')]
function phpstan(): void
{
docker_compose_run('phpstan --configuration=/home/app/root/phpstan.neon', workDir: '/home/app/application');
docker_compose_run('phpstan');
}

#[AsTask(description: 'Fixes Coding Style')]
function cs(bool $dryRun = false): void
{
if ($dryRun) {
docker_compose_run('php-cs-fixer fix --dry-run --diff', workDir: '/home/app/root');
docker_compose_run('php-cs-fixer fix --dry-run --diff');
} else {
docker_compose_run('php-cs-fixer fix', workDir: '/home/app/root');
docker_compose_run('php-cs-fixer fix');
}
}
2 changes: 0 additions & 2 deletions .castor/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ function create_default_context(): Context
'project_name' => 'app',
'root_domain' => 'app.test',
'extra_domains' => [],
'project_directory' => 'application',
'php_version' => '8.2',
'docker_compose_files' => [
'docker-compose.yml',
Expand Down Expand Up @@ -163,7 +162,6 @@ function docker_compose(array $subCommand, Context $c = null, bool $withBuilder
->withTimeout(null)
->withEnvironment([
'PROJECT_NAME' => variable('project_name'),
'PROJECT_DIRECTORY' => variable('project_directory'),
'PROJECT_ROOT_DOMAIN' => variable('root_domain'),
'PROJECT_DOMAINS' => $domains,
'USER_ID' => variable('user_id'),
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Drop support for PHP < 8.1
* Add some PHP tooling (PHP-CS-Fixer, PHPStan)
* Add `castor init` command to initialize a new project
* Remove support for custom `project_directory`

## 3.11.0 (2023-05-30)

Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ domain where the application will be available;
* `extra_domains` (optional): This contains extra domains where the application
will be available;

* `project_directory` (optional, default: `application`): This is the host
directory containing your PHP application;

* `php_version` (optional, default: `8.2`): This is PHP version.

For example:
Expand All @@ -53,7 +50,6 @@ function create_default_parameters(): Context
"admin.{$projectName}.{$tld}",
"api.{$projectName}.{$tld}",
],
'project_directory' => 'application',
'php_version' => 8.2,
];
)
Expand Down Expand Up @@ -177,7 +173,7 @@ If you want to use Webpack Encore in a Symfony project,
context: services/php
target: builder
volumes:
- "../../${PROJECT_DIRECTORY}:/home/app/application:cached"
- "../..:/home/app/application:cached"
command: "yarn run dev-server --hot --host 0.0.0.0 --allowed-hosts encore.${PROJECT_ROOT_DOMAIN} --allowed-hosts ${PROJECT_ROOT_DOMAIN} --client-web-socket-url-hostname encore.${PROJECT_ROOT_DOMAIN} --client-web-socket-url-port 443 --client-web-socket-url-protocol wss"
labels:
- "traefik.enable=true"
Expand Down Expand Up @@ -662,7 +658,7 @@ services:
context: services/php
target: cron
volumes:
- "../../${PROJECT_DIRECTORY}:/home/app/application:cached"
- "../..:/home/app/application:cached"
```
</details>
Expand Down Expand Up @@ -796,7 +792,7 @@ index 2eda814..59f8fed 100644
+ - mysql
#- rabbitmq
volumes:
- "../../${PROJECT_DIRECTORY}:/home/app/application:cached"
- "../..:/home/app/application:cached"
diff --git a/infrastructure/docker/docker-compose.yml b/infrastructure/docker/docker-compose.yml
index 49a2661..1804a01 100644
--- a/infrastructure/docker/docker-compose.yml
Expand All @@ -817,7 +813,7 @@ index 49a2661..1804a01 100644
- - postgres
+ - mysql
volumes:
- "../../${PROJECT_DIRECTORY}:/home/app/application:cached"
- "../..:/home/app/application:cached"
labels:
@@ -24,10 +24,7 @@ services:
# Comment the next line to be able to access frontend via HTTP instead of HTTPS
Expand Down
9 changes: 4 additions & 5 deletions castor.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function create_default_variables(): array
'extra_domains' => [
"www.{$projectName}.{$tld}",
],
'project_directory' => 'application',
'php_version' => $_SERVER['DS_PHP_VERSION'] ?? '8.2',
];
}
Expand All @@ -49,14 +48,14 @@ function start(): void
#[AsTask(description: 'Installs the application (composer, yarn, ...)', namespace: 'app')]
function install(): void
{
$basePath = sprintf('%s/%s', variable('root_dir'), variable('project_directory'));
$rootDir = variable('root_dir');

if (is_file("{$basePath}/composer.json")) {
if (is_file("{$rootDir}/composer.json")) {
docker_compose_run('composer install -n --prefer-dist --optimize-autoloader');
}
if (is_file("{$basePath}/yarn.lock")) {
if (is_file("{$rootDir}/yarn.lock")) {
docker_compose_run('yarn');
} elseif (is_file("{$basePath}/package.json")) {
} elseif (is_file("{$rootDir}/package.json")) {
docker_compose_run('npm install');
}

Expand Down
3 changes: 1 addition & 2 deletions infrastructure/docker/docker-compose.builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ services:
volumes:
- "builder-data:/home/app"
- "${COMPOSER_CACHE_DIR}:/home/app/.composer/cache"
- "../../${PROJECT_DIRECTORY}:/home/app/application:cached"
- "../..:/home/app/root:cached"
- "../..:/home/app/application:cached"
2 changes: 1 addition & 1 deletion infrastructure/docker/docker-compose.worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ x-services-templates:
- postgres
#- rabbitmq
volumes:
- "../../${PROJECT_DIRECTORY}:/home/app/application:cached"
- "../..:/home/app/application:cached"
user: app
labels:
- "docker-starter.worker.${PROJECT_NAME}"
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
depends_on:
- postgres
volumes:
- "../../${PROJECT_DIRECTORY}:/home/app/application:cached"
- "../..:/home/app/application:cached"
environment:
- "PHP_VERSION=${PHP_VERSION}"
labels:
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/docker/services/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ RUN mkdir -p "/home/app/.composer/cache" \
&& chown app: /home/app/.composer -R

# Third party tools
ENV PATH="$PATH:/home/app/root/tools/bin"
ENV PATH="$PATH:/home/app/application/tools/bin"
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ parameters:
project_name: string,
root_domain: string,
extra_domains: string[],
project_directory: string,
php_version: string,
docker_compose_files: string[],
macos: bool,
Expand Down
File renamed without changes.

0 comments on commit cff2ea7

Please sign in to comment.