This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`docs.sh` and `docs.ps1` scripts created to locally host and view changes made to PRM documentation in the `docs/md/content` directory. Added information pertaining to the local installation of the docs site to the `README.md`. Added `docs/site` to .gitignore to prevent local site installation being visible to git.
- Loading branch information
petergmurphy
committed
Dec 20, 2021
1 parent
f8df8ab
commit 6cbb347
Showing
4 changed files
with
154 additions
and
0 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 |
---|---|---|
|
@@ -21,3 +21,6 @@ dist/ | |
.idea/ | ||
|
||
./prm | ||
|
||
# Documentation site | ||
docs/site |
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,61 @@ | ||
<# | ||
.Description | ||
A script to install the DevX documentation site in the docs\site directory and run it. | ||
If the site is already installed, executing this script will run the site locally. | ||
Changes and files added to the contents of the docs\md\content directory will be displayed on this | ||
locally hosted site. | ||
#> | ||
|
||
param( | ||
[Alias('D')] | ||
[Switch]$BuildDrafts | ||
) | ||
|
||
# Check working directory is the root directory of the PRM repository | ||
if (!(Test-Path -Path ".\docs\md")) { | ||
Throw 'Please run this script from the root directory of the PRM project.' | ||
} | ||
# Check hugo extended is installed | ||
if ([string]::IsNullOrEmpty((hugo version | Select-String -Pattern "extended"))) { | ||
Throw 'The "extended" version of hugo was not found, please install it.' | ||
} | ||
|
||
# Check that git and npm are installed | ||
$Programs = @('git', 'npm') | ||
foreach ($Program in $Programs) { | ||
try { | ||
Get-Command -Name $Program -ErrorAction Stop | ||
} | ||
catch { | ||
Throw "$Program was not found, please install it." | ||
} | ||
} | ||
|
||
# Check if the docs site directory exists | ||
if (!(Test-Path -Path ".\docs\site")) { | ||
git clone https://github.com/puppetlabs/devx.git docs\site | ||
Push-Location docs\site | ||
Add-Content -Path .\go.mod -value 'replace github.com/puppetlabs/prm/docs/md => ..\md' | ||
npm install | ||
} | ||
else { | ||
Push-Location docs\site | ||
git pull | ||
hugo mod clean | ||
} | ||
|
||
git submodule update --init --recursive --depth 50 | ||
hugo mod get | ||
# Check if -D flag is set to true | ||
try { | ||
if ($BuildDrafts) { | ||
hugo server -D | ||
} | ||
else { | ||
hugo server | ||
} | ||
} catch { | ||
|
||
} finally { | ||
Pop-Location | ||
} |
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,45 @@ | ||
#!/bin/sh | ||
|
||
# Check working directory is the root directory of the PRM repository | ||
if [ ! -d "docs/md" ]; then | ||
echo 'Please run this script from the root directory of the PRM project.' | ||
exit 1 | ||
fi | ||
# Check hugo extended is installed | ||
if ! hugo version | grep -q 'extended'; then | ||
echo 'The "extended" version of hugo was not found, please install it.' | ||
exit | ||
fi | ||
# Check git is installed | ||
if ! type "git" > /dev/null; then | ||
echo "Git version control was not found, please install it." | ||
exit | ||
fi | ||
# Check if npm is installed | ||
if ! type "npm" > /dev/null; then | ||
echo "NPM was not found, please install it." | ||
exit | ||
fi | ||
|
||
if [ ! -d "docs/site" ]; then | ||
git clone https://github.com/puppetlabs/devx.git docs/site | ||
cd docs/site | ||
echo "replace github.com/puppetlabs/prm/docs/md => ../md" >> go.mod | ||
npm install | ||
else | ||
cd docs/site | ||
git pull | ||
hugo mod clean | ||
fi | ||
|
||
# Check for -D flag to see if user wants to run the site with draft pages displayed | ||
flag='' | ||
while getopts 'D' opt; do | ||
case $opt in | ||
D) flag='-D' ;; | ||
esac | ||
done | ||
|
||
git submodule update --init --recursive --depth 50 | ||
hugo mod get | ||
hugo server $flag |