示例#1
0
 /**
  * Get the config values related to the development server.
  *
  * @param array $newConfig
  * @return array
  */
 protected function setupServe(array $newConfig)
 {
     $newConfig = array_dot($newConfig);
     if (array_get($newConfig, 'deploy.git.branch') != 'gh-pages') {
         return [];
     }
     $this->title('Local development server');
     $this->output->writeln(["When you publish to github pages, your site is available from username.github.io/projectname", "To help avoid problems with relative URLs, use a matching subdirectory for the local server.", ""]);
     return ['subdirectory' => $this->ask("Subdirectory to use for the <comment>steak serve</comment> command?", $this->git->parseRepositoryName(array_get($newConfig, 'deploy.git.url')))];
 }
示例#2
0
 /**
  * Returns the GitWorkingCopy object for a given repository.
  *
  * @param string $url
  *   The URL of the repository.
  *
  * @return \GitWrapper\GitWorkingCopy
  */
 public function getGit($repository)
 {
     if (!isset($this->_workingCopies[$repository])) {
         $name = GitWrapper::parseRepositoryName($repository);
         $directory = $this->getDataDir() . '/' . $name;
         $git = $this->getGitWrapper()->workingCopy($directory);
         if (!$git->isCloned()) {
             $git->clone($repository);
         } else {
             $git->pull()->clearOutput();
         }
         $this->_workingCopies[$repository] = $git;
     }
     return $this->_workingCopies[$repository];
 }
示例#3
0
 public function testParseRepositoryName()
 {
     $nameGit = GitWrapper::parseRepositoryName('git@github.com:cpliakas/git-wrapper.git');
     $this->assertEquals($nameGit, 'git-wrapper');
     $nameHttps = GitWrapper::parseRepositoryName('https://github.com/cpliakas/git-wrapper.git');
     $this->assertEquals($nameHttps, 'git-wrapper');
 }