Skip to content

Commit f32aa79

Browse files
committed
export message
1 parent 192c501 commit f32aa79

11 files changed

Lines changed: 82 additions & 6 deletions

File tree

.Rbuildignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
^svutils\.Rproj$
22
^\.Rproj\.user$
33
^LICENSE\.md$
4+
^_pkgdown\.yml$
5+
^docs$
6+
^pkgdown$
7+
^\.github$

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html

.github/workflows/pkgdown.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
name: pkgdown.yaml
12+
13+
permissions: read-all
14+
15+
jobs:
16+
pkgdown:
17+
runs-on: ubuntu-latest
18+
# Only restrict concurrency for non-PR jobs
19+
concurrency:
20+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
21+
env:
22+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
permissions:
24+
contents: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: r-lib/actions/setup-pandoc@v2
29+
30+
- uses: r-lib/actions/setup-r@v2
31+
with:
32+
use-public-rspm: true
33+
34+
- uses: r-lib/actions/setup-r-dependencies@v2
35+
with:
36+
extra-packages: any::pkgdown, local::.
37+
needs: website
38+
39+
- name: Build site
40+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
41+
shell: Rscript {0}
42+
43+
- name: Deploy to GitHub pages 🚀
44+
if: github.event_name != 'pull_request'
45+
uses: JamesIves/github-pages-deploy-action@v4.5.0
46+
with:
47+
clean: false
48+
branch: gh-pages
49+
folder: docs

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.httr-oauth
55
.DS_Store
66
.quarto
7+
docs

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ Imports:
2828
curl,
2929
progress,
3030
urltools
31-
URL: https://github.com/scienceverse/svutils
31+
URL: https://github.com/scienceverse/svutils, http://www.scienceverse.org/svutils/
3232
BugReports: https://github.com/scienceverse/svutils/issues

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Generated by roxygen2: do not edit by hand
22

33
export("%||%")
4+
export(message)
45
export(online)
56
export(pb)
67
export(rep_if)

R/message.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#' @param appendLF append new line? (see \code{\link[base]{message}})
66
#'
77
#' @return TRUE
8-
#' @keywords internal
9-
#'
8+
#' @export
109
message <- function(..., domain = NULL, appendLF = TRUE) {
1110
if (verbose()) {
1211
if (interactive()) {

_pkgdown.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
url: http://www.scienceverse.org/svutils/
2+
template:
3+
bootstrap: 5
4+

man/message.Rd

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-message.R

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
test_that("message", {
2-
expect_true(is.function(svutils:::message))
2+
expect_true(is.function(svutils::message))
33

44
expect_error(message(bad_arg))
55
})
6+
7+
test_that("message", {
8+
verbose(TRUE)
9+
10+
msg <- capture_messages(message("hi"))
11+
12+
if (interactive()) {
13+
expect_equal(msg, "\033[32mhi\033[39m\n")
14+
} else {
15+
expect_equal(msg, "hi\n")
16+
}
17+
18+
verbose(FALSE)
19+
20+
msg <- capture_messages(message("hi"))
21+
expect_equal(msg, character(0))
22+
})

0 commit comments

Comments
 (0)