-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Provide development mode #345
Provide development mode #345
Conversation
bin/development-mode
Outdated
| { | ||
| if (! file_exists('config/development.config.php')) { | ||
| // nothing to do | ||
| echo "Development mode was already disabled.", PHP_EOL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why " not just ' ?
|
Ping @akrabat - thoughts? The other direction I could take is to do a v3 release of zend-development-mode that just ships this script, instead of acting as a module, and require that in the ZF skeleton. |
| // Retrieve configuration | ||
| $appConfig = require __DIR__ . '/../config/application.config.php'; | ||
| if (file_exists(__DIR__ . '/config/development.config.php')) { | ||
| $appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/../config/development.config.php'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file_exists and require are checking for different files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @alextech - fixing now!
|
The code in I don't like this procedural style... |
Matter of preference. I don't care either way; this was relatively easy, and didn't require mixing a class and a script in a single file, or pushing a class into the skeleton source tree. If we were to do move this into zend-development-mode, I'd likely switch to a class, however. |
bin/development-mode
Outdated
|
|
||
| $config = getApplicationConfig(); | ||
| if (isset($config['module_listener_options']['cache_dir']) | ||
| && ! empty($config['module_listener_options']['cache_dir']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!empty is enough
|
Alternate version available in zfcampus/zf-development-mode#19 (pinging @webimpress and @akrabat) |
|
I've updated this pull request to use zf-development-mode v3, and added several composer script aliases to simplify working with it. |
zend-development-mode has been a popular feature of Apigility, and a popular standalone module. Unfortunately, its architecture uses the MVC <-> console integration, which is problematic in the streamlined skeleton, which does not include that out-of-the-box. This patch creates development-mode as as standalone script in the project `bin/` directory. Additionally, we add the `config/modules.config.php`, to push modules into a separate file, and `config/development.config.php.dist`, to provide a basic structure for segregated configuration. Finally, the bootstrap is updated to test for the presence of `config/development.config.php` and merge its contents with the application configuration. Usage is: ```bash $ ./bin/development-mode enable ``` Or, to disable: ```bash $ ./bin/development-mode disable ```
This patch removes `bin/development-mode` in favor of requiring zfcampus/zf-development-mode v3. The various commands in zf-development-mode have been aliased as composer scripts, and documented in the README file. It also adds `config/autoload/development.local.php.dist`, and ensures all configuration files are properly documented and use short array notation.
|
|
||
| ```bash | ||
| $ composer development-enable # enable development mode | ||
| $ composer development-disable # enable development mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/enable/disable
|
Was afk all week. +1 from me, though note typo in README. |
zf-development-mode has been a popular feature of Apigility, and a popular standalone module. This patch adds v3 of that package, which has been re-engineered to work as a standalone script (vs as a console-based MVC controller). In particular:
config/development.config.php.dist, to allow specifying bootstrap-level configuration to use when development mode is enabled (including additional modules, changes in configuration caching, etc.)config/autoload/development.local.php.dist, to allow specifying application-level configuration to use when development mode is enabled; by default, this includes enabling error display in zend-mvc views.config/modules.config.php, as we did in the Apigility skeleton. This provides a single file in which to view them, and simplifies auto-generation of that list.composer development-enablecomposer development-disablecomposer development-statusNotes
This PR originally took the route of creating a script within the skeleton,
bin/development-mode. That approach was scrapped in favor of producing an updated version of zfcampus/zf-development-mode that had no external dependencies.