Example #1
0
 /**
  * Get the Artisan console instance.
  *
  * @return \Illuminate\Console\Application
  */
 protected function getArtisan()
 {
     if (!is_null($this->artisan)) {
         return $this->artisan;
     }
     $this->app->loadDeferredProviders();
     $this->artisan = ConsoleApplication::make($this->app);
     return $this->artisan->boot();
 }
 /**
  * Get the Artisan console instance.
  *
  * @return \Illuminate\Console\Application
  */
 protected function getWel()
 {
     if (!is_null($this->wel)) {
         return $this->wel;
     }
     $this->app->loadDeferredProviders();
     $this->wel = ConsoleApplication::make($this->app);
     return $this->wel->boot();
 }
 function it_will_run_seeder_with_custom_class_if_told_to(Console $console)
 {
     $console->call('migrate:install')->shouldBeCalled();
     $console->call('migrate:refresh')->shouldBeCalled();
     $console->call('db:seed', array('--class' => 'MyDatabaseSeeder'))->shouldBeCalled();
     $this->appInst->setRequestForConsoleEnvironment()->shouldBeCalled();
     $this->appInst->boot()->shouldBeCalled();
     $this->appInst->make('artisan')->shouldBeCalled();
     $this->appInst->make('artisan')->willReturn($console);
     $this->beConstructedWith(null, '.');
     $this->setMigrateDatabase(true);
     $this->setSeedDatabase(true, 'MyDatabaseSeeder');
     $this->refreshApplication($this->appInst);
 }
Example #4
0
 /**
  * Display the application's help.
  *
  * @return string
  */
 public function getHelp()
 {
     $help = str_replace($this->getLongVersion(), null, parent::getHelp());
     $state = $this->buildBlock('Current state', $this->getCurrentState());
     $help = sprintf('%s' . PHP_EOL . PHP_EOL . '%s%s', $this->getLongVersion(), $state, $help);
     return $help;
 }
 /**
  * Runs a command and returns it output
  *
  * @param \Symfony\Component\HttpKernel\Client $client
  * @param                                      $command
  *
  * @return string|\Symfony\Component\Console\Output\StreamOutput
  */
 public function runCommand(Client $client, $command)
 {
     $application = new Application($client->getKernel());
     $application->setAutoExit(false);
     $fp = tmpfile();
     $input = new StringInput($command);
     $output = new StreamOutput($fp);
     $application->run($input, $output);
     fseek($fp, 0);
     $output = '';
     while (!feof($fp)) {
         $output = fread($fp, 4096);
     }
     fclose($fp);
     return $output;
 }
 /**
  * Overridden so that the application doesn't expect the command
  * name to be the first argument.
  */
 public function getDefinition()
 {
     $inputDefinition = parent::getDefinition();
     // clear out the normal first argument, which is the command name
     $inputDefinition->setArguments();
     return $inputDefinition;
 }
Example #7
0
 /**
  * Add a new Artisan command event to the schedule.
  *
  * @param  string  $command
  * @param  array  $parameters
  * @return \Illuminate\Console\Scheduling\Event
  */
 public function command($command, array $parameters = [])
 {
     if (class_exists($command)) {
         $command = Container::getInstance()->make($command)->getName();
     }
     return $this->exec(Application::formatCommandString($command), $parameters);
 }
Example #8
0
 /**
  * Get the Artisan console instance.
  *
  * @return Illuminate\Console\Application
  */
 protected function getArtisan()
 {
     if (!is_null($this->artisan)) {
         return $this->artisan;
     }
     return $this->artisan = ConsoleApplication::start($this->app);
 }
Example #9
0
 /**
  * Scanner constructor.
  *
  * @param Container|null  $container
  * @param Dispatcher|null $events
  */
 public function __construct(Container $container = null, Dispatcher $events = null)
 {
     $container = $container ?: new Container();
     $this->bindings($container, [EventServiceProvider::class, FilesystemServiceProvider::class, PipelineServiceProvider::class, AliasesServiceProvider::class, ConfigServiceProvider::class, VulnDBServiceProvider::class]);
     $events = $events ?: $container->make('events');
     parent::__construct($container, $events, static::VERSION);
     $this->setName('Wordpress Vulnerabilities Scanner');
 }
Example #10
0
 public function __construct($container)
 {
     parent::__construct('forge-cli', 0.1);
     $this->setLaravel($container);
     // Register the deploy command
     $this->add(new DeployCommand());
     $this->add(new AddSiteCommand());
 }
Example #11
0
 public function __construct(Container $container)
 {
     parent::__construct('XenForo Developer Toolkit', '1.0-dev');
     $this->setContainer($container);
     $container['app'] = $this;
     $container->alias('app', 'Robbo\\XfToolkit\\Application');
     $container->bindShared('xenforo', function ($container) {
         return new XenForo($this, new Filesystem());
     });
     $container->alias('xenforo', 'Robbo\\XfToolkit\\XenForo');
     $this->registerBundledCommands();
 }
Example #12
0
 /**
  * Setup the application
  */
 public function __construct()
 {
     parent::__construct('Satellite', '0.1.0');
     // Setup application's dependencies
     $app = new Container();
     $provider = new SatelliteServiceProvider($app);
     $provider->register();
     // Register services
     $this->laravel = $app;
     // Add commands
     $this->resolveCommands(array('Rocketeer\\Satellite\\Console\\Commands\\Setup', 'Rocketeer\\Satellite\\Console\\Commands\\ListApplications', 'Rocketeer\\Satellite\\Console\\Commands\\Deploy', 'Rocketeer\\Satellite\\Console\\Commands\\Update'));
 }
Example #13
0
 public function run()
 {
     if (!$this->checkUser()) {
         echo '<p>' . Lang::get('web-artisan::webartisan.terminal.needlogin') . '</p>';
         return;
     }
     $parts = explode(" ", Input::get('cmd'));
     if (count($parts) < 2) {
         echo '<p>' . Lang::get('web-artisan::webartisan.terminal.invalidcmd') . '</p>';
         return;
     }
     //first is "artisan" so remove it
     unset($parts[0]);
     //second is the command
     $cmd = $parts[1];
     unset($parts[1]);
     $app = app();
     $app->loadDeferredProviders();
     $artisan = ConsoleApplication::start($app);
     $command = $artisan->find($cmd);
     $def = $command->getDefinition();
     $arguments = $def->getArguments();
     $fix = array();
     foreach ($arguments as $argument) {
         $fix[] = $argument->getName();
     }
     $arguments = $fix;
     $params = array();
     //the rest should be the parameter list
     $i = 0;
     //The counter for our argument list
     foreach ($parts as $param) {
         // foo=bar, we don't need to work more
         if (strpos($param, "=") !== false) {
             $param = explode("=", $param, 2);
             $params[$param[0]] = $param[1];
         } else {
             //Do we have an argument or an option?
             if (substr($param, 0, 1) == "-") {
                 $params[$param] = true;
                 //Option, simply set it to true
             } else {
                 //Argument, we need a bit work
                 $params[$arguments[$i]] = $param;
                 ++$i;
             }
         }
     }
     $params['command'] = $cmd;
     $input = new ArrayInput($params);
     $command->run($input, new Output());
 }
Example #14
0
 public function __construct()
 {
     $container = $this->initialize();
     if ($this->laravelVersion === 5) {
         parent::__construct($container, $container['events'], self::VERSION);
         $this->setCatchExceptions(true);
         $this->setName(self::NAME);
     } else {
         parent::__construct(self::NAME, self::VERSION);
         $this->setLaravel($container);
         $this->boot();
     }
     $this->loadMigrations($container);
 }
Example #15
0
 /**
  * Console constructor.
  *
  * @param ConfigInterface $config
  * @param Paths           $paths
  * @param string          $version
  */
 public function __construct(ConfigInterface $config, Paths $paths, $version = \F9\Application\Application::VERSION)
 {
     $this->config = $config;
     $this->paths = $paths;
     /** @var Container $app */
     $app = Forge::find('app');
     // the parent is a hijacked copy of the illuminate console application.
     // we hijacked it mainly to override a few properties - such as the title.
     parent::__construct(forge('illuminate.container'), forge('illuminate.events'), $version);
     //$this->bootSettings();
     $this->configureEnvironment();
     // in all cases, register the framework commands
     $this->registerFrameworkCommands();
     // register the cloned artisan commands
     $this->registerArtisanCommands();
 }
 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @throws \Exception When doRun returns Exception
  *
  * @return int 0 if everything went fine, or an error code
  */
 public function run(InputInterface $input = null, OutputInterface $output = null)
 {
     try {
         return parent::run($input, $output);
     } catch (Exception $e) {
         if ($this->isAjax() === false) {
             throw $e;
         }
         while ($prevException = $e->getPrevious()) {
             $e = $prevException;
         }
         $this->renderException($e, $output);
         return 1;
     } catch (Throwable $e) {
         if ($this->isAjax() === false) {
             throw $e;
         }
         $e = new FatalThrowableError($e);
         $this->renderException($e, $output);
         return 1;
     }
 }
Example #17
0
 /**
  * Sets the default Command name.
  *
  * @param string $commandName The Command name
  * @static 
  */
 public static function setDefaultCommand($commandName)
 {
     //Method inherited from \Symfony\Component\Console\Application
     return \Illuminate\Console\Application::setDefaultCommand($commandName);
 }
 /**
  * Get the default definition.
  *
  * @return \Symfony\Component\Console\Input\InputDefinition
  */
 protected function getDefaultInputDefinition()
 {
     $definition = parent::getDefaultInputDefinition();
     $definition->addOption($this->getApplicationReferenceOption());
     return $definition;
 }
 public function __construct(Container $laravel, Dispatcher $events, $version, SymfonyApplication $application)
 {
     $this->application = $application;
     parent::__construct($laravel, $events, $version);
 }
Example #20
0
 public function getHelp()
 {
     return parent::getHelp();
     // TODO: Change the autogenerated stub
 }
Example #21
0
 /**
  * Set application name
  *
  * @param Container $container
  * @param Dispatcher $events
  * @param string $version
  */
 public function __construct(Container $container, Dispatcher $events, $version)
 {
     parent::__construct($container, $events, $version);
     $this->setName('GitHook');
 }
 /**
  * Get the default input definitions for the applications.
  *
  * @return \Symfony\Component\Console\Input\InputDefinition
  */
 protected function getDefaultInputDefinition()
 {
     $definition = parent::getDefaultInputDefinition();
     $definition->addOption($this->getDomainOption());
     return $definition;
 }
Example #23
0
 /**
  * Register a Closure based command with the application.
  *
  * @param  string  $signature
  * @param  Closure  $callback
  * @return \Illuminate\Foundation\Console\ClosureCommand
  */
 public function command($signature, Closure $callback)
 {
     $command = new ClosureCommand($signature, $callback);
     Artisan::starting(function ($artisan) use($command) {
         $artisan->add($command);
     });
     return $command;
 }
Example #24
0
 /**
  * Register the package's custom Artisan commands.
  *
  * @param  array|mixed  $commands
  * @return void
  */
 public function commands($commands)
 {
     $commands = is_array($commands) ? $commands : func_get_args();
     Artisan::starting(function ($artisan) use($commands) {
         $artisan->resolveCommands($commands);
     });
 }
Example #25
0
 /**
  * Get the output for the last run command.
  *
  * @return string
  */
 public function output()
 {
     return $this->artisan->output();
 }
Example #26
0
 /**
  * Returns the namespace part of the command name.
  * 
  * This method is not part of public API and should not be used directly.
  *
  * @param string $name The full name of the command
  * @param string $limit The maximum number of parts of the namespace
  * @return string The namespace of the command
  * @static 
  */
 public static function extractNamespace($name, $limit = null)
 {
     //Method inherited from \Symfony\Component\Console\Application
     return \Illuminate\Console\Application::extractNamespace($name, $limit);
 }
Example #27
0
 /**
  * Display the application's help
  *
  * @return string
  */
 public function getHelp()
 {
     $help = str_replace($this->getLongVersion(), null, parent::getHelp());
     return $this->getLongVersion() . PHP_EOL . PHP_EOL . $this->buildBlock('Current state', $this->getCurrentState()) . $help;
 }
Example #28
0
 public function __construct(Container $laravel, Dispatcher $events, $version)
 {
     parent::__construct($laravel, $events, $version);
     #parent::__construct($laravel, new \Illuminate\Events\Dispatcher($laravel), $version);
 }
Example #29
0
 /**
  * Get the Artisan application instance.
  *
  * @return \Illuminate\Console\Application
  */
 protected function getArtisan()
 {
     if (is_null($this->artisan)) {
         $art = new Artisan($this->app, $this->events, $this->app->version());
         return $this->artisan = $art->resolveCommands($this->commands);
     }
     return $this->artisan;
 }
Example #30
0
 /**
  * Application constructor.
  *
  * @param \Illuminate\Container\Container         $container
  * @param \Illuminate\Contracts\Events\Dispatcher $events
  * @param                                         $version
  */
 public function __construct(Container $container, Dispatcher $events, $version)
 {
     parent::__construct($container, $events, $version);
     $this->container = $container;
 }