Skip to content

Commit 00a569e

Browse files
committed
Rename init_gitpins() to gp_init()
Also, set roxydocs to use md by default
1 parent 93f069c commit 00a569e

8 files changed

Lines changed: 35 additions & 34 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ Config/testthat/edition: 3
3232
RoxygenNote: 7.3.2
3333
URL: https://github.com/torfason/gitpins
3434
BugReports: https://github.com/torfason/gitpins/issues
35+
Roxygen: list(markdown = TRUE)

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(gitpin)
4+
export(gp_init)
45
export(gp_options)
56
export(list_pins)
67
export(pin)

R/gitpin.R

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ fstamp <- function(the_datetime) {
2929

3030
#' Initialize gitpins repository
3131
#'
32-
#' This function is called automatically as needed and should not
33-
#' need to be called by the user. Note, however that to set a non-standard
34-
#' directory for the pinned files, this function must be called before
35-
#' any other functions.
32+
#' This function is generally called automatically as needed. Note, however,
33+
#' that to set a non-standard directory for the pinned files, this function must
34+
#' be called before any other functions.
3635
#'
36+
#' @param ... Reserved. All arguments must be named.
3737
#' @param options A `gp_options()` object, used in particular to select
3838
#' the directory for storing the pins (defaults to `here::here("gitpins")`).
3939
#' @return The path to the repository
40-
#' @md
41-
#' @keywords internal
42-
init_gitpins <- function(..., options = gp_options()) {
40+
#'
41+
#' @export
42+
gp_init <- function(..., options = gp_options()) {
4343

4444
# Verify inputs
4545
assert_dots_empty()
@@ -51,6 +51,7 @@ init_gitpins <- function(..., options = gp_options()) {
5151
gert::git_config_set(repo=.globals$repo, "user.email", "gitpins@zulutime.net")
5252
}
5353

54+
5455
#' Download URL, add to gitpins repository, and return filename
5556
#'
5657
#' The `pin()` function downloads a URL to a local file in the `gitpins`
@@ -64,7 +65,6 @@ init_gitpins <- function(..., options = gp_options()) {
6465
#' before downloading a new version.
6566
#' @return The path of the locally downloaded file
6667
#'
67-
#' @md
6868
#' @export
6969
pin <- function(url, refresh_hours=12) {
7070
assert_string(url)
@@ -75,7 +75,7 @@ pin <- function(url, refresh_hours=12) {
7575
recent_version_found <- FALSE
7676

7777
# Initialize variables
78-
init_gitpins()
78+
gp_init()
7979
stopifnot(!is.null(url) && is.character(url) && length(url)==1)
8080
url_hash <- digest::digest(url)
8181
timestamp <- Sys.time()
@@ -140,7 +140,7 @@ pin <- function(url, refresh_hours=12) {
140140
#' naming conflicts (for example with [pins::pin()]).
141141
#'
142142
#' @name pin
143-
#' @md
143+
#'
144144
#' @export
145145
gitpin <- pin
146146

@@ -150,12 +150,11 @@ gitpin <- pin
150150
#' @param history Should full (git) history be returned?
151151
#' @return A `data.frame` with the timestamps and urls of available pins.
152152
#'
153-
#' @md
154153
#' @export
155154
list_pins <- function(history=FALSE) {
156155
assert_flag(history)
157156

158-
init_gitpins()
157+
gp_init()
159158

160159
# Function to return empty data.frame on fresh repo instead of erroring
161160
get_repo_log_messages <- function(the_repo) {

man/assert_dots_empty.Rd

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

man/assert_gp_options.Rd

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

man/gp_options.Rd

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

tests/testthat/test-gitpin-local.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
test_that("init_gitpins() works", {
33

44
# Default options
5-
init_gitpins() |>
5+
gp_init() |>
66
expect_silent()
77
expect_true(fs::dir_exists(here::here("gitpins")))
88

99
# Custom options
1010
opt_arg <- gp_options(pin_directory = here::here("gitpins_arg"))
11-
init_gitpins(options = opt_arg) |>
11+
gp_init(options = opt_arg) |>
1212
expect_silent()
1313
expect_true(fs::dir_exists(here::here("gitpins_arg")))
1414

1515
# Get directory from r options
1616
withr::with_options(list(gitpins.pin_directory = here::here("gitpins_opts")), {
17-
init_gitpins() |>
17+
gp_init() |>
1818
expect_silent()
1919
expect_true(fs::dir_exists(here::here("gitpins_arg")))
2020
})

0 commit comments

Comments
 (0)