Skip to content

Commit 8fd15eb

Browse files
committed
Fix overzealous github auth check (let cms handle at time of exception).
1 parent c5882aa commit 8fd15eb

1 file changed

Lines changed: 0 additions & 66 deletions

File tree

src/NewCommand.php

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class NewCommand extends Command
3131
public $absolutePath;
3232
public $name;
3333
public $starterKit;
34-
public $starterKitVcs;
3534
public $starterKitLicense;
3635
public $local;
3736
public $withConfig;
@@ -85,8 +84,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
8584

8685
$this
8786
->askForRepo()
88-
->detectRepoVcs()
89-
->detectMissingVcsAuth()
9087
->validateStarterKitLicense()
9188
->installBaseProject()
9289
->installStarterKit()
@@ -266,54 +263,6 @@ protected function askForRepo()
266263
return $this;
267264
}
268265

269-
/**
270-
* Detect starter kit repo vcs, using same precedence logic used in statamic/cms.
271-
*
272-
* @return $this
273-
*/
274-
protected function detectRepoVcs()
275-
{
276-
if ($this->local) {
277-
return $this;
278-
}
279-
280-
$request = new Client(['http_errors' => false]);
281-
282-
if ($request->get("https://repo.packagist.org/p2/{$this->starterKit}.json")->getStatusCode() === 200) {
283-
return $this;
284-
}
285-
286-
if ($request->get("https://github.com/{$this->starterKit}")->getStatusCode() === 200) {
287-
$this->starterKitVcs = 'github';
288-
} elseif ($request->get($bitbucketUrl = "https://bitbucket.org/{$this->starterKit}.git")->getStatusCode() === 200) {
289-
$this->starterKitVcs = 'bitbucket';
290-
} elseif ($request->get($gitlabUrl = "https://gitlab.com/{$this->starterKit}")->getStatusCode() === 200) {
291-
$this->starterKitVcs = 'gitlab';
292-
}
293-
294-
return $this;
295-
}
296-
297-
/**
298-
* Detect missing starter kit repo vcs auth, and prompt user to properly authenticate.
299-
*
300-
* @return $this
301-
*/
302-
protected function detectMissingVcsAuth()
303-
{
304-
if ($this->starterKitVcs === 'github' && $this->hasMissingComposerToken('github-oauth.github.com')) {
305-
$this->output->write(PHP_EOL);
306-
$this->output->write('<error>Composer could not authenticate with GitHub!</error>'.PHP_EOL);
307-
$this->output->write('<comment>Please generate a personal access token at: https://github.com/settings/tokens/new</comment>'.PHP_EOL);
308-
$this->output->write('<comment>Then save your token for future use by running the following command:</comment>'.PHP_EOL);
309-
$this->output->write('<comment>composer config --global --auth github-oauth.github.com [your-token-here]</comment>'.PHP_EOL);
310-
311-
return $this->exitInstallation();
312-
}
313-
314-
return $this;
315-
}
316-
317266
/**
318267
* Validate starter kit license.
319268
*
@@ -802,21 +751,6 @@ protected function getStarterKitLicense()
802751
return $license;
803752
}
804753

805-
/**
806-
* Check if user has missing composer token.
807-
*
808-
* @param string $tokenKey
809-
* @return bool
810-
*/
811-
protected function hasMissingComposerToken($tokenKey)
812-
{
813-
$composer = $this->findComposer();
814-
815-
return ! $this
816-
->runCommand("{$composer} config --global --auth {$tokenKey}", true)
817-
->isSuccessful();
818-
}
819-
820754
/**
821755
* Exit installation.
822756
*

0 commit comments

Comments
 (0)