heyday/beam — pull request #48 by oddnoc (2014-11-26 00:10:00+00:00)
Title: Implement interpolations

This enhancement enables one to specify interpolations that are to be
applied to any values that match the search element. The replacement can
be either a simple "replace", which uses str_replace to do simple string
substitution, or an "exec", which uses the output of a command for the
replacement.

The `interpolations` config option is an array of search & replace
values to interpolate into config values at runtime. For an example, see
this configuration fragment:

```json
"interpolations": [
{
"search": "%branch%",
"exec": "git symbolic-ref --short HEAD"
},
{
"search": "<#LIVESERVER#>",
"replace": "www.example.com"
}
],
"servers": {
"dev": {
"user": "operator",
"host": "<#LIVESERVER#>",
"webroot": "/usr/local/www/%branch%/shared/cached-copy"
},
```

This would have the effect of making `beam up dev` use `www.example.com`
as the host, and `/usr/local/www/some-feature/shared/cached-copy` as the
webroot, if you happen to be working on a git branch named
"some-feature".

Interpolations are applied after any imports. This means that the import
paths are not subject to substitutions, but the values in the imported
files are subject to them.