From c5be5efb211b4422e851c8f9c182464b9f867bd6 Mon Sep 17 00:00:00 2001 From: Hause Lin Date: Sun, 28 Apr 2024 18:36:47 -0400 Subject: [PATCH] Create website --- .Rbuildignore | 4 +++ .github/.gitignore | 1 + .github/workflows/pkgdown.yaml | 48 ++++++++++++++++++++++++++++++++++ .gitignore | 1 + DESCRIPTION | 1 + NAMESPACE | 1 - R/ollama.R | 8 +++--- _pkgdown.yml | 4 +++ man/create_request.Rd | 7 ++--- 9 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 .github/.gitignore create mode 100644 .github/workflows/pkgdown.yaml create mode 100644 _pkgdown.yml diff --git a/.Rbuildignore b/.Rbuildignore index ccd20cd..04580b3 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -2,3 +2,7 @@ ^\.Rproj\.user$ ^LICENSE\.md$ ^README\.Rmd$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..a7276e8 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,48 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index 7c794aa..457525e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .httr-oauth .DS_Store .quarto +docs diff --git a/DESCRIPTION b/DESCRIPTION index 13c79d3..a212148 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -17,3 +17,4 @@ Imports: httr2, jsonlite, tibble +URL: https://hauselin.github.io/ollamar/ diff --git a/NAMESPACE b/NAMESPACE index 901eb30..89bf380 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,6 @@ # Generated by roxygen2: do not edit by hand export(chat) -export(create_request) export(delete) export(embeddings) export(generate) diff --git a/R/ollama.R b/R/ollama.R index 13391ab..5b3ea54 100644 --- a/R/ollama.R +++ b/R/ollama.R @@ -7,15 +7,13 @@ package_config <- list( ) -#' Create a httr2 request object +#' Create a httr2 request object. +#' +#' Creates a httr2 request object with the base URL, headers and endpoint. Used by other functions in the package and not intended to be used directly. #' #' @param endpoint The endpoint to create the request #' #' @return A httr2 request object. -#' @export -#' -#' @examples -#' create_request("/api/tags") create_request <- function(endpoint) { url <- package_config$baseurls[1] url <- httr2::url_parse(url) diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..5436b43 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,4 @@ +url: https://hauselin.github.io/ollamar/ +template: + bootstrap: 5 + diff --git a/man/create_request.Rd b/man/create_request.Rd index d9d9ecf..5bd4dc0 100644 --- a/man/create_request.Rd +++ b/man/create_request.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/ollama.R \name{create_request} \alias{create_request} -\title{Create a httr2 request object} +\title{Create a httr2 request object.} \usage{ create_request(endpoint) } @@ -13,8 +13,5 @@ create_request(endpoint) A httr2 request object. } \description{ -Create a httr2 request object -} -\examples{ -create_request("/api/tags") +Creates a httr2 request object with the base URL, headers and endpoint. Used by other functions in the package and not intended to be used directly. }