copy-conf This tool allows you to manage your ignored configuration files when running a composer install or update.

  1. Usage
  2. Configuration
  3. Links

This tool allows you to manage your ignored configuration files when running a composer install or update. It works when storing the mockup of configuration files in VCS.

Usage

Add the following in your root composer.json file: ~~~ {

"require": {
    "gregurco/copyconf": "v1.1"
},
"scripts": {
    "post-install-cmd": [
        "Gregurco\\ParameterHandler\\ScriptHandler::buildParameters"
    ],
    "post-update-cmd": [
        "Gregurco\\ParameterHandler\\ScriptHandler::buildParameters"
    ]
},
"extra": {
    "copyconf-parameters" : {
        "files": {
            "main_config": "protected/config/config.php"
        },
        "backup_mode": "ask",
        "backup_dir" : "backup/"
    }
}

} ~~~ Notice: with this configuration after composer install or update you will be asked if you want to process file protected/config/config.php. If you confirm the action, script will find and copy file protected/config/config.php.dist into protected/config/config.php. After that, script will find all placeholders (like {{hostname}} and etc.) and will ask you what should be put instead of them.

Configuration

List of copyconf parameters:

  • files - array - array of files, that should be processed
  • dist_ext - string - extension of files that should be processed (.dist - default)
  • reg_exp - string - regular expression used in searching of placeholders
  • backup_mode - string - by default "false" - not backup overwritten files. Can be set value of "ask" or "true" to ask on overwriting files or not overwrite in silent mode.
  • backup_dir - string - directory where to write backups (backup/ - default)

Example of placeholders:

  • {{hostname}} - simple placeholder
  • {{hostname|localhost}} - placeholder with default value 'localhost'

Example of file with placeholders:

$link = mysqli_connect("{{host}}", "{{user}}", "{{password}}", "{{db_name}}") or die("Error " . mysqli_error($link)); 

Links

0 0
1 follower
0 downloads
Yii Version: all
License: MIT
Category: Console
Developed by: Gregurco
Created on: Oct 4, 2014
Last updated: 3 years ago

Related Extensions