Skip to content

Commit

Permalink
Merge pull request #19 from jhrcook/0.1.4
Browse files Browse the repository at this point in the history
Minor changes to address issues on CRAN servers
  • Loading branch information
jhrcook authored May 16, 2021
2 parents 0f45dd3 + 739b0bf commit 5547b7f
Show file tree
Hide file tree
Showing 34 changed files with 567 additions and 1,741 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
on:
push:
branches:
- master
pull_request:
branches:
- master

name: test-coverage

# Increment this version when we want to clear cache
env:
cache-version: v1

jobs:
test-coverage:
runs-on: ubuntu-18.04
env:
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

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

- name: Install pak and query dependencies
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
shell: Rscript {0}

- name: Restore R package cache
uses: actions/cache@v2
with:
path: |
${{ env.R_LIBS_USER }}/*
!${{ env.R_LIBS_USER }}/pak
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-${{ env.cache-version }}-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-${{ env.cache-version }}-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
pak::local_system_requirements(execute = TRUE)
pak::pkg_system_requirements("covr", execute = TRUE)
shell: Rscript {0}

- name: Install dependencies
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("covr")
shell: Rscript {0}

- name: Test coverage
run: covr::codecov()
shell: Rscript {0}
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

13 changes: 8 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ Authors@R:
family = "Briggs",
role = c("ctb"),
email = "[email protected]"),
person(given = "Vinay",
family = "Viswanadham",
role = c("ctb"),
email = "[email protected]"))
person(given = "Vinay",
family = "Viswanadham",
role = c("ctb"),
email = "[email protected]"),
person(given = "Travers",
family = "Ching",
role = c("ctb"),
email = "[email protected]"))
Description: A simple system for saving and loading objects in
R. Long running computations can be stashed after the first run and
then reloaded the next time. Dependencies can be added to ensure that
Expand All @@ -42,5 +46,4 @@ VignetteBuilder:
knitr
Encoding: UTF-8
Language: en-US
LazyData: true
RoxygenNote: 7.1.1
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# mustashe 0.1.4

- Functional and verbose parameters in the 'stash()' function (@traversc).
- Minor fixes for CRAN package checking process.
- Tooling changes to add [pre-commit](https://pre-commit.com) and ['renv'](https://CRAN.R-project.org/package=renv) and remove AppVeyor and Travis CI (only using GitHub Actions, now).
- Add code coverage report CI as a GitHub Action (based on implementation by ['ggplot2'](https://github.com/tidyverse/ggplot2/blob/master/.github/workflows/test-coverage.yaml))

# mustashe 0.1.3

- An error is raised if the '.mustashe' directory cannot be created (#9).
Expand Down
6 changes: 4 additions & 2 deletions R/clear_stash.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Clear the stash
#'
#' Clears the hidden '.mustashe' directory.
#'
#'
#' @param verbose Whether to print action statements (default TRUE).
#'
#' @return Returns \code{NULL} (invisibly).
Expand All @@ -10,7 +10,9 @@
#' clear_stash()
#' @export clear_stash
clear_stash <- function(verbose = TRUE) {
if (verbose) { message("Clearing stash.") }
if (verbose) {
message("Clearing stash.")
}
file.remove(c(
list.files(get_stash_dir(), full.names = TRUE, pattern = "qs$"),
list.files(get_stash_dir(), full.names = TRUE, pattern = "hash$")
Expand Down
16 changes: 11 additions & 5 deletions R/stash.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @param code The code to generate the object to be stashed.
#' @param depends_on A vector of other objects that this one depends on. Changes
#' to these objects will cause the re-running of the code, next time.
#' @param functional If TRUE, return the object rather than setting in the global environment (default FALSE).
#' @param functional If TRUE, return the object rather than setting in the global environment (default FALSE).
#' @param verbose Whether to print action statements (default TRUE).
#'
#' @return Returns \code{NULL} (invisibly).
Expand Down Expand Up @@ -50,17 +50,23 @@ stash <- function(var, code, depends_on = NULL, functional = FALSE, verbose = TR
if (has_been_stashed(var)) {
old_hash_tbl <- get_hash_table(var)
if (hash_tables_are_equivalent(old_hash_tbl, new_hash_tbl)) {
if (verbose) { message("Loading stashed object.") }
if (verbose) {
message("Loading stashed object.")
}
res <- load_variable(var, functional)
} else {
if (verbose) { message("Updating stash.") }
if (verbose) {
message("Updating stash.")
}
res <- new_stash(var, formatted_code, new_hash_tbl, functional)
}
} else {
if (verbose) { message("Stashing object.") }
if (verbose) {
message("Stashing object.")
}
res <- new_stash(var, formatted_code, new_hash_tbl, functional)
}

invisible(res)
}

Expand Down
8 changes: 6 additions & 2 deletions R/unstash.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
unstash <- function(var, verbose = TRUE) {
f <- function(v) {
if (has_been_stashed(v)) {
if (verbose) { message(paste0("Unstashing '", v, "'.")) }
if (verbose) {
message(paste0("Unstashing '", v, "'."))
}
file.remove(unlist(stash_filename(v)))
} else {
if (verbose) { message(paste0("No object '", v, "' in stash.")) }
if (verbose) {
message(paste0("No object '", v, "' in stash."))
}
}
}
lapply(var, f)
Expand Down
2 changes: 0 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ mustashe::clear_stash()
[![CRAN status](https://www.r-pkg.org/badges/version/mustashe)](https://CRAN.R-project.org/package=mustashe)
[![CRAN downloads](http://cranlogs.r-pkg.org/badges/grand-total/mustashe)](https://cran.r-project.org/package=mustashe)
[![R build status](https://github.com/jhrcook/mustashe/workflows/R-CMD-check/badge.svg)](https://github.com/jhrcook/mustashe/actions)
[![Travis build status](https://travis-ci.org/jhrcook/mustashe.svg?branch=master)](https://travis-ci.org/jhrcook/mustashe)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/jhrcook/mustashe?branch=master&svg=true)](https://ci.appveyor.com/project/jhrcook/mustashe)
[![Codecov test coverage](https://codecov.io/gh/jhrcook/mustashe/branch/master/graph/badge.svg)](https://codecov.io/gh/jhrcook/mustashe?branch=master)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
<!-- badges: end -->
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ status](https://www.r-pkg.org/badges/version/mustashe)](https://CRAN.R-project.o
downloads](http://cranlogs.r-pkg.org/badges/grand-total/mustashe)](https://cran.r-project.org/package=mustashe)
[![R build
status](https://github.com/jhrcook/mustashe/workflows/R-CMD-check/badge.svg)](https://github.com/jhrcook/mustashe/actions)
[![Travis build
status](https://travis-ci.org/jhrcook/mustashe.svg?branch=master)](https://travis-ci.org/jhrcook/mustashe)
[![AppVeyor build
status](https://ci.appveyor.com/api/projects/status/github/jhrcook/mustashe?branch=master&svg=true)](https://ci.appveyor.com/project/jhrcook/mustashe)
[![Codecov test
coverage](https://codecov.io/gh/jhrcook/mustashe/branch/master/graph/badge.svg)](https://codecov.io/gh/jhrcook/mustashe?branch=master)
[![License: GPL
Expand Down Expand Up @@ -71,7 +67,7 @@ stash("rnd_vals", {
})
#> Stashing object.
tictoc::toc()
#> random simulation: 3.481 sec elapsed
#> random simulation: 3.638 sec elapsed
```

Now, if we come back tomorrow and continue working on the same analysis,
Expand All @@ -87,7 +83,7 @@ stash("rnd_vals", {
})
#> Loading stashed object.
tictoc::toc()
#> random simulation: 0.02 sec elapsed
#> random simulation: 0.016 sec elapsed
```

## Dependencies
Expand Down
6 changes: 3 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ navbar:
articles:
text: Articles
menu:
- text: Getting Started
- text: Getting started
href: articles/getting-started.html
- text: How 'mustashe' works
href: articles/how-mustashe-works.html
news:
text: News
href: news/index.html
github:
icon: fa-github fa-lg
href: https://github.com/jhrcook/stashR
icon: fab fa-github fa-lg
href: https://github.com/jhrcook/mustashe
twitter:
icon: fab fa-twitter fa-lg
href: https://twitter.com/JoshDoesa
Expand Down
52 changes: 0 additions & 52 deletions appveyor.yml

This file was deleted.

47 changes: 32 additions & 15 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
# mustashe
# 'mustashe' 0.1.4

## Bug fix and minor version release
May 15, 2021

Brian Ripley reported that the tests for this package failed on the CRAN macOS servers.
I was unable to reproduce this on my machine running macOS 10.15.2, and it seems like this problem only occured on versions of macOS 10.12 and older.
We were able able to correct the problem without changing any of the tests or package as it was caused by how the time of last modification was reported for files written and read by the `stash()` function.
## Test environments

This is also a minor version release because we have switched to using the 'qs: Quick Serialization of R Objects' package for reading and writing files instead of using RDS files.
- (developed on) macOS Catalina 10.15.2, 4.0.5
- macOS x86_64-apple-darwin15.6.0 (64-bit) (on GitHub Actions), R 3.6.3
- macOS x86_64-apple-darwin15.6.0 (64-bit) (on GitHub Actions), R 4.0.5
- Ubuntu 16.04 (on GitHub Actions), R 3.5.3
- Ubuntu 16.04 (on GitHub Actions), R 3.6.3
- Ubuntu 16.04 (on GitHub Actions), R 4.0.5
- Microsoft Windows Server 2019 (on GitHub Actions), R 3.6.3
- Microsoft Windows Server 2019 (on GitHub Actions), R 4.0.5

## Test environments
## `R CMD check --as-cran` results

There were no ERRORs nor WARNINGs. There was 1 NOTE about how this package has previously been archived:

```
* checking CRAN incoming feasibility ... NOTE
Maintainer: ‘Joshua H Cook <[email protected]>’
New submission
Package was archived on CRAN
CRAN repository db overrides:
X-CRAN-Comment: Archived on 2021-04-28 as check problems were not
corrected in time.
- local macOS Catalina v10.15.2
- R version 3.6.1 (2019-07-05)
- Ubuntu 16.04.6 LTS
- R version 3.6.2 (2017-01-27)
- Windows Server 2012 R2 x64 (build 9600)
- R version 3.6.3 Patched (2020-03-11 r78011)
Suggests: packages not used conditionally.
```

## R CMD check results
## Changes

There were no ERRORs, WARNINGs, or NOTES
This update to 'mustashe' addresses issues on CRAN serves.
This package was previously archived, but I believe the issues have been fixed.
No new features.
Loading

0 comments on commit 5547b7f

Please sign in to comment.