Ingot
=====

This package provides some defaults and hard structure in the way our
applications is build.

Also it provides config expansion from `pco.json` files when our 
applications are deployed to the NetGroup platform.

This package dependes in Flint and Tacker.

Magic
-----

Ingot provides some magic in the way an application is bootstrap. By default
it will do the following:

1. Automatically load a config files named after then environment from `config/`. So if you are
using `dev` it will load `config/dev.json`.
2. It automatically sets the `cache_dir` and `config.cache_dir` parameters. Which means it is
able to cache out the box!
3. It automatically extends the normal Tacker normalizers with an additional `NetGroupNormalizer` which
will expand `#app.env.PCO_ENV#` style replacements from `pco.json`.

Configuration
-------------

When an `pco.json` is available (eg. when deployed to ng infrastructure). It is possible to use a special
syntax and have information from the file autoexpanded.

Assuming the `pco.json` file contains the following:

``` json
{
    "app" : {
        "env" : {
            "PCO_ENV" : "prod"
        }
    }
}
```

And the configuration file you are loading (ex. `config/dev.json`) contains:

``` json
{
    "env" : "#app.env.PCO_ENV#"
}
```

Then when the applications is loaded `$app['env']` will contain `prod`.

Easy Application Boostraping
----------------------------

When using Flint we often had to customize the application constructor in order
to get the environment set etc.

Ingot provides a `Application` class that extends from Flint. The following shows
its new signature.


``` php
<?php
namespace Supah;

class Application extends \Ingot\Application
{
    protected function initialize()
    {
        // Must be implemented
        // Register custom service providers here
    }
}

$app = new Supah\Application('/path/to/root_dir', 'environment', $debug = false);
$app->run();
```

The `initialize` method is a requirement to implement and provides us with a standardized
way of registering additional Service Providers and make sure they are loaded at the 
correct time of the bootstrap process.