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 3 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
10 changes: 3 additions & 7 deletions docs/developer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,24 @@ software packages. But errors might crop up due to missing
environment variables. The potential errors are:

1. `npm is not recognized.........` in `base.ps1`.
1. `gem is not recognized.........` in `env.ps1`

If you encounter these errors,
remember to include _node_ and _ruby_ installation locations in
remember to include _node_ installation locations in
**PATH** environment variable
(`Settings --> search for "system environment variables"`
`--> Advanced --> Environment Variables --> PATH`).

The `base.ps1` and `env.ps1` scripts can be run again after setting
the correct **PATH** environment variable.

#### Pre-install Nodejs and Ruby Software
#### Pre-install Nodejs

Another way to solve the **PATH** environment problem is to
install Nodejs and Ruby software packages before running the powershell
install the Nodejs software package before running the powershell
scripts.

1. Install the latest stable version of NodeJS from the
[official NodeJS website](https://nodejs.org/en).
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.

#### Run Scripts

Expand Down
47 changes: 47 additions & 0 deletions script/docs.ps1
Copy link
Contributor

Choose a reason for hiding this comment

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

please update the instructions in docs/PUBLISH.md as well

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"
13 changes: 2 additions & 11 deletions script/env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,8 @@ if (-not ([Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarg
# Install mkdocs
pip install mkdocs

# Install Ruby: https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.2-1/rubyinstaller-devkit-3.1.2-1-x64.exe
choco install -y ruby

# Ensure Ruby scripts directory is added to PATH
if (-not ([Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) -like "*Ruby*")) {
Write-Host "Adding Ruby scripts to PATH..."
[Environment]::SetEnvironmentVariable("Path", "$env:Path;$(Get-Command ruby | Select-Object -ExpandProperty Directory)", [EnvironmentVariableTarget]::Machine)
}

# Install markdownlint
gem install mdl
choco install markdownlint-cli
Copy link
Contributor

Choose a reason for hiding this comment

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

The markdownlint-cli package is related to markdownlint by David Anson. This package is good but is different from the markdownlint package used by codeclimate. So unfortunately we have to keep the mdl installation.

Copy link
Author

Choose a reason for hiding this comment

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

The markdownlint-cli package is related to markdownlint by David Anson. This package is good but is different from the markdownlint package used by codeclimate. So unfortunately we have to keep the mdl installation.

Oh okay, so should i revoke the changes and make it like it was before with the ruby and gem install?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes


# Install mkdocs plugins
pip install mkdocs-material python-markdown-math mkdocs-open-in-new-tab mkdocs-with-pdf qrcode
Expand All @@ -49,4 +40,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
10 changes: 10 additions & 0 deletions script/markdownlint-hook.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This script is used by the pre-commit hook to check the markdown files without exiting the commit process.

# Invoke markdownlint and capture the output
$output = markdownlint $args
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a mistake in the existing bash script. Even though we are installing mdl, the script uses markdownlint. We need to use mdl here.
The mdl has pre-commit hooks available. We couldn't find a way to leave a warning message for a check of pre-commit. So the markdown check has been moved to a script to turn errors into warnings. It is advantageous to use a python script (named mdl-check.py) to run the mdl command to make the script cross-platform.

Copy link
Author

Choose a reason for hiding this comment

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

There is a mistake in the existing bash script. Even though we are installing mdl, the script uses markdownlint. We need to use mdl here. The mdl has pre-commit hooks available. We couldn't find a way to leave a warning message for a check of pre-commit. So the markdown check has been moved to a script to turn errors into warnings. It is advantageous to use a python script (named mdl-check.py) to run the mdl command to make the script cross-platform.

okay got it


# Print the output
Write-Output $output

# Exit with code 0 to indicate success
Exit 0