This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
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 #11 from okta/develop
Version 0.1.0
- Loading branch information
Showing
4 changed files
with
101 additions
and
14 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
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,27 @@ | ||
<?php | ||
|
||
use Sami\Sami; | ||
use Symfony\Component\Finder\Finder; | ||
use Sami\Version\GitVersionCollection; | ||
use Sami\RemoteRepository\GitHubRemoteRepository; | ||
|
||
$dir = __DIR__ . '/src'; | ||
|
||
$iterator = Finder::create() | ||
->files() | ||
->name('*.php') | ||
->in($dir) | ||
; | ||
|
||
|
||
$versions = GitVersionCollection::create($dir) | ||
->addFromTags('*') | ||
; | ||
|
||
return new Sami($iterator, [ | ||
'title' => 'Okta PHP SDK', | ||
'versions' => $versions, | ||
'build_dir' => __DIR__ . '/build/gh-pages/%version%', | ||
'cache_dir' => __DIR__ . '/build/doc_cache/%version%', | ||
'remote_repository' => new GitHubRemoteRepository('okta/okta-sdk-php', dirname($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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Adapted from contentful.php | ||
*/ | ||
$travisRepoSlug = getenv('TRAVIS_REPO_SLUG'); | ||
$indexFile = $argv[1]; | ||
|
||
$shellOutput = shell_exec('git tag'); | ||
$tags = explode("\n", $shellOutput); | ||
$tags = array_filter($tags, function ($tag) { | ||
return trim($tag) !== ''; | ||
}); | ||
|
||
// We remove all non-stable versions from the list as we don't want to direct the docs to them by default | ||
$tags = array_filter($tags, function ($tag) { | ||
return strpos($tag, '-') === false; | ||
}); | ||
|
||
usort($tags, function ($a, $b) { | ||
return version_compare($b, $a); | ||
}); | ||
|
||
$newestTag = $tags[0]; | ||
$repoParts = explode('/', $travisRepoSlug); | ||
$repoOwner = $repoParts[0]; | ||
$repoName = $repoParts[1]; | ||
|
||
$html = '<meta http-equiv="refresh" content="0; url=https://developer.okta.com/' . $repoName . '/' . $newestTag . '/">'; | ||
|
||
file_put_contents($indexFile, $html); | ||
|
||
echo 'Created index file redirecting to ' . $newestTag . '.' . "\n"; |
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,9 @@ | ||
#!/usr/bin/env bash | ||
git clone https://github.com/${TRAVIS_REPO_SLUG}.git full | ||
cd full | ||
git checkout ${TRAVIS_TAG} | ||
php ../sami.phar update sami.php | ||
git checkout ${TRAVIS_TAG} | ||
mkdir build/gh-pages/latest | ||
php scripts/create-redirector.php build/gh-pages/latest/index.html | ||
php scripts/create-redirector.php build/gh-pages/index.html |