2017 © Pedro Peláez
 

package configuru

A single source of configuration

image

webmaesther/configuru

A single source of configuration

  • Tuesday, February 28, 2017
  • by webmaesther
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

webmaesther/configuru

Build status, (*1)

About Configuru

Sometimes you tweak a configuration file just a little bit, everything seems to be working, but after a couple weeks or months, an annoying bug appears in the system, and you debug for hours only to find the reason of it is that you didn't edit the same configuration in another file., (*2)

If you ever ran into this issue then Configuru is just for you! With this tool, you can easily rebuild your configuration files from one single source of truth., (*3)

Installation

If you are using composer, you can easily install Configuru for your project., (*4)

composer require webmaesther/configuru --dev

It is recommended that you only require this package for development, since this is intended to be a build tool., (*5)

Or if you wish, you can always install it globally., (*6)

Getting Started

Add configuru.yml

Add a configuru.yml file to your root, containing all the key-value pairs to replace., (*7)

replace:
  key: "value"

Add .guru files

For each file you wish to replace, add a guru file in the same folder. For example, if you wish to build your config.yml file, add a config.guru.yml file to your project and use :(key) in the guru file as a placeholder for the value you configured in configuru.yml., (*8)

Build with configuru

vendor/bin/configuru build

This command will look for all the guru files in your project folders recursively and replace the configured keys with the values and save them to a file with the same filename, but without the .guru extension., (*9)

Configuru will overwrite any file it encounters!, (*10)

Advanced Usage

Escape keys

If you have text in your files in the format :(key), but you don't wish to replace it, just add a backslash before the colon to escape that key, like this: \:(key). It will be replaced with the string :(key) without the backslash., (*11)

Build path

By default, Configuru will build every guru file it can find within the current working directory. You can specify a different path as the first argument of the command., (*12)

vendor/bin/configuru build path/to/build

All file types

Notice that Configuru will build any text file, not just the typical config file extensions (yaml, php, json) but any text file you want as long as the filename contains .guru, it will use that file to build the same file without .guru in the filename., (*13)

Flexible guru file names

Actually, you can place the .guru extension anywhere in the filename. For example .guru.config.yml will build .config.yml. But .guruconfig.yml won't build config.yml, (*14)

Examples

You can find some examples in the example folder. It contains the guru files as well as the built result., (*15)

The Versions

28/02 2017

dev-master

9999999-dev

A single source of configuration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eszter Czotter

24/12 2016

1.0.3

1.0.3.0

A single source of configuration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eszter Czotter

24/12 2016

1.0.2

1.0.2.0

A single source of configuration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eszter Czotter

24/12 2016

1.0.1

1.0.1.0

A single source of configuration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eszter Czotter

24/12 2016

1.0.0

1.0.0.0

A single source of configuration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eszter Czotter