示例#1
0
 public function testBash()
 {
     $scripts = ['travis_ci_script_1' => function ($input, $output) {
         # I must be able to call a CLI or any classes here
         CLI::process('echo "Testing CLI::handleCallback()"');
         $output->writeln("<comment>testing writeln with comment style</comment>");
         $output->writeln("<error>testing writeln with error style</error>");
         # also when returning an array or string
         # it should be able to handle this scripts
         return ['echo "Script 1: returning array in callback"'];
     }, 'travis_ci_script_2' => 'echo "Script 2: using CLI::process(<string>)"', 'travis_ci_script_3' => ['echo "Script 3: using CLI::bash(<array>)"'], 'travis_ci_script_4' => CLI::ssh('*****@*****.**', ['ls'], $execute = false), 'travis_ci_script_5' => function ($input, $output) {
         return 'echo "Script 5: returning string in callback"';
     }];
     # a callback, returning array
     CLI::handleCallback($scripts['travis_ci_script_1']);
     # a string
     CLI::process($scripts['travis_ci_script_2']);
     # an array
     CLI::bash($scripts['travis_ci_script_3']);
     # a generated ssh script
     // CLI::process($scripts['travis_ci_script_4']);
     # a callback, returning string
     CLI::handleCallback($scripts['travis_ci_script_5']);
     # this must automatically be executed, the third
     # parameter is automatically assigned as true
     // CLI::ssh('*****@*****.**', ['ls']);
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function slash()
 {
     $script = $this->input->getArgument('script');
     $lists = config()->script->toArray();
     if (isset($lists[$script]) === false) {
         $this->error("\nWe can't find `" . $script . '` in the lists of script.' . "\n");
         return;
     }
     foreach ($lists[$script] as $selected) {
         if (is_callable($selected)) {
             call_user_func($selected);
             continue;
         }
         if (!is_array($selected)) {
             CLI::process($selected);
             continue;
         }
         CLI::process(isset($selected['script']) ? $selected['script'] : null, isset($selected['prefix']) ? $selected['prefix'] : null, isset($selected['suffix']) ? $selected['suffix'] : null);
     }
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function slash()
 {
     $script = $this->input->getArgument('script');
     $lists = config()->script->toArray();
     if (isset($lists[$script]) === false) {
         $this->error("\nWe can't find `" . $script . '` in the lists of script.' . "\n");
         return;
     }
     foreach ($lists[$script] as $selected) {
         if (is_callable($selected)) {
             CLI::handleCallback($selected);
             continue;
         }
         if (is_array($selected)) {
             CLI::bash($selected);
             continue;
         }
         CLI::process($selected);
     }
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 public function slash()
 {
     CLI::bash(['php brood clear:cache', 'php brood clear:compiled', 'php brood clear:logs', 'php brood clear:session', 'php brood clear:views']);
 }
示例#5
0
 /**
  * Call the composer's dumpautoload.
  *
  * @return void
  */
 public function callDumpAutoload()
 {
     CLI::bash(['composer dumpautoload']);
 }
示例#6
0
<?php

use Clarity\Console\CLI;
return ['pull' => ['cd ' . config('path.root'), 'git pull origin master', 'php brood clear:cache', 'php brood clear:logs', 'php brood clear:session', 'php brood clear:views', 'php brood db:migrate', 'composer update', 'composer dumpautoload'], 'deploy' => [CLI::ssh('*****@*****.**', function () {
    return ['cd /var/www', 'ls'];
}, $execute = false)]];
# end of return
 /**
  * This calls the 'composer dumpautoload --optimize'.
  *
  * @return void
  */
 protected function callComposerOptimizer()
 {
     CLI::process('composer dumpautoload --optimize');
     $compiled_file = config('path.root') . '/storage/slayer/compiled.php';
     if (file_exists($compiled_file)) {
         $this->info('Removing previous compiled file...');
         unlink($compiled_file);
     }
 }