-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from williamdes/master
- Loading branch information
Showing
10 changed files
with
140 additions
and
190 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace SilverStripe\ApiDocs\RemoteRepository; | ||
|
||
use Doctum\RemoteRepository\AbstractRemoteRepository; | ||
use SilverStripe\ApiDocs\Data\Config; | ||
|
||
class SilverStripeRemoteRepository extends AbstractRemoteRepository | ||
{ | ||
|
||
public function getFileUrl($projectVersion, $relativePath, $line) | ||
{ | ||
// $this->localPath is the root path to packages | ||
// Example: /mnt/Dev/@code-lts/@doctum-fork/api.silverstripe.org/data/packages/ | ||
// $this->name is empty, and not used | ||
// $relativePath for the current file | ||
// Example "silverstripe/admin/code/AdminRootController.php" | ||
$pathParts = explode('/', $relativePath, 3); | ||
// Example: [silverstripe, admin, code/AdminRootController.php] | ||
$this->name = $pathParts[0] . '/' . $pathParts[1]; | ||
|
||
$packageConfig = Config::getConfig()['packages'][$this->name]; | ||
$rootPath = $packageConfig['repository']; | ||
if (substr($rootPath, -4) === '.git') { | ||
$rootPath = substr($rootPath, 0, -4); | ||
} | ||
if (isset($packageConfig['versionmap'])) { | ||
$versionMaps = Config::getConfig()['versionmaps']; | ||
$projectVersion = $versionMaps[$packageConfig['versionmap']][(string) $projectVersion] ?? $projectVersion; | ||
} | ||
$url = $rootPath . '/blob/' . $this->buildProjectPath($projectVersion, $pathParts[2]); | ||
|
||
if (null !== $line) { | ||
$url .= '#L' . (int) $line; | ||
} | ||
|
||
return $url; | ||
} | ||
} |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.