Skip to content

Commit

Permalink
Generate URL based on the package version
Browse files Browse the repository at this point in the history
  • Loading branch information
zero323 committed Dec 6, 2021
1 parent d4f346f commit a18cc0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions R/create-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,19 @@ mkdir -p pkg/html
pushd pkg/html

"$R_SCRIPT_PATH/Rscript" -e 'libDir <- "../../lib"; library(SparkR, lib.loc=libDir); knitr::knit_rd("SparkR", links = tools::findHTMLlinks(file.path(libDir, "SparkR")))'


# Determine Spark(R) version
SPARK_VERSION=$(grep -oP "(?<=Version:\ ).*" ../DESCRIPTION)

# Update url
sed "s/{SPARK_VERSION}/$SPARK_VERSION/" ../pkgdown/_pkgdown_template.yml > ../_pkgdown.yml

"$R_SCRIPT_PATH/Rscript" -e 'libDir <- "../../lib"; library(SparkR, lib.loc=libDir); pkgdown::build_site("..")'

# Clean temporary config
rm ../_pkgdown.yml

popd

popd
2 changes: 1 addition & 1 deletion R/pkg/_pkgdown.yml → R/pkg/pkgdown/_pkgdown_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

url: ~
url: https://spark.apache.org/docs/{SPARK_VERSION}/api/R/

template:
package: preferably
Expand Down

0 comments on commit a18cc0c

Please sign in to comment.