Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed ruby/gem dependencies in env.ps1 and updated the docs, added markdownlint-hook.ps1, docs.ps1, and docker.ps1 #636

Open
wants to merge 5 commits into
base: feature/distributed-demo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/developer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ scripts.
1. Install Ruby from
[official Ruby website](https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.2-1/rubyinstaller-devkit-3.1.2-1-x64.exe)
and follow all the defaults during the installation.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces

#### Run Scripts

Then, open powershell with **administrative** priviledges and run the
Expand Down
47 changes: 47 additions & 0 deletions script/docs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Get the version
if ($args) {
$Version = $args[0]
} else {
$Version = "development"
}

# Set environment variables
$env:VERSION = $Version
$env:COMMIT_HASH = (git rev-parse --short HEAD)
$env:MKDOCS_ENABLE_PDF_EXPORT = 1

Write-Output "Version: $Version"

# Remove the site directory if it exists
if (Test-Path "site") {
Remove-Item "site" -Recurse -Force
}

# Generate and publish documents
Write-Output "Generate and publish documents..."
& mkdocs build --config-file mkdocs.yml --site-dir "site/online/$Version"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the mkdocs build and serve problem with weasyprint solved?


# Copy redirect page
Copy-Item "docs/redirect-page.html" "site/index.html"

# Checkout webpage-docs branch
git checkout webpage-docs

# Clean up irrelevant files
if (Test-Path "$Version") {
Remove-Item "$Version" -Recurse -Force
}

# Move PDF file to top directory
if (Test-Path "site/online/$Version") {
Move-Item "site/online/$Version/pdf/DTaaS-docs.pdf" ".\DTaaS-$Version.pdf"
Move-Item "site/online/$Version" ".\$Version"
}

# Move index.html to top directory and remove site directory
Move-Item "site/index.html" "."
Remove-Item "site" -Recurse -Force

# Commit changes
git add .
git commit --no-verify -m "docs for $env:COMMIT_HASH commit"
2 changes: 1 addition & 1 deletion script/env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ if (-not ([Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarg
choco install -y shellcheck

# Install madge for generating dependency graphs of typescript projects
npm install -g madge
npm install -g madge
6 changes: 0 additions & 6 deletions script/markdownlint-hook.sh

This file was deleted.

12 changes: 12 additions & 0 deletions script/markdownlint-hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import subprocess
import sys

def markdownlint_hooks(files):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an advantage to having two separate python programs? Can the mdl command be executed in this function?

command = ["mdl-check.py"] + files
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = result.stdout.decode("utf-8") + result.stderr.decode("utf-8")
print(output)

if __name__ == "__main__":
files = sys.argv[1:]
markdownlint_hooks(files)
12 changes: 12 additions & 0 deletions script/mdl-check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import subprocess
import sys

def mdl_check(files):
command = ["mdl"] + files
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = result.stdout.decode("utf-8") + result.stderr.decode("utf-8")
print(output)

if __name__ == "__main__":
files = sys.argv[1:]
mdl_check(files)