Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
japborst committed Sep 27, 2022
1 parent c001ef8 commit 4736144
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 113 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/deploy-website.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Update `error-prone.picnic.tech` website contents
on:
push:
#branches: [$default-branch]
branches:
- 'sschroevers/deploy-to-github-pages'
branches: [$default-branch]
workflow_dispatch:
permissions:
contents: read
Expand Down
1 change: 0 additions & 1 deletion docs/bugpatterns/EmptyMethod.md

This file was deleted.

12 changes: 0 additions & 12 deletions docs/refastertemplates/BigDecimalTemplates.md

This file was deleted.

93 changes: 0 additions & 93 deletions generate-docs.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
#!/usr/bin/env bash

WEBSITE_FOLDER="website"
DOCS_FOLDER="docs"

BUGPATTERN_FOLDER="${WEBSITE_FOLDER}/bugpatterns"
BUGPATTERN_DOCS_FOLDER="${DOCS_FOLDER}/bugpatterns"

REFASTER_FOLDER="${WEBSITE_FOLDER}/refastertemplates"
REFASTER_DOCS_FOLDER="${DOCS_FOLDER}/refastertemplates"

HOMEPAGE="${WEBSITE_FOLDER}/index.md"

configure() {
Expand All @@ -21,7 +13,6 @@ generate_homepage() {
echo "Generating ${HOMEPAGE}"
cat > "${HOMEPAGE}" << EOF
---
# Do not modify. This file is generated.
layout: default
title: Home
nav_order: 1
Expand All @@ -38,90 +29,6 @@ EOF
sed $SEDOPTION 's/srcset="/srcset="assets\/images\//g' ${HOMEPAGE}
}

generate_bugpattern_docs() {
BUGPATTERNS=$(find error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns -type f -iname "*.java" ! -iname "package-info.java")
for BUGPATTERN in $BUGPATTERNS; do
NAME=$(basename "${BUGPATTERN}" ".java")
FILENAME="${BUGPATTERN_FOLDER}/${NAME}.md"

EXTRA_DOCS=$(cat "${BUGPATTERN_DOCS_FOLDER}/${NAME}.md" 2>/dev/null)

echo "Generating ${FILENAME}"
cat > "${FILENAME}" << EOF
---
layout: default
title: ${NAME}
parent: Bug Patterns
nav_order: 1
---
# ${NAME}
Simplification
{: .label .label-blue }
Suggestion
{: .label .label-yellow }
${EXTRA_DOCS}
## Samples
\`\`\`java
public static void sample() {}
\`\`\`
<a href="https://github.com/PicnicSupermarket/error-prone-support/blob/master/${BUGPATTERN}" class="fs-3 btn external" target="_blank">
View source code on GitHub
<svg viewBox="0 0 24 24" aria-labelledby="svg-external-link-title"><use xlink:href="#svg-external-link"></use></svg>
</a>
EOF
done
}

generate_refaster_docs() {
TEMPLATES=$(find error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates -type f -iname "*.java" ! -iname "package-info.java")
for TEMPLATE in $TEMPLATES; do
NAME=$(basename "${TEMPLATE}" ".java")
FILENAME="${REFASTER_FOLDER}/${NAME}.md"

EXTRA_DOCS=$(cat "${REFASTER_DOCS_FOLDER}/${NAME}.md" 2>/dev/null)

echo "Generating ${FILENAME}"
cat > "${FILENAME}" << EOF
---
layout: default
title: ${NAME}
parent: Refaster templates
nav_order: 1
---
# ${NAME}
Style
{: .label .label-blue }
Error
{: .label .label-red }
${EXTRA_DOCS}
## Samples
\`\`\`java
public static void sample() {}
\`\`\`
<a href="https://github.com/PicnicSupermarket/error-prone-support/blob/master/${TEMPLATE}" class="fs-3 btn external" target="_blank">
View source code on GitHub
<svg viewBox="0 0 24 24" aria-labelledby="svg-external-link-title"><use xlink:href="#svg-external-link"></use></svg>
</a>
EOF
done
}

# Do it
configure
generate_homepage
generate_bugpattern_docs
generate_refaster_docs
2 changes: 0 additions & 2 deletions website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ vendor/
# Generated content
*.bak
index.md
bugpatterns/
refastertemplates/
2 changes: 2 additions & 0 deletions website/404.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
layout: default
title: Page not found
permalink: /404.html
nav_exclude: true
search_exclude: true
---
Expand Down
1 change: 1 addition & 0 deletions website/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nav_external_links:
url: https://github.com/PicnicSupermarket/error-prone-support
hide_icon: false

# Author configuration.
twitter:
username: picnic
card: summary
Expand Down
4 changes: 2 additions & 2 deletions website/_sass/custom/custom.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// We should override $nav-width(-md), however this breaks code highlighting and other styles.
// This appears an issue wrt the recommended way:
// https://github.com/just-the-docs/just-the-docs/issues/982
// This appears an issue wrt the recommended way.
// See: https://github.com/just-the-docs/just-the-docs/issues/982
@include mq(lg) {
.side-bar {
min-width: 400px;
Expand Down
2 changes: 2 additions & 0 deletions website/bugpatterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ title: Bug Patterns
nav_order: 2
has_children: true
---

# Bug Patterns
2 changes: 2 additions & 0 deletions website/refastertemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ title: Refaster templates
nav_order: 2
has_children: true
---

# Refaster templates

0 comments on commit 4736144

Please sign in to comment.