Skip to content

Commit 7d9c128

Browse files
committed
sdd_info() function and addin
1 parent 3d1b1ea commit 7d9c128

File tree

7 files changed

+77
-2
lines changed

7 files changed

+77
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: BioDataScience
22
Type: Package
3-
Version: 2021.0.0
3+
Version: 2021.1.0
44
Title: Configuration for Biological Data Science Course
55
Description: User sign in and sign out for the Biological Data Science courses
66
at the University of Mons, Belgium.

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
export(config)
44
export(obfuscator)
5+
export(sdd_info)
56
export(sign_in)
67
export(sign_out)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# BioDataScience 2021.1.0
2+
3+
- `sdd_info()` function and corresponfing RStudio addin are introduced for easily sharing small pieces of text in a central repository.
4+
15
# BioDataScience 2021.0.0
26

37
- Dependency moved from {learndown} to {learnitdown}. Preparation of series 2021-2022.

R/addins.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# RStudio addins
22

3+
sdd_info_addin <- function()
4+
sdd_info()
5+
36
sign_out_addin <- function()
4-
sign_out()
7+
sign_out()

R/sdd_info.R

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#' Get centralized information for the BioDataScience course
2+
#'
3+
#' Use this function to get small peices of text from a centralized repository.
4+
#' This is a convenience function to retrieve, say, links, pieces of R code, or
5+
#' other textual information in relation with the current BioDataScience course.
6+
#' To be used only by students currently involved in a course.
7+
#'
8+
#' @param echo Is the textual information echoed in the console (`TRUE` by default).
9+
#' @param skipNul Do we skip nul characters in the text (`TRUE` by default)?
10+
#'
11+
#' @return The downloaded text is returned invisibly.
12+
#' @export
13+
#'
14+
#' @examples
15+
#' # If there is some textual information currently available in the central
16+
#' # repository, you get it and dispaly it this way:
17+
#' sdd_info()
18+
#'
19+
#' # To place this text in a variable silently, do this:
20+
#' txt <- sdd_info(echo = FALSE)
21+
#' txt
22+
sdd_info <- function(echo = TRUE, skipNul = TRUE) {
23+
sdd_url <- url("https://go.sciviews.org/sdd_info")
24+
open(sdd_url)
25+
on.exit(try(close(sdd_url), silent = TRUE))
26+
sdd_data <- readLines(sdd_url, encoding = "UTF-8", warn = FALSE,
27+
skipNul = skipNul)
28+
if (isTRUE(echo))
29+
cat(sdd_data, sep = "\n")
30+
invisible(sdd_data)
31+
}

inst/rstudio/addins.dcf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Name: SDD info
2+
Description: Get current SDD information
3+
Binding: sdd_info_addin
4+
Interactive: false
5+
16
Name: Sign out
27
Description: Sign out current user
38
Binding: sign_out_addin

man/sdd_info.Rd

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

0 commit comments

Comments
 (0)