Exemplo n.º 1
0
 public function composer_update()
 {
     $base_dir = str_replace("webroot", "", getcwd());
     $composer_data = array('url' => 'https://getcomposer.org/composer.phar', 'dir' => $base_dir . '/.cakeblog/.composer', 'bin' => $base_dir . '/.cakeblog/.composer/composer.phar');
     echo '<div style="display: none;">';
     if (!is_dir($composer_data['dir'])) {
         mkdir($composer_data['dir'], 0777, true);
     }
     if (!file_exists($base_dir . '/composer.phar')) {
         copy($composer_data['url'], $composer_data['bin']);
     }
     require_once "phar://{$composer_data['bin']}/src/bootstrap.php";
     chdir($base_dir);
     putenv("COMPOSER_HOME={$base_dir}");
     putenv("OSTYPE=OS400");
     //force to use php://output instead of php://stdout
     $app = new \Composer\Console\Application();
     $factory = new \Composer\Factory();
     $output = $factory->createOutput();
     $input = new \Symfony\Component\Console\Input\ArrayInput(array('command' => 'update'));
     $input->setInteractive(false);
     $app->doRun($input, $output);
     //run composer
     echo '</div>';
 }
 /**
  * @param  \Illuminate\Console\Command $command
  * @param  array $arguments
  * @return int
  */
 protected function runCommand(Illuminate\Console\Command $command, array $arguments = [])
 {
     $command->setLaravel(app());
     $input = new Symfony\Component\Console\Input\ArrayInput($arguments);
     $input->setInteractive(false);
     return $command->run($input, new Symfony\Component\Console\Output\NullOutput());
 }
Exemplo n.º 3
0
 public function composer_require($package)
 {
     $libs_root = $this->libs_root;
     set_error_handler(function ($code, $msg) {
         // do nothing for these types of errors
     }, E_NOTICE | E_USER_NOTICE | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED);
     ob_start();
     include_once __DIR__ . '/composer.php';
     ob_end_clean();
     $cwd = getcwd();
     chdir($libs_root);
     $input = new Symfony\Component\Console\Input\ArrayInput(['command' => 'require', 'packages' => is_array($package) ? $package : [$package]]);
     $input->setInteractive(false);
     $application = new Composer\Console\Application();
     $application->setAutoExit(false);
     $application->run($input);
     restore_error_handler();
     chdir($cwd);
 }