Plugins
This page needs updating.
Plugins are folders saved to the plugins/ directory, resembling the following structure.
└── mysql ├── README.md ├── config.yml └── plugin.sh- config.yml should all configuration that the plugin is expecting to use.
plugin.sh should contain functions; all that are public must be prefixed by the plugin name:
function mysql_on_init() { ensure_files_local_directories && succeed_because "Updated fetch structure at $(path_make_relative "$FETCH_FILES_PATH" "$CLOUDY_BASEPATH")" }Plugins may provide the following functions: 1. Plugins implement hooks which are functions named by: PLUGINon*. 2. To find the hooks available, search the code for
plugin_implementsandcall_plugin. 3. Plugins may define private functions, but they should begin with an underscore.```bash function _mysql_get_remote_env() { case $REMOTE_ENV_ID in production) echo 'live' && return 0 ;; staging) echo 'test' && return 0 ;; esac exit_with_failure "Cannot determine Pantheon environment using $REMOTE_ENV_ID" } ```
Error Conditions
- Plugins should use
fail_because&&succeed_because - Plugins should return non-zeros
- Plugins should not use
exit_with_*methods; those are for the controller.
Tests
Add tests to your plugin:
- Create PLUGIN.tests.sh, e.g. "default.tests.sh"
- Follow the Cloudy testing framework.
- Run tests with
./live_dev_porter tests