Skip to content

Commit

Permalink
NIFI-13915 Updated documentation for NiFi 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
exceptionfactory committed Nov 4, 2024
1 parent f41b05d commit 50bc21b
Show file tree
Hide file tree
Showing 13 changed files with 733 additions and 27 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
rm -rf stylesheets
- name: Build
run: |
bash prebuild.sh
hugo
- name: Publish
working-directory: ${{ env.PUBLISH_DIRECTORY }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ node_modules/
.sass-cache
.ruby-version
package-lock.json
nifi-runtime-manifest.json

# hugo
/public
/resources
/.hugo_build.lock
/prebuild/public
/prebuild/.hugo_build.lock
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ The Apache NiFi website uses [Hugo](https://gohugo.io) to build static HTML and

## Build

- Run prebuild.sh for generated documentation
- `bash prebuild.sh`

- Run Hugo Build
- `hugo`

Expand Down
25 changes: 25 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ disableKinds = ["RSS"]
enableGitInfo = true
theme = "nifi"
enableInlineShortcodes = true
disablePathToLower = true

[markup.goldmark.renderer]
unsafe = true
Expand All @@ -28,6 +29,8 @@ assets = "assets"
matomoSiteId = 28
productionHost = "nifi.apache.org"

staticDocsPath = "/nifi-docs"

apacheFoundationGroupsUrl = "https://projects.apache.org/json/foundation/groups.json"
apacheFoundationPeopleNameUrl = "https://projects.apache.org/json/foundation/people_name.json"

Expand All @@ -47,7 +50,29 @@ minifiCppCurrentProjectVersionReleased = "2024-05-17"
minifiCppPreviousProjectVersion = "0.15.0"
minifiCppPreviousProjectVersionReleased = "2023-09-01"

[module]
[[module.mounts]]
source = "content"
target = "content"
[[module.mounts]]
source = "static"
target = "static"
[[module.mounts]]
source = "layouts"
target = "layouts"
[[module.mounts]]
source = "prebuild/public/components"
target = "content/components"
[[module.mounts]]
source = "prebuild/public/html"
target = "content/nifi-docs"

[menu]
[[menu.main]]
name = 'NiFi Version 2 Documentation'
url = '/components/'
weight = 1
parent = 'Documentation'
[[menu.main]]
name = 'Wiki'
url = 'https://cwiki.apache.org/confluence/display/NIFI'
Expand Down
2 changes: 1 addition & 1 deletion content/documentation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ menu:

## Configuration and Component Properties

- [NiFi Documentation {{< param currentProjectVersion >}}]({{< relref "/documentation/v2" >}})
- [NiFi Documentation {{< param currentProjectVersion >}}]({{< relref "/components/" >}})
- [NiFi Documentation {{< param previousProjectVersion >}}]({{< relref "/documentation/v1" >}})

## Reference Information
Expand Down
12 changes: 0 additions & 12 deletions content/documentation/v2/_index.md

This file was deleted.

33 changes: 33 additions & 0 deletions prebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

CURRENT_VERSION=2.0.0

RESOURCES_DIR=resources
PREBUILD_DIR=prebuild

MAVEN_BASE_URL=https://repo1.maven.org/maven2

MANIFEST_JAR_URL="$MAVEN_BASE_URL/org/apache/nifi/nifi-runtime-manifest/$CURRENT_VERSION/nifi-runtime-manifest-$CURRENT_VERSION.jar"
MANIFEST_JAR_PATH=$RESOURCES_DIR/nifi-runtime-manifest.jar
MANIFEST_JSON=nifi-runtime-manifest.json

NIFI_DOCS_ZIP_URL="$MAVEN_BASE_URL/org/apache/nifi/nifi-docs/$CURRENT_VERSION/nifi-docs-$CURRENT_VERSION-resources.zip"
NIFI_DOCS_ZIP_PATH=$RESOURCES_DIR/nifi-docs-resources.zip

# Create Hugo directories
if [ ! -d $RESOURCES_DIR ];then
mkdir $RESOURCES_DIR
fi

# Download Runtime Manifest JAR and extract JSON to prebuild
echo "Downloading $MANIFEST_JAR_URL"
curl -o $MANIFEST_JAR_PATH $MANIFEST_JAR_URL
unzip -q -o -d $PREBUILD_DIR/assets $MANIFEST_JAR_PATH $MANIFEST_JSON

# Download Documentation Resources and extract to prebuild
echo "Downloading $NIFI_DOCS_ZIP_URL"
curl -o $NIFI_DOCS_ZIP_PATH $NIFI_DOCS_ZIP_URL
unzip -q -o -d $PREBUILD_DIR/public $NIFI_DOCS_ZIP_PATH

# Build components using prebuild directory with Hugo
hugo -s $PREBUILD_DIR
6 changes: 6 additions & 0 deletions prebuild/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title = "Apache NiFi"
copyright = "The Apache Software Foundation"
disableKinds = ["RSS", "sitemap", "taxonomy", "term"]

[outputs]
home = ["html"]
51 changes: 51 additions & 0 deletions prebuild/layouts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{ $manifest := dict }}
{{ with resources.Get "nifi-runtime-manifest.json" }}
{{ with . | transform.Unmarshal }}
{{ $manifest = . }}
{{ end }}
{{ else }}
not found
{{ end }}

{{ range $manifest.bundles }}
{{ range .componentManifest.controllerServices }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
{{ $metadata := merge . (dict "title" $simpleClassName "componentType" "controller-services") }}
{{ $string := jsonify $metadata }}
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}
{{ end }}
{{ range .componentManifest.processors }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
{{ $metadata := merge . (dict "title" $simpleClassName "componentType" "processors") }}
{{ $string := jsonify $metadata }}
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}
{{ end }}
{{ range .componentManifest.reportingTasks }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
{{ $metadata := merge . (dict "title" $simpleClassName "componentType" "reporting-tasks") }}
{{ $string := jsonify $metadata }}
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}
{{ end }}
{{ range .componentManifest.parameterProviders }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
{{ $metadata := merge . (dict "title" $simpleClassName "componentType" "parameter-providers") }}
{{ $string := jsonify $metadata }}
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}
{{ end }}
{{ range .componentManifest.flowAnalysisRules }}
{{ $simpleClassName := replaceRE `.+?\.?([^\.]+)$` "$1" .type }}
{{ $metadata := merge . (dict "title" $simpleClassName "componentType" "flow-analysis-rules") }}
{{ $string := jsonify $metadata }}
{{ $filename := printf "components/%s/_index.md" .type }}
{{ $resource := resources.FromString $filename $string }}
{{ $file := $resource.RelPermalink }}
{{ end }}
{{ end }}
3 changes: 3 additions & 0 deletions static/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ RewriteRule ^documentation/nifi-latest/html/(.+?)$ /documentation/nifi-2.0.0-M4/
# Redirect component documentation to specified version
RewriteRule ^docs/nifi-docs/components/org\.apache\.nifi/([^\/]+?)/[^\/]+?/(.*)$ docs/nifi-docs/components/org.apache.nifi/$1/1.28.0/$2 [L]

# Rewrite documentation overview pages
RewriteRule ^documentation/v2/$ /components/ [L,R]

# Rewrite historical links
RewriteRule ^minifi/.*$ /projects/minifi/ [L,R]
RewriteRule ^quickstart\.html$ /documentation/v2/ [L,R]
Expand Down
Loading

0 comments on commit 50bc21b

Please sign in to comment.