Example #1
0
 /**
  * Prepares the console application.
  *
  * @param  string               $filename
  * @param  \Auryn\Injector|null $injector
  * @param  string|null          $directory
  * @return \Rougin\Blueprint\Blueprint
  */
 public static function boot($filename, \Auryn\Injector $injector = null, $directory = null)
 {
     list($directory, $injector) = self::prepareArguments($directory, $injector);
     // Add League's Flysystem to injector
     $folder = new \League\Flysystem\Adapter\Local($directory);
     $system = new \League\Flysystem\Filesystem($folder);
     $injector->share($system);
     // Define the Blueprint instance
     $application = new \Symfony\Component\Console\Application(self::$name, self::$version);
     $blueprint = new \Rougin\Blueprint\Blueprint($application, $injector);
     // Sets the path to default in Blueprint
     if (!file_exists($filename)) {
         $blueprint->setCommandPath(__DIR__ . '/Commands');
         $blueprint->setCommandNamespace('Rougin\\Blueprint\\Commands');
         return $blueprint;
     }
     return self::preparePaths($blueprint, $filename);
 }
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
<?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 #4
0
<?php

// Includes the Composer Autoloader
require realpath('vendor') . '/autoload.php';
if (!defined('BLUEPRINT_FILENAME')) {
    define('BLUEPRINT_FILENAME', 'weasley.yml');
}
// Creates a new instance of Blueprint class
$injector = new Auryn\Injector();
$console = new Symfony\Component\Console\Application();
$app = new Rougin\Blueprint\Blueprint($console, $injector);
// 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':