Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release gh action, remove tmate debug action #33

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
^pkgdown$
!pkgdown\.yml$
^\.github$
^README\.Rmd$
28 changes: 28 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- name: Install dependencies
run: |
install.packages(c("remotes", "rcmdcheck"))
remotes::install_deps(dependencies = TRUE)
shell: Rscript {0}
- name: Check
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error")
shell: Rscript {0}
3 changes: 1 addition & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
# - {name: Setup tmate session, uses: mxschmitt/action-tmate@v3}

- uses: r-lib/actions/setup-r@v1

Expand Down
16 changes: 12 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
Package: mandrake
Title: Bringing Reading the man Page a Little Closer to the drake Workflow.
Title: Bringing Reading the man Page a Little Closer to the drake Workflow
Version: 1.0.0
Authors@R: c(person("Matthew", "Strasiotto", email = "[email protected]", role = c("aut", "cre")))
Description: This package aims to
Description: 'mandrake' aims to bridge the gap between the manual and
your drake workflow, as well as your code's documentation & your
datasets' documentation. It does this by providing efficient
roxygen2 extensions / tags for document input + output columns
in your inline docstrings, which can then be imported into
drake workflow graphs, and inherited across packages.
URL: https://mstrasiot.to/mandrake/, https://github.com/matthewstrasiotto/mandrake
License: MIT
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Suggests:
Expand All @@ -30,7 +35,10 @@ Imports:
yaml (>= 2.2.1),
kableExtra,
lifecycle,
htmltools
htmltools,
storr,
jsonlite,
utils
Remotes:
r-lib/downlit,
r-lib/pkgdown,
Expand Down
3 changes: 3 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
YEAR: 2020
COPYRIGHT HOLDER: Matthew Mark Strasiotto

14 changes: 11 additions & 3 deletions R/decorate_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ extract_target_column_names <- function(target, cache) {
out
}

# Squash check whine
utils::globalVariables(c("target"))

#' Extract Column Names for targets in Drake Plan
#'
#' Given a [drake::drake_plan()], extract the column names of each target, and store it
#' in a new column.
#'
#' @inheritParams drake::make
#' @inheritParams drake::drake_graph_info
#' @param colname_out the name given to the list-column containing each target's columns
#' @param ... reserved for future expansion
#' @family graph_decoration
#' @export
extract_column_names <- function(plan, cache, group = NULL, clusters = NULL,
Expand Down Expand Up @@ -65,7 +69,8 @@ missing_col_placeholder <- function(col_key) {
html_ref = ""
)
}

# Squash check whine
utils::globalVariables(c("html", "html_ref", "description", "defined_at"))

pull_out_coldocs <- function(columns, lookup_cache) {
if (rlang::is_empty(columns)) return(NULL)
Expand Down Expand Up @@ -112,7 +117,7 @@ pull_out_coldocs <- function(columns, lookup_cache) {
#' @param target_column_list a list of character vectors specifying column names
#' @inheritParams load_package_colspec
link_col2doc <- function(target_column_list, lookup_cache) {
if (!is(lookup_cache, "storr")) stop("Must pass a storr object to link_col2doc")
if (!methods::is(lookup_cache, "storr")) stop("Must pass a storr object to link_col2doc")

out <- target_column_list %>%
purrr::map(
Expand Down Expand Up @@ -170,7 +175,9 @@ highlight_commands <- function(commands) {
#' @inheritParams load_package_colspec
#' @param desc_colname the name of the column that provides the markdown description
#' @param colname_out the name of the column in which to store the enriched description
#' @param ... reserved for future expansion
#' @export
#' @inheritParams drake::make
#' @family graph_decoration
decorate_plan <- function(
plan, cache, group = NULL, clusters = NULL,
Expand Down Expand Up @@ -232,7 +239,8 @@ decorate_plan <- function(
#' graph %<>% attach_dependencies()
#' graph %>% visNetwork::visSave()
#' ```
#'
#' @param graph the graph generated by `drake::render_drake_graph()` or
#' `drake::drake_graph()`.
#' @family widget_dependencies
#' @export
attach_dependencies <- function(graph) {
Expand Down
7 changes: 5 additions & 2 deletions R/io_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tag_list_col <- function(x) {
x
}


utils::globalVariables(c("where"))
serialize_df <- function(x) {

out <- x %>%
Expand Down Expand Up @@ -124,7 +124,7 @@ load_package_colspec <- function(pkg_name, lookup_cache = NULL) {
}


#' Load colspec from a single file, to be imported into storr cache
# Load colspec from a single file, to be imported into storr cache
load_colspec_file <- function(path) {
out <- path %>%
readLines() %>%
Expand All @@ -134,6 +134,9 @@ load_colspec_file <- function(path) {
out
}

# Squash check whine
utils::globalVariables(c("name"))

add_entry_to_cache <- function(entry, keys, lookup_cache = NULL) {
if (rlang::is_empty(lookup_cache))
stop("Empty lookup cache given to add_entry_to_cache")
Expand Down
5 changes: 3 additions & 2 deletions R/js_handlers.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe_event_handlers <- function(handler) {
#'
#' It looks like this:
#'
#' `r describe_event_handlers(mandrake::embed_event_handler)`
#' `r suppressWarnings(describe_event_handlers(mandrake::embed_event_handler))`
#'
#' \lifecycle{deprecated}
#' @export
Expand Down Expand Up @@ -53,7 +53,8 @@ embed_event_handler <- function() {
#'
#' Mainly useful for testing - Basically chucks the data for that particular node
#' into a popup.
#'
#' @param warn_deprecated leave as-is - used interally by deprecated handlers that
#' call this to signal they're deprecated
#' @export
#' @family js_handlers
alert_event_handler <- function(warn_deprecated = FALSE){
Expand Down
4 changes: 4 additions & 0 deletions R/mandrake-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
#' @importFrom lifecycle deprecate_soft
## usethis namespace: end
NULL


# Squash check whine
utils::globalVariables(c(":=", "."))
14 changes: 13 additions & 1 deletion R/roxy-roclet-col.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ col_roclet <- function() {

#' @rdname col_roclet
#' @export
#' @inheritParams roxygen2::roclet_process
#' @importFrom roxygen2 roclet_process
#' @param roc a `roclet` object
roclet_process.roclet_col <- function(
roc, blocks, env, base_path
) {
Expand All @@ -27,6 +29,8 @@ roclet_process.roclet_col <- function(
out
}

# Squash check whine
utils::globalVariables(c("rd_ref", "package", "columns"))

roclet_col_process_col_tag <- function(roc, block, env, base_path) {
`%||%` <- rlang::`%||%`
Expand Down Expand Up @@ -108,6 +112,8 @@ default_column_map_output_path <- function() {
#' @export
#' @inheritSection output_paths Output Paths Configuration
#' @importFrom roxygen2 roclet_output
#' @param ... reserved for future expansion
#' @inheritParams roxygen2::roclet_output
roclet_output.roclet_col <- function(roc, results, base_path, ...) {
`%||%` <- rlang::`%||%`

Expand Down Expand Up @@ -156,7 +162,13 @@ write_package_results <- function(results, pkg_name, output_dir = NULL) {
dplyr::distinct(name, body, .keep_all = TRUE) %>%
serialize_df()

out <- c(roxygen2:::made_by("#"), out)
# intended to mirror roxygen2:::made_by
# warns rstydio not to edit
made_by <- function(comment) {
paste0(comment, " Generated by roxygen2: do not edit by hand\n")
}

out <- c(made_by("#"), out)

out %>% write(file = output_path)

Expand Down
7 changes: 6 additions & 1 deletion R/roxy-tag-col.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

# Squash check whine
utils::globalVariables(c("direction", "aliases", "src"))

#' @export
#' @importFrom roxygen2 roxy_tag_parse
Expand Down Expand Up @@ -86,7 +88,10 @@ roxy_tag_parse.roxy_tag_col <- function(x) {
x
}

#' Extract named captures from gregexpr
# Squash check whine
utils::globalVariables(c("capture.start", "capture.length", "capture_end"))

# Extract named captures from gregexpr
extract_named_captures <- function(string, match_object) {

out <- list()
Expand Down
3 changes: 3 additions & 0 deletions R/roxy-tag-inherit.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Squash check whine
utils::globalVariables(c("src"))

#' @export
#' @importFrom roxygen2 roxy_tag_parse
roxy_tag_parse.roxy_tag_inheritCol <- function(x) {
Expand Down
4 changes: 4 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ output: github_document

<!-- README.md is generated from README.Rmd. Edit that file & knit to generate README -->

<!-- badges: start -->
[![R build status](https://github.com/matthewstrasiotto/mandrake/workflows/R-CMD-check/badge.svg)](https://github.com/matthewstrasiotto/mandrake/actions)
<!-- badges: end -->

# mandrake

`{mandrake}` is an R package that aims to bridge the gap between:
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_col_roclet.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ context("Does col roclet correctly process col tags?")


test_that("Col roclet correctly handles col tags", {
fail("TNI")
skip("TNI")
})

test_that("Col roclet correctly handles inheritCol tags", {
fail("TNI")
skip("TNI")
})

setup_input_no_tags <- function() {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_parsing.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test_that("parsing a block with 2 deffs of our tag works", {
})

test_that("May parse valid R columns, such as those with full-stops", {
fail("Test not implemented")
skip("Test not implemented")
})

setup_input_inherit <- function() {
Expand Down