public function testRefreshJobs()
 {
     $cli = new \Symfony\Component\Console\Application();
     $cli->addCommands(array(new \ebussola\job\console\RefreshJobsCommand(), new \ebussola\job\console\ListJobsCommand()));
     $refresh_tester = new \Symfony\Component\Console\Tester\CommandTester($cli->find('jobschedule:refresh'));
     $list_tester = new \Symfony\Component\Console\Tester\CommandTester($cli->find('jobschedule:list'));
     // stage 1
     $refresh_tester->execute(array('command' => 'jobschedule:refresh'));
     $output = $refresh_tester->getDisplay();
     $this->assertContains('Jobs Reloaded', $output);
     $list_tester->execute(array('command' => 'jobschedule:list'));
     $output = $list_tester->getDisplay();
     $this->assertContains('[1]', $output);
     $this->assertContains('[2]', $output);
     $this->assertContains('[3]', $output);
     $this->assertContains('[4]', $output);
     $this->assertContains('[5]', $output);
     $this->assertContains('[6]', $output);
     // stage 2
     $refresh_tester->execute(array('command' => 'jobschedule:refresh'));
     $output = $refresh_tester->getDisplay();
     $this->assertContains('Jobs Reloaded', $output);
     $list_tester->execute(array('command' => 'jobschedule:list'));
     $output = $list_tester->getDisplay();
     $this->assertNotContains('[1]', $output);
     $this->assertNotContains('[2]', $output);
     $this->assertContains('[3]', $output);
     $this->assertContains('[4]', $output);
     $this->assertContains('[5]', $output);
     $this->assertContains('[6]', $output);
 }
Example #2
0
 public function create()
 {
     $c = new Pimple();
     $c['concrete'] = function ($c) {
         return new \Concrete\Concrete();
     };
     $c['command.about'] = function ($c) {
         return new \Concrete\Command\AboutCommand();
     };
     $c['command.build'] = function ($c) {
         return new \Concrete\Command\BuildCommand($c);
     };
     $c['commands'] = function ($c) {
         return array($c['command.about'], $c['command.build']);
     };
     $c['git.version'] = function ($c) {
         return new \Concrete\Processor\GitTagVersion();
     };
     $c['application'] = function ($c) {
         $versionProc = $c['git.version'];
         $application = new \Symfony\Component\Console\Application('Concrete PHAR Compiler for PHP', $versionProc->process('{{version}}'));
         $application->addCommands($c['commands']);
         return $application;
     };
     return $c;
 }
 public function setUp()
 {
     $conn = \Doctrine\DBAL\DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'user' => 'root', 'password' => '', 'memory' => true));
     $this->data = new \ebussola\job\jobdata\Doctrine($conn, $this->table_name);
     $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array('db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($conn)));
     $cli = new \Symfony\Component\Console\Application();
     $cli->setHelperSet($helperSet);
     $cli->addCommands(array(new \ebussola\job\console\InitCommand()));
     $cmd_tester = new \Symfony\Component\Console\Tester\CommandTester($cli->find('jobschedule:init'));
     $cmd_tester->execute(array('command' => 'jobschedule:init', 'table_name' => $this->table_name));
     //Insert some data
     $conn->insert($this->table_name, array('id' => 1, 'expires_on' => strtotime('+1 hour'), 'runner_class' => 'ebussola\\job\\runner', 'schedule' => '@daily', 'command' => 'foo'));
     $conn->insert($this->table_name, array('id' => 2, 'expires_on' => strtotime('+1 hour'), 'runner_class' => 'ebussola\\job\\runner', 'schedule' => '@daily', 'command' => 'bar'));
 }
 /**
  * Registers services on the given app.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  *
  * @param Application $app An Application instance
  */
 public function register(Application $app)
 {
     $app['console.options'] = $app->share(function () {
         return array('name' => 'Silex Application', 'version' => Application::VERSION);
     });
     $app['console.commands'] = $app->share(function () {
         return array();
     });
     $app['console'] = $app->share(function (Application $app) {
         $options = $app['console.options'];
         $console = new \Symfony\Component\Console\Application($options['name'], $options['version']);
         $console->getHelperSet()->set(new SilexHelper($app));
         $console->addCommands($app['console.commands']);
         return $console;
     });
 }
 /**
  * @param \Nette\DI\Container
  * @param \Symfony\Component\Console\Helper\HelperSet
  * @return \Symfony\Component\Console\Application
  */
 public static function createConsole(\Nette\DI\Container $container, \Symfony\Component\Console\Helper\HelperSet $helperSet = NULL)
 {
     $console = new \Symfony\Component\Console\Application(Framework::NAME . " Command Line Interface", Framework::VERSION);
     if (!$helperSet) {
         $helperSet = new \Symfony\Component\Console\Helper\HelperSet();
         $helperSet->set(new \Doctrine\ODM\MongoDB\Tools\Console\Helper\DocumentManagerHelper($container->documentManager), 'dm');
         $helperSet->set(new \Symfony\Component\Console\Helper\DialogHelper(), 'dialog');
     }
     $console->setHelperSet($helperSet);
     $console->setCatchExceptions(FALSE);
     $commands = array();
     foreach (array_keys($container->findByTag('consoleCommand')) as $name) {
         $commands[] = $container->getService($name);
     }
     $console->addCommands($commands);
     return $console;
 }
Example #6
0
<?php

use prgTW\BeanstalkToolbox\Command;
require_once __DIR__ . '/../vendor/autoload.php';
$application = new \Symfony\Component\Console\Application('Beanstalk Toolbox', '@git-version@');
$application->addCommands([new Command\CopyCommand(), new Command\StatsCommand(), new Command\UpdateCommand()]);
$application->run();
Example #7
0
<?php

require_once getcwd() . "/cli-config.php";
xdebug_start_trace("/tmp/couch");
$cli = new \Symfony\Component\Console\Application('Doctrine CouchDB CLI', Doctrine\ODM\CouchDB\Version::VERSION);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \Doctrine\CouchDB\Tools\Console\Command\ReplicationStartCommand(), new \Doctrine\CouchDB\Tools\Console\Command\ReplicationCancelCommand(), new \Doctrine\CouchDB\Tools\Console\Command\ViewCleanupCommand(), new \Doctrine\CouchDB\Tools\Console\Command\CompactDatabaseCommand(), new \Doctrine\CouchDB\Tools\Console\Command\CompactViewCommand(), new \Doctrine\CouchDB\Tools\Console\Command\MigrationCommand(), new \Doctrine\ODM\CouchDB\Tools\Console\Command\UpdateDesignDocCommand()));
$cli->run();
<?php

$c = new Pimple();
$c['parameters'] = array('greetings.file' => 'greetings.yaml');
$c['greeter'] = function ($c) {
    return new \LMammino\ConsoleApp\Greeter($c['parameters']['greetings.file']);
};
$c['command.greet'] = function ($c) {
    return new \LMammino\ConsoleApp\Command\GreetCommand($c['greeter']);
};
$c['commands'] = function ($c) {
    return array($c['command.greet']);
};
$c['application'] = function ($c) {
    $application = new \Symfony\Component\Console\Application();
    $application->addCommands($c['commands']);
    return $application;
};
return $c;
Example #9
0
<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
chdir(__DIR__);
$loader = (require '../vendor/autoload.php');
$cli = new \Symfony\Component\Console\Application('Drest Client Command Line Interface Tool', DrestClient\Version::VERSION);
$cli->setCatchExceptions(true);
$cli->addCommands(array(new DrestClient\Tools\Console\Command\GenerateClasses()));
$cli->run();
Example #10
0
}
if (!$autoload) {
    throw new RuntimeException('Install dependencies to run the console.');
}
use Doctrine\Common\Annotations\AnnotationRegistry;
AnnotationRegistry::registerLoader(array($autoload, 'loadClass'));
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
    if (!is_readable($configFile)) {
        trigger_error('Configuration file [' . $configFile . '] does not have read permission.', E_USER_ERROR);
    }
    require $configFile;
    foreach ($GLOBALS as $helperSetCandidate) {
        if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
            $helperSet = $helperSetCandidate;
            break;
        }
    }
} else {
    trigger_error('Configuration file [' . $configFile . '] does not exist. See https://github.com/doctrine/phpcr-odm/wiki/Command-line-tool-configuration', E_USER_ERROR);
}
$helperSet = $helperSet ?: new \Symfony\Component\Console\Helper\HelperSet();
$cli = new \Symfony\Component\Console\Application('Doctrine ODM PHPCR Command Line Interface', Doctrine\ODM\PHPCR\Version::VERSION);
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \PHPCR\Util\Console\Command\NodeDumpCommand(), new \PHPCR\Util\Console\Command\NodeMoveCommand(), new \PHPCR\Util\Console\Command\NodeRemoveCommand(), new \PHPCR\Util\Console\Command\NodesUpdateCommand(), new \PHPCR\Util\Console\Command\NodeTouchCommand(), new \PHPCR\Util\Console\Command\NodeTypeListCommand(), new \PHPCR\Util\Console\Command\NodeTypeRegisterCommand(), new \PHPCR\Util\Console\Command\WorkspaceCreateCommand(), new \PHPCR\Util\Console\Command\WorkspaceDeleteCommand(), new \PHPCR\Util\Console\Command\WorkspaceExportCommand(), new \PHPCR\Util\Console\Command\WorkspaceImportCommand(), new \PHPCR\Util\Console\Command\WorkspaceListCommand(), new \PHPCR\Util\Console\Command\WorkspacePurgeCommand(), new \PHPCR\Util\Console\Command\WorkspaceQueryCommand(), new \Doctrine\ODM\PHPCR\Tools\Console\Command\DocumentMigrateClassCommand(), new \Doctrine\ODM\PHPCR\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ODM\PHPCR\Tools\Console\Command\DumpQueryBuilderReferenceCommand(), new \Doctrine\ODM\PHPCR\Tools\Console\Command\InfoDoctrineCommand(), new \Doctrine\ODM\PHPCR\Tools\Console\Command\RegisterSystemNodeTypesCommand()));
if (isset($extraCommands) && !empty($extraCommands)) {
    $cli->addCommands($extraCommands);
}
$cli->run();
Example #11
0
<?php

require_once 'Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony');
$classLoader->register();
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
    if (!is_readable($configFile)) {
        trigger_error('Configuration file [' . $configFile . '] does not have read permission.', E_ERROR);
    }
    require $configFile;
    foreach ($GLOBALS as $helperSetCandidate) {
        if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
            $helperSet = $helperSetCandidate;
            break;
        }
    }
}
$helperSet = $helperSet ?: new \Symfony\Component\Console\Helper\HelperSet();
$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\DBAL\Version::VERSION);
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand()));
$cli->run();
Example #12
0
	/**
	 * @param \Nette\DI\Container
	 * @return \Symfony\Component\Console\Application
	 */
	public static function createServiceConsole(Container $container)
	{
		$commands = $container->consoleCommands;
        if ($commands instanceof \Nella\FreezableArray) {
        	$commands->freeze();
			$commands = $commands->iterator->getArrayCopy();
        }

        $cli = new \Symfony\Component\Console\Application(
			Framework::NAME . " Command Line Interface", Framework::VERSION
		);
        $cli->setCatchExceptions(FALSE);
        $cli->setHelperSet($container->consoleHelpers);
		$cli->addCommands($commands);
        return $cli;
	}
Example #13
0
 public function executeDoctrine(array $arguments)
 {
     $_SERVER['argv'] = array_slice($arguments, 1);
     $cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', \Doctrine\Common\Version::VERSION);
     $cli->setCatchExceptions(true);
     $helperSet = $cli->getHelperSet();
     $helpers = array('em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($this->cx->getDb()->getEntityManager()));
     foreach ($helpers as $name => $helper) {
         $helperSet->set($helper, $name);
     }
     $cli->addCommands(array(new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand()));
     $cli->setAutoExit(false);
     return $cli->run();
 }
Example #14
0
#!/usr/bin/env php
<?php 
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
    require_once __DIR__ . '/vendor/autoload.php';
} elseif (file_exists(__DIR__ . '/../../autoload.php')) {
    require_once __DIR__ . '/../../autoload.php';
} else {
    echo 'Gumdrop could not find dependencies' . PHP_EOL;
    exit(1);
}
$ConsoleApplication = new \Symfony\Component\Console\Application();
$ConsoleApplication->addCommands(array(new \Gumdrop\Commands\Generate(), new \Gumdrop\Commands\Install(), new \Gumdrop\Commands\Reload()));
$ConsoleApplication->run();
Example #15
0
<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
chdir(__DIR__);
$configFile = 'server-config.php';
if (!file_exists($configFile) || !is_readable($configFile)) {
    trigger_error('Unable to read configuration file: ' . $configFile . ' Use server-config.php.dist as a template to create server-config.php.dist');
}
include $configFile;
$helperSet = isset($helperSet) ? $helperSet : new \Symfony\Component\Console\Helper\HelperSet();
$cli = new \Symfony\Component\Console\Application('Drest Server Command Line Interface Tool');
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new Drest\Tools\Console\Command\CheckDefinitions(), new Drest\Tools\Console\Command\CheckProductionSettings()));
$cli->run();
Example #16
0
<?php

require __DIR__ . '/cli-config.php';
$app = new \Symfony\Component\Console\Application('Doctrine MongoDB ODM');
if (isset($helperSet)) {
    $app->setHelperSet($helperSet);
}
$app->addCommands(array(new \Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateDocumentsCommand(), new \Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateHydratorsCommand(), new \Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateRepositoriesCommand(), new \Doctrine\ODM\MongoDB\Tools\Console\Command\QueryCommand(), new \Doctrine\ODM\MongoDB\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\CreateCommand(), new \Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\DropCommand(), new \Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\UpdateCommand()));
$app->run();
Example #17
0
<?php

/**
 * Per https://github.com/guzzle/guzzle/blob/master/docs/faq.rst
 * "Maximum function nesting level of '100' reached, aborting" is possible
 * This error message comes specifically from the XDebug extension.
 */
ini_set('xdebug.max_nesting_level', 1000);
// global variable to allow registering additional commands
// each callback should take a single parameter implementing ArrayAccess (the app config)
$GLOBALS['awwCommands'] = array();
if (file_exists(__DIR__ . '/../../autoload.php')) {
    // addwiki is part of a composer installation
    require_once __DIR__ . '/../../autoload.php';
} else {
    require_once __DIR__ . '/vendor/autoload.php';
}
$awwConfig = new Addwiki\Config\AppConfig(__DIR__);
$awwApp = new Symfony\Component\Console\Application('aww - addwiki cli tool');
$awwApp->addCommands(array(new Addwiki\Commands\Config\Setup($awwConfig), new Addwiki\Commands\Config\ConfigList($awwConfig), new Addwiki\Commands\Config\SetDefaultWiki($awwConfig), new Addwiki\Commands\Config\SetDefaultUser($awwConfig)));
foreach ($GLOBALS['awwCommands'] as $callback) {
    if (is_callable($callback)) {
        $awwApp->addCommands(call_user_func($callback, $awwConfig));
    }
}
$awwApp->run();
Example #18
0
 public function run($args = array())
 {
     $defaults = array('proxy' => array('auto' => true, 'path' => LITHIUM_APP_PATH . '/resources/tmp/cache/Doctrine/Proxies', 'namespace' => 'Doctrine\\Proxies'), 'useModelDriver' => true, 'mapping' => array('class' => null, 'path' => LITHIUM_APP_PATH . '/models'), 'configuration' => null, 'eventManager' => null);
     if ($this->request->params['action'] != 'run') {
         $args = $this->request->argv;
     }
     // Check if we need to add the migration configuration file
     $migrationCommand = false;
     $migrationConfig = true;
     $migration = false;
     $conn = Connections::get($this->connection);
     $conn->_config = $conn->_config + $defaults;
     $i = 0;
     foreach ($args as &$arg) {
         if (strstr($arg, 'migrations:')) {
             $migrationCommand = true;
         }
         if (strstr($arg, 'migrations')) {
             $migration = true;
         }
         if (strstr($arg, '--configuration=')) {
             $migrationConfig = false;
         }
         if (strstr($arg, '--connection')) {
             unset($args[$i]);
         }
         $i++;
     }
     if ($migrationCommand && $migrationConfig) {
         $args[] = '--configuration=' . LITHIUM_APP_PATH . '/config/migrations.yml';
     }
     $input = new \Symfony\Component\Console\Input\ArgvInput($args);
     if (!$conn || !$conn instanceof \app\extensions\data\source\Doctrine) {
         $error = "Error: Could not get Doctrine proxy object from Connections, using";
         $error .= " configuration '{$this->connection}'. Please add the connection or choose";
         $error .= " an alternate configuration using the `--connection` flag.";
         $this->error($error);
         return;
     }
     /*
      * New Doctrine ORM Configuration
      * TODO: load multiple drivers [Annotations, YAML & XML]
      * 
      */
     $config = new \Doctrine\ORM\Configuration();
     $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     //Annotation Driver
     $driver = $config->newDefaultAnnotationDriver(array(LITHIUM_APP_PATH . '/models'));
     $config->setMetadataDriverImpl($driver);
     //Proxy configuration
     $config->setProxyDir($conn->_config['proxy']['path']);
     $config->setProxyNamespace($conn->_config['proxy']['namespace']);
     //EntityManager
     $em = \Doctrine\ORM\EntityManager::create($conn->_config, $config);
     $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array('db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em), 'dialog' => new \Symfony\Component\Console\Helper\DialogHelper()));
     //CLI
     $cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', \Doctrine\Common\Version::VERSION);
     $cli->setCatchExceptions(true);
     $cli->register('doctrine');
     $cli->setHelperSet($helperSet);
     $cli->addCommands(array(new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand()));
     // If command called is a doctrine migration command
     if ($migration) {
         $cli->addCommands(array(new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand()));
     }
     $cli->run($input);
 }
Example #19
0
<?php

$vendorDir = __DIR__ . '/../lib/vendor';
require_once $vendorDir . '/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine', dirname($vendorDir));
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', $vendorDir);
$classLoader->register();
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
    if (!is_readable($configFile)) {
        trigger_error('Configuration file [' . $configFile . '] does not have read permission.', E_ERROR);
    }
    require $configFile;
    foreach ($GLOBALS as $helperSetCandidate) {
        if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
            $helperSet = $helperSetCandidate;
            break;
        }
    }
}
$helperSet = $helperSet ?: new \Symfony\Component\Console\Helper\HelperSet();
$cli = new \Symfony\Component\Console\Application('Doctrine ODM MongoDB Command Line Interface', Doctrine\ODM\MongoDB\Version::VERSION);
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\CreateCommand(), new \Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\DropCommand()));
$cli->run();
Example #20
0
File: cli.php Project: ud223/yj
<?php

// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
require 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
$system_application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$system_application->bootstrap();
$loader = new Symfony\Component\ClassLoader\UniversalClassLoader();
$loader->registerNamespace('Symfony', APPLICATION_PATH . '/../library');
$loader->registerNamespace('Angel', APPLICATION_PATH . '/../library');
$loader->register();
$application = new Symfony\Component\Console\Application();
$application->addCommands(array(new Angel\Command\LoadCity($system_application)));
$application->run();
Example #21
0
<?php

namespace PartKeepr\Console;

use PartKeepr\PartKeepr;
include "src/backend/PartKeepr/PartKeepr.php";
PartKeepr::initializeClassLoaders();
PartKeepr::initializeConfig();
$cli = new \Symfony\Component\Console\Application('PartKeepr Console', \PartKeepr\PartKeeprVersion::PARTKEEPR_VERSION);
$cli->setCatchExceptions(true);
try {
    PartKeepr::initializeDoctrine();
    $helperSet = $cli->getHelperSet();
    $helpers = array('db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper(PartKeepr::getEM()->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper(PartKeepr::getEM()));
    foreach ($helpers as $name => $helper) {
        $helperSet->set($helper, $name);
    }
} catch (\Exception $e) {
}
$cli->addCommands(array(new \PartKeepr\Console\Commands\MinifyJSCommand(), new \PartKeepr\Console\Commands\ListServicesCommand(), new \PartKeepr\Console\Commands\ListCallsCommand(), new \PartKeepr\Console\Commands\DescribeCallCommand(), new \PartKeepr\Console\Commands\DescribeTypeCommand()));
$cli->run();
<?php

date_default_timezone_set('UTC');
set_time_limit(0);
include_once __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
$app = new \Symfony\Component\Console\Application('MySQL Extractor', '1.0.2');
// reset
$app->setDefinition(new \Symfony\Component\Console\Input\InputDefinition([new InputArgument('command', InputArgument::REQUIRED, 'The command to execute')]));
// commands
$app->addCommands([new MySQLExtractor\Console\Command\SnapshotCompareCommand(), new MySQLExtractor\Console\Command\SnapshotCreateCommand(), new MySQLExtractor\Console\Command\SyncCompareCommand()]);
try {
    $app->run();
} catch (\Exception $e) {
    echo 'ERROR: ' . $e->getMessage() . PHP_EOL . 'File: ' . $e->getFile() . ' (' . $e->getLine() . ')' . PHP_EOL;
}
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the LGPL. For more information, see
 * <http://www.doctrine-project.org>.
 */
Phar::mapPhar();
require_once 'phar://' . __FILE__ . '/Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\\Common', 'phar://' . __FILE__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\\DBAL', 'phar://' . __FILE__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'phar://' . __FILE__ . '/Doctrine');
$classLoader->register();
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array('dialog' => new \Symfony\Component\Console\Helper\DialogHelper()));
$cli = new \Symfony\Component\Console\Application('Doctrine Migrations', \Doctrine\DBAL\Migrations\MigrationsVersion::VERSION);
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand()));
$input = file_exists('migrations-input.php') ? include 'migrations-input.php' : null;
$output = file_exists('migrations-output.php') ? include 'migrations-output.php' : null;
$cli->run($input, $output);
Example #24
0
<?php

define('APPLICATION_ENV', 'cli');
require_once __DIR__ . '/../application.php';
$application->bootstrap();
// Retrieve Doctrine Entity Manager
$em = Zend_Registry::get('container')->getService('em');
// Console
$cli = new \Symfony\Component\Console\Application('Newscoop Command Line Interface', \Newscoop\Version::VERSION);
try {
    // Bootstrapping Console HelperSet
    $helperSet = array();
    if ($em !== null) {
        $helperSet['container'] = new \Newscoop\Tools\Console\Helper\ServiceContainerHelper($application->getBootstrap()->getResource('container'));
    }
} catch (\Exception $e) {
    $cli->renderException($e, new \Symfony\Component\Console\Output\ConsoleOutput());
}
$cli->setCatchExceptions(true);
$cli->setHelperSet(new \Symfony\Component\Console\Helper\HelperSet($helperSet));
$cli->addCommands(array(new \Newscoop\Tools\Console\Command\UpdateIngestCommand(), new \Newscoop\Tools\Console\Command\LogMaintenanceCommand(), new \Newscoop\Tools\Console\Command\SendStatsCommand(), new \Newscoop\Tools\Console\Command\UpdateImageStorageCommand()));
$cli->run();
Example #25
0
<?php

/*
* This file is part of rg\broker.
*
* (c) ResearchGate GmbH <*****@*****.**>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require __DIR__ . '/config.php';
require __DIR__ . '/autoload.php';
$cli = new \Symfony\Component\Console\Application('rg\\broker', '0.1.0');
$cli->setCatchExceptions(true);
$cli->addCommands(array(new \rg\broker\commands\AddRepository(), new \rg\broker\commands\RemoveRepository()));
$cli->run();
    return $storage;
});
$container->register('Persistence\\Gateway\\Schema\\MySQL', function (StorageInterface $storage) use($container) {
    /** @var DataMapperInterface $dataMapper */
    $dataMapper = $container->resolve('Persistence\\DataMapper\\Schema');
    $gateway = new MySQLGateway($storage, $dataMapper);
    return $gateway;
});
$container->register('Persistence\\DataMapper\\Schema', function () {
    $dataMapper = new SchemaDataMapper();
    return $dataMapper;
});
$container->register('Domain\\Mapper\\Schema', function () {
    $dataMapper = new SchemaMapper();
    return $dataMapper;
});
$container->register('Infrastructure\\Services\\Schema', function (GatewayInterface $gateway, MapperInterface $mapper) {
    $repository = new SchemaRepository($gateway, $mapper);
    $service = new SchemaService($repository);
    return $service;
});
$app = new \Symfony\Component\Console\Application('MySQL Database Inspector', '1.0.0');
// reset
$app->setDefinition(new \Symfony\Component\Console\Input\InputDefinition([new InputArgument('command', InputArgument::REQUIRED, 'The command to execute')]));
// commands
$app->addCommands([new \DatabaseInspect\Console\Command\DetailsCommand($container)]);
try {
    $app->run();
} catch (\Exception $e) {
    echo 'ERROR: ' . $e->getMessage() . PHP_EOL . 'File: ' . $e->getFile() . ' (' . $e->getLine() . ')' . PHP_EOL;
}
Example #27
0
<?php

$application = new \Symfony\Component\Console\Application('SlimApi', '@package_version@');
$application->addCommands($container->get('commands'));
$application->run();
Example #28
0
$config = (include $appRoot . '/resources/map-config.php');
$loader = new ResourceLoader();
$serverZonesFile = $loader->getFilePath('server.json');
$worldZonesFile = $loader->getFilePath('world.json');
$labelsFile = $loader->getFilePath('labels.json');
//$db = new SQLite3(__DIR__ . '/../app/maptiles.sqlite3');
//if (!$db->querySingle('SELECT 1 FROM sqlite_master WHERE type = "table" and name = "map"')) {
//    $sql = file_get_contents(__DIR__ . '/../app/maptiles-schema.sql');
//    if (!$db->exec($sql)) {
//        $err = $db->lastErrorMsg();
//        throw new \RuntimeException("Failed to create maptiles.sqlite3 database ({$err})");
//    }
//}
//$tilestorage = new \Bmsite\Maps\TileStorage($db);
$tilestorage = new \Bmsite\Maps\Tiles\FileTileStorage($appRoot . '/tiles');
$resources = new ResourceHelper();
$resources->set('app.path', $appRoot);
$resources->set('map-config', $config);
$resources->set('server.json.array', $loader->loadJson('server.json'), true);
$resources->set('world.json.array', $loader->loadJson('world.json'), true);
$resources->set('labels.json.array', $loader->loadJson('labels.json'), true);
$resources->set('tilestorage', $tilestorage);
$helperSet = new \Symfony\Component\Console\Helper\HelperSet();
$helperSet->set($resources);
$helperSet->set(new \Bmsite\Maps\Tools\Console\Helper\TranslateHelper());
$helperSet->set(new \Bmsite\Maps\Tools\Console\Helper\RegionsHelper());
$cli = new \Symfony\Component\Console\Application('Bmsite Ryzom Map Tiles', '0.1');
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \Bmsite\Maps\Tools\Console\Command\BuildMapTiles()));
$cli->run();
Example #29
0
<?php

chdir('..');
require_once 'Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
$classLoader->register();
//$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$configFile = 'bin/cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
    if (!is_readable($configFile)) {
        trigger_error('Configuration file [' . $configFile . '] does not have read permission.', E_ERROR);
    }
    require $configFile;
    foreach ($GLOBALS as $helperSetCandidate) {
        if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
            $helperSet = $helperSetCandidate;
            break;
        }
    }
}
$helperSet = $helperSet ?: new \Symfony\Component\Console\Helper\HelperSet();
$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\ORM\Version::VERSION);
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand()));
$cli->run();
        if (file_exists($configFile)) {
            $configFound = true;
            break;
        }
    }
    if (!$found) {
        throw new \Exception("Cannot find configuration file '{$configFile}'");
    }
    $config = (include $configFile);
    if (!$config) {
        throw new \Exception("Cannot parse or empty configuration file '{$configFile}'");
    }
} catch (\Exception $e) {
    echo $e->getMessage() . "\n";
    exit(1);
}
$setup = new OpenstoreSchema\Core\Tools\Setup($config['database'], $config['paths'], $config['namespace']);
$setup->setEnvironment($config['env']);
$setup->setProxyPath($config['proxy_path']);
$em = $setup->getEntityManager();
$cli = new Symfony\Component\Console\Application('openstore-schema-core console', '1.0.0');
$cli->setCatchExceptions(true);
// commands
$cli->addCommands(array(new Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), new Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), new Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), new Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), new Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), new Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), new Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), new Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), new Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), new Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(), new Doctrine\ORM\Tools\Console\Command\InfoCommand(), new OpenstoreSchema\Core\Tools\Console\Command\Schema\CreateCommand(), new OpenstoreSchema\Core\Tools\Console\Command\Schema\RecreateExtraCommand(), new OpenstoreSchema\Core\Tools\Console\Command\Schema\UpdateCommand(), new OpenstoreSchema\Core\Tools\Console\Command\Schema\DropCommand()));
// helpers
$helpers = array('db' => new Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 'em' => new Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em), 'question' => new Symfony\Component\Console\Helper\QuestionHelper());
foreach ($helpers as $name => $helper) {
    $cli->getHelperSet()->set($helper, $name);
}
$cli->run();
//return $cli;