Skip to content

Commit

Permalink
Adding pub/static to Magento 2 shared directories list & simplifyin…
Browse files Browse the repository at this point in the history
…g the list. Removing all `writable_dirs` directives in Magento 2 recipe. Removing `deploy:unlock` from `magento:init` task. Updating `fill` function to support `int` & `boolean` defined values. Updating change log.
  • Loading branch information
dl-unleashed-technologies committed Mar 15, 2022
1 parent c99016f commit 3afc80c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 31 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,24 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi

## [Unreleased][unreleased]

## [0.3.21] - 2022-03-15

### Fixed

- Adding `pub/static` to Magento 2 shared directories list & simplifying the list.
- Removing all `writable_dirs` directives in Magento 2 recipe.
- Removing `deploy:unlock` from `magento:init` task.
- Updating `fill` function to support `int` & `boolean` defined values.

## [0.3.20] - 2022-03-10

### Changed

- Updated Drupal recipes to better support multi-site DB pull operations.
- Added `dev:sites` task which outputs the list of defined sites.
- Defined a pair of local hosts.
- Updating `cms:drupal:db:backup:create` to use project name in backup.

### Fixed

- Fixing cms:drupal:db:backup:create to handle grep count error status code.
Expand Down Expand Up @@ -295,7 +311,8 @@ config vars to be overridden.

**Initial release!**

[unreleased]: https://github.com/unleashedtech/deployer-recipes/compare/0.3.20...main
[unreleased]: https://github.com/unleashedtech/deployer-recipes/compare/0.3.21...main
[0.3.21]: https://github.com/unleashedtech/deployer-recipes/compare/0.3.20...0.3.21
[0.3.20]: https://github.com/unleashedtech/deployer-recipes/compare/0.3.19...0.3.20
[0.3.19]: https://github.com/unleashedtech/deployer-recipes/compare/0.3.18...0.3.19
[0.3.18]: https://github.com/unleashedtech/deployer-recipes/compare/0.3.17...0.3.18
Expand Down
28 changes: 7 additions & 21 deletions cms/magento/magento2.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,18 @@
set('app_type', 'magento');
set('mage', 'bin/magento');
fill('shared_dirs', [
'var/composer_home',
'var/log',
'var/export',
'var/report',
'var/import',
'var/import_history',
'var/session',
'var/importexport',
'var/backups',
'var/tmp',
'pub/sitemap',
'var',
'pub/media',
'pub/page-cache',
'pub/sitemap',
'pub/static',
'generated',

This comment has been minimized.

Copy link
@dshumakerUT

dshumakerUT Mar 29, 2022

Contributor

Generated should not be shared.

]);
fill('shared_files', [
'app/etc/env.php',
'var/.maintenance.ip',
]);
fill('writable_dirs', [
'var',
'pub/static',
'pub/media',
'generated',
'pub/page-cache',
]);
fill('writable_dirs', []);
fill('clear_paths', [
'generated/*',
'pub/static/_cache/*',
Expand Down Expand Up @@ -77,8 +65,6 @@

set($var, $newVars);
}

invoke('deploy:unlock');
});

desc('Enables maintenance mode');
Expand Down Expand Up @@ -262,7 +248,7 @@ static function (): void {
run('{{mage}} config:set system/backup/functionality_enabled 1');
}
);
} catch (RunException) {
} catch (RunException $e) {
return;
}

Expand Down
8 changes: 4 additions & 4 deletions cms/wp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ to `foo.dev1.example`, `foo.staging1.example` & `production1.example`. You will
config:
namespace: foo
repository_user: bar
repository_domain: 'repository1.example`
dev_domain: 'dev1.example`
staging_domain: 'staging1.example`
production_domain: 'production1.example`
repository_domain: 'repository1.example'
dev_domain: 'dev1.example'
staging_domain: 'staging1.example'
production_domain: 'production1.example'
upload_dir: 'docroot/app/uploads'

import:
Expand Down
14 changes: 9 additions & 5 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,31 @@ function fill(string $var, $defaultValue): void
if (! has($var)) {
set($var, $defaultValue);
} else {
$value = get($var);
switch (\gettype($value)) {
$definedValue = get($var);
switch (\gettype($definedValue)) {
case 'array':
if (! \count($value)) {
// Allow override of the defined array if empty.
if (! \count($definedValue)) {
set($var, $defaultValue);
}

break;

case 'string':
if (\trim($value) === '') {
// Allow override of the defined string if empty.
if (\trim($definedValue) === '') {
set($var, $defaultValue);
}

break;

case 'boolean':
case 'int':
// Var already defined. Do nothing.
break;

default:
throw new \DomainException('Unsupported type: ' . \gettype($value));
throw new \DomainException('Unsupported type: ' . \gettype($definedValue));
}
}
}
Expand Down

0 comments on commit 3afc80c

Please sign in to comment.