コード例 #1
0
ファイル: Composer.php プロジェクト: robertbasic/usher
 /**
  * Execute the task
  *
  * @throws Exception
  * @return void
  */
 public function execute()
 {
     $config = $this->getOption('config');
     $projectPath = $this->getProjectOption('projectBase');
     $configString = Util\JsonHandler::output(json_encode($config));
     $currentDir = getcwd();
     $composerPath = $this->getOption('composerPath');
     if ($composerPath != null) {
         $this->_composerPath = $composerPath;
     } else {
         throw new \Exception('Composer path not found in congifuration (composerPath)');
     }
     $exec = 'php ' . $this->_composerPath . ' install';
     // composer doesn't let us specify the config on the command line
     // so let's write a temp file in our project path....
     if (is_dir($projectPath)) {
         chdir($projectPath);
         file_put_contents($this->_configFile, $configString);
         chdir($currentDir);
         // now run it!
         Console\Execute::run($exec, $projectPath);
     } else {
         throw new \Exception('Project directory not found! ' . $projectPath);
     }
 }
コード例 #2
0
ファイル: Pull.php プロジェクト: robertbasic/usher
 /**
  * Execute the task
  *
  * @return void
  */
 public function execute()
 {
     $destinationPath = $this->getOption('destinationPath');
     $currentDir = getcwd();
     // change to the destination directory
     chdir($destinationPath);
     \Usher\Lib\Console\Execute::run($this->_command);
     // change back to our working directory
     chdir($currentDir);
 }
コード例 #3
0
ファイル: Move.php プロジェクト: robertbasic/usher
 /**
  * Execute the task
  *
  * @throws Exception
  * @return void
  */
 public function execute()
 {
     $sourcePath = $this->getOption('source');
     $targetPath = $this->getOption('target');
     if ($sourcePath != null && $targetPath != null && is_file($sourcePath)) {
         $command = 'mv ' . $sourcePath . ' ' . $targetPath;
         \Usher\Lib\Console\Execute::run($command);
     } elseif (!is_file($sourcePath)) {
         throw new \Exception('Source file "' . $sourcePath . '" not found');
     }
 }
コード例 #4
0
ファイル: Clone.php プロジェクト: robertbasic/usher
 /**
  * Execute the task
  *
  * @throws Exception
  * @return void
  */
 public function execute()
 {
     $repositoryPath = $this->getOption('repositoryPath');
     $destinationPath = $this->getOption('destinationPath');
     if ($repositoryPath == null) {
         throw new \Exception('Repository path not set! (repoPath)');
     }
     if ($destinationPath == null) {
         throw new \Exception('Destination path not set! (destinationPath)');
     }
     $exec = 'git clone ' . $repositoryPath . ' ' . $destinationPath;
     $args = array('clone', $repositoryPath, $destinationPath);
     \Usher\Lib\Console\Execute::run($exec, $args);
 }