forked from yiisoft/yii2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added --useHttp option to dev command
allows to clone repos using HTTP only, not SSH issue yiisoft#3267
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,11 @@ class DevController extends Controller | |
{ | ||
public $defaultAction = 'all'; | ||
|
||
/** | ||
* @var bool whether to use HTTP when cloning github repositories | ||
*/ | ||
public $useHttp = false; | ||
|
||
public $apps = [ | ||
'basic' => '[email protected]:yiisoft/yii2-app-basic.git', | ||
'advanced' => '[email protected]:yiisoft/yii2-app-advanced.git', | ||
|
@@ -63,14 +68,14 @@ public function actionAll() | |
} | ||
|
||
foreach($this->extensions as $ext => $repo) { | ||
$ret = $this->actionExt($ext, $repo); | ||
$ret = $this->actionExt($ext); | ||
if ($ret !== 0) { | ||
return $ret; | ||
} | ||
} | ||
|
||
foreach($this->apps as $app => $repo) { | ||
$ret = $this->actionApp($app, $repo); | ||
$ret = $this->actionApp($app); | ||
if ($ret !== 0) { | ||
return $ret; | ||
} | ||
|
@@ -136,6 +141,9 @@ public function actionApp($app, $repo = null) | |
if (empty($repo)) { | ||
if (isset($this->apps[$app])) { | ||
$repo = $this->apps[$app]; | ||
if ($this->useHttp) { | ||
$repo = str_replace('[email protected]:', 'https://github.com/', $repo); | ||
} | ||
} else { | ||
$this->stderr("Repo argument is required for app '$app'.\n", Console::FG_RED); | ||
return 1; | ||
|
@@ -182,6 +190,9 @@ public function actionExt($extension, $repo = null) | |
if (empty($repo)) { | ||
if (isset($this->extensions[$extension])) { | ||
$repo = $this->extensions[$extension]; | ||
if ($this->useHttp) { | ||
$repo = str_replace('[email protected]:', 'https://github.com/', $repo); | ||
} | ||
} else { | ||
$this->stderr("Repo argument is required for extension '$extension'.\n", Console::FG_RED); | ||
return 1; | ||
|
@@ -212,6 +223,15 @@ public function actionExt($extension, $repo = null) | |
return 0; | ||
} | ||
|
||
public function options($actionID) | ||
{ | ||
$options = parent::options($actionID); | ||
if (in_array($actionID, ['ext', 'app', 'all'])) { | ||
$options[] = 'useHttp'; | ||
} | ||
return $options; | ||
} | ||
|
||
|
||
protected function cleanupVendorDir($dir) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters