示例#1
0
 /**
  * Checks if a command is pre-defined.
  *
  * @return void
  * @author Dan Cox
  */
 public function hasDefinition(array $commands)
 {
     $cmd = $commands[0];
     if (ProcessDefinition::has($cmd)) {
         $pName = ProcessDefinition::get($cmd);
         $process = $this->DI->get($pName);
         unset($commands[0]);
         $process->build(['directory' => $this->input->getArgument('directory')]);
         if (!empty($commands)) {
             $process->setArguments(array_values($commands));
         }
         $p = $process->getProcess();
         return $p;
     }
     return false;
 }
示例#2
0
 /**
  * Check a single command for a definition in processes
  *
  * @return Process
  * @author Dan Cox
  */
 public function hasProcessDefinition($command)
 {
     $cmds = explode(' ', $command);
     if (ProcessDefinition::has($cmds[0])) {
         $name = ProcessDefinition::get($cmds[0]);
         $process = $this->DI->get($name);
         unset($cmds[0]);
         $process->build($this->params);
         if (!empty($cmds)) {
             $process->setArguments(array_values($cmds));
         }
         return $process->getProcess();
     }
     // If theres no definition, build a skeleton
     $process = $this->DI->get('skeletonprocess');
     $process->build($this->params);
     return $process->setArguments($cmds)->getProcess();
 }
示例#3
0
 /**
  * Now we have a definition, check the static method works
  *
  * @return void
  * @author Dan Cox
  */
 public function test_getStatic()
 {
     $this->assertTrue(ProcessDefinition::has('cmd'));
     $this->assertEquals($this->processMock, ProcessDefinition::get('cmd'));
 }
示例#4
0
 /**
  * Test the definition returns the correct process
  *
  * @return void
  * @author Dan Cox
  */
 public function test_definition()
 {
     $this->assertTrue(ProcessDefinition::has('ls'));
     $this->assertEquals('listprocess', ProcessDefinition::get('ls'));
 }
示例#5
0
 /**
  * Test the definition
  *
  * @return void
  * @author Dan Cox
  */
 public function test_definition()
 {
     $this->assertTrue(ProcessDefinition::has('composer'));
     $this->assertEquals('composerprocess', ProcessDefinition::get('composer'));
     $this->assertFalse(ProcessDefinition::has('fake'));
     $this->assertFalse(ProcessDefinition::get('fake'));
 }