#!/usr/bin/env php
<?php 
/*
 * Small script that generates wp-base.php mostly because we do not want to update multiple files.
 *
 * Script runns after composer-update
 */
require __DIR__ . '/../vendor/autoload.php';
use DigitalUnited\WPBase\Configuration;
Configuration::load_configuration('cli');
$mustache = new \Mustache_Engine(array('loader' => new \Mustache_Loader_FilesystemLoader(Configuration::get('templates_dir'))));
$json = json_decode(file_get_contents(__DIR__ . '/../composer.json'));
$data = $mustache->loadTemplate('wp_bootstrap')->render(array('plugin_name' => 'WP Base', 'plugin_uri' => $json->homepage, 'description' => $json->description, 'author' => 'Digital United', 'version' => $json->version, 'author_uri' => 'http://digitalunited.io'));
file_put_contents(__DIR__ . '/../wp-base.php', $data);
echo "bin/generate_wp_boostrap.php: wp-base.php updated";