Example #1
0
<?php

// Include the Composer Autoloader
require 'vendor/autoload.php';
// Load the Blueprint library
$injector = new Auryn\Injector();
$console = new Symfony\Component\Console\Application();
$app = new Rougin\Blueprint\Blueprint($console, $injector);
// Application details
$app->console->setName('Refinery');
$app->console->setVersion('0.2.0');
$app->setTemplatePath(__DIR__ . '/../src/Templates')->setCommandPath(__DIR__ . '/../src/Commands')->setCommandNamespace('Rougin\\Refinery\\Commands');
$app->injector->delegate('CI_Controller', function () {
    return Rougin\SparkPlug\Instance::create();
});
$ci = $app->injector->make('CI_Controller');
$app->injector->delegate('Rougin\\Describe\\Describe', function () use($ci) {
    $ci->load->database();
    $ci->load->helper('inflector');
    $config = [];
    $config['default'] = ['dbdriver' => $ci->db->dbdriver, 'hostname' => $ci->db->hostname, 'username' => $ci->db->username, 'password' => $ci->db->password, 'database' => $ci->db->database];
    if (empty($config['default']['hostname'])) {
        $config['default']['hostname'] = $ci->db->dsn;
    }
    $driver = new Rougin\Describe\Driver\CodeIgniterDriver($config);
    return new Rougin\Describe\Describe($driver);
});
// Run the Refinery console application
$app->run();
Example #2
0
<?php

// Load the Blueprint library
$combustor = new Rougin\Blueprint\Blueprint(new Symfony\Component\Console\Application(), new Auryn\Injector());
$combustor->setTemplatePath(__DIR__ . '/../src/Templates')->setCommandPath(__DIR__ . '/../src/Commands')->setCommandNamespace('Rougin\\Combustor\\Commands');
$combustor->console->setName('Combustor');
$combustor->console->setVersion('1.1.4');
$combustor->injector->delegate('CI_Controller', function () {
    $sparkPlug = new Rougin\SparkPlug\SparkPlug($GLOBALS, $_SERVER);
    return $sparkPlug->getCodeIgniter();
});
$combustor->injector->delegate('Rougin\\Describe\\Describe', function () use($db) {
    return new Rougin\Describe\Describe(new Rougin\Describe\Driver\CodeIgniterDriver($db));
});
// Run the Combustor console application
$combustor->run();
Example #3
0
// Information of the application
$app->console->setName('Weasley');
$app->console->setVersion('0.2.0');
// Adds a "init" command if the file does not exists
if (!file_exists(BLUEPRINT_FILENAME)) {
    $command = new Rougin\Weasley\Commands\InitializeCommand();
    $app->console->add($command);
    return $app->run();
}
// Parses the data from a YAML format
$config = Rougin\Weasley\Common\Configuration::get();
// Instantiate League\Filesystem
$adapter = new League\Flysystem\Adapter\Local($config->output);
$filesystem = new League\Flysystem\Filesystem($adapter);
$app->injector->share($filesystem);
$app->setTemplatePath(str_replace('bin', 'src', __DIR__ . '/Templates'))->setCommandPath(str_replace('bin', 'src', __DIR__ . '/Commands'))->setCommandNamespace('Rougin\\Weasley\\Commands');
$app->injector->delegate('Rougin\\Describe\\Describe', function () use($config) {
    switch ($config->database->driver) {
        case 'mysql':
        case 'mysqli':
            $pdo = new PDO('mysql:host=' . $config->database->hostname . ';dbname=' . $config->database->name, $config->database->username, $config->database->password);
            $driver = new Rougin\Describe\Driver\MySQLDriver($pdo, $config->database->name);
            break;
        case 'pdo':
        case 'sqlite':
        case 'sqlite3':
            $pdo = new PDO($config->database->hostname);
            $driver = new Rougin\Describe\Driver\SQLiteDriver($pdo);
            break;
    }
    return new Rougin\Describe\Describe($driver);