From b5f30774c0e9528a6e4413691b59cbea4086fa75 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Wed, 10 Feb 2021 15:42:45 +0100 Subject: [PATCH] streamline and upgrade muggle closes #260 --- .Rbuildignore | 3 +- .github/CODE_OF_CONDUCT.md | 25 --------- .github/CONTRIBUTING.md | 106 ------------------------------------ .github/workflows/main.yaml | 44 +++++++++------ .gitignore | 2 - DESCRIPTION | 13 +++-- Dockerfile | 2 +- NEWS.md | 5 -- R/plots.R | 2 +- README.md | 36 +++++------- hoad.code-workspace | 8 --- inst/app/dashboard.Rmd | 2 +- man/colors.Rd | 15 +++-- man/oa_by_license.Rd | 5 +- man/oa_by_other.Rd | 5 +- pkgdown/.gitignore | 1 - pkgdown/_pkgdown.yml | 7 +-- pkgdown/index.Rmd | 25 --------- vignettes/_site.yml | 5 -- 19 files changed, 69 insertions(+), 242 deletions(-) delete mode 100644 .github/CODE_OF_CONDUCT.md delete mode 100644 .github/CONTRIBUTING.md delete mode 100644 NEWS.md delete mode 100644 hoad.code-workspace delete mode 100644 pkgdown/.gitignore delete mode 100644 pkgdown/index.Rmd delete mode 100644 vignettes/_site.yml diff --git a/.Rbuildignore b/.Rbuildignore index a7a8699..b38e7b1 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,7 +7,6 @@ Dockerfile .dockerignore ^\.github$ -^\.deps$ .rstudio hoad.code-workspace ^R/.add_emails\.R$ @@ -17,3 +16,5 @@ hoad.code-workspace ^R/.scoap\.R$ ^R/.unpaywall_integration\.R$ .vscode +.azure +^\.Rproj\.user$ diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md deleted file mode 100644 index 0343527..0000000 --- a/.github/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,25 +0,0 @@ -# Contributor Code of Conduct - -As contributors and maintainers of this project, we pledge to respect all people who -contribute through reporting issues, posting feature requests, updating documentation, -submitting pull requests or patches, and other activities. - -We are committed to making participation in this project a harassment-free experience for -everyone, regardless of level of experience, gender, gender identity and expression, -sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. - -Examples of unacceptable behavior by participants include the use of sexual language or -imagery, derogatory comments or personal attacks, trolling, public or private harassment, -insults, or other unprofessional conduct. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, -commits, code, wiki edits, issues, and other contributions that are not aligned to this -Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed -from the project team. - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by -opening an issue or contacting one or more of the project maintainers. - -This Code of Conduct is adapted from the Contributor Covenant -(https://www.contributor-covenant.org), version 1.0.0, available at -https://contributor-covenant.org/version/1/0/0/. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index cb05e30..0000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,106 +0,0 @@ -# Contributing to the hoad project - -This outlines how to propose a change to the hybrid open access dashboard (hoad). - - -## Project Structure - -Because hoad is not only a research project, but primarily a data product meant to be used by many, hoad is organised as an R package. - -Please adhere by the package development best practices laid out in: - -- Hadley Wickham's [R Packages](https://r-pkgs.org/index.html) -- [rOpenSci Development Guide](https://devguide.ropensci.org/) - - -### Documentation - -Individual functions are documented using [{roxygen2}](https://roxygen2.r-lib.org). -Functions can be further organised using curated reference index in [{pkgdown}](https://pkgdown.r-lib.org/). - -Scientific articles, blog posts or any other long-form documentation is written as a [{pkgdown}](https://pkgdown.r-lib.org/) *article* inside the packages `/vignettes/` folder. -These articles are written as `bookdown::html_document2()` documents *not* as proper R vignettes, to avoid duplicate publication and to allow more expensive computations. - - -### Shiny Application - -tba. - - -### Computing Environments - -There are two sets of computing environments on which this project is guaranteed to work as per the CI setup: - -1. The {hoad} package, including all its functions, is guaranteed to work (pass `R CMD check`) on a wide variety of computing environments as per the CI setup, a subset of the [tidyverse setup](https://github.com/r-lib/actions/tree/master/examples#quickstart-ci-workflow) and [r-hub linux builders](https://github.com/r-hub/rhub-linux-builders). - Because these tests can be quite extensive, they are only run on commits to `master`, as well as pull requests to `master`. - Other branches are thus not guaranteed to work. -2. All other elements of this projects can be reproduced using a custom docker image in the `Dockerfile`: - - the [{pkgdown}](http://pkgdown.r-lib.org) website for hoad (https://subugoe.github.io/hoad/), including its articles (~ vignettes) - - the shiny web application - - (batch) jobs to reproduce more expensive analyses - - This image is also published on every commit to [docker hub](https://hub.docker.com/repository/docker/subugoe/hoad), tagged by git sha and reference (branch, release). - - This image also includes the RStudio IDE, so you can also develop *inside* this image. - - To run this image, navigate your shell to the root of the repository on your machine and run: - - ``` - docker run --env DISABLE_AUTH=true \ - --publish 8787:8787 \ - --volume $(pwd):/home/rstudio/Documents - subugoe/hoad:refactor-as-pkg - ``` - - This will automatically download the build image from Docker Hub. - You can also rebuild it locally by running - - ``` - docker build --tag hoad . - ``` - -## Fixing typos - -You can fix typos, spelling mistakes, or grammatical errors in the documentation directly using the GitHub web interface, as long as the changes are made in the _source_ file. -This generally means you'll need to edit [roxygen2 comments](https://roxygen2.r-lib.org/articles/roxygen2.html) in an `.R`, not a `.Rd` file. -You can find the `.R` file that generates the `.Rd` by reading the comment in the first line. - -## Bigger changes - -If you want to make a bigger change, it's a good idea to first file an issue and make sure someone from the team agrees that it’s needed. -If you’ve found a bug, please file an issue that illustrates the bug with a minimal -[reprex](https://www.tidyverse.org/help/#reprex) (this will also help you write a unit test, if needed). - - -### Pull request process - -This requires kno - -* Fork the package and clone onto your computer. If you haven't done this before, we recommend using `usethis::create_from_github("subugoe/hoad", fork = TRUE)`. - -* Install all development dependences with `devtools::install_dev_deps()`, and then make sure the package passes R CMD check by running `devtools::check()`. - If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing. -* Create a Git branch for your pull request (PR). We recommend using `usethis::pr_init("brief-description-of-change")`. - -* Make your changes, commit to git, and then create a PR by running `usethis::pr_push()`, and following the prompts in your browser. - The title of your PR should briefly describe the change. - The body of your PR should contain `Fixes #issue-number`. - -* For user-facing changes, add a bullet to the top of `NEWS.md` (i.e. just below the first header). Follow the style described in . - -### Code style - -* New code should follow the tidyverse [style guide](https://style.tidyverse.org). - You can use the [styler](https://CRAN.R-project.org/package=styler) package to apply these styles, but please don't restyle code that has nothing to do with your PR. - -* We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/markdown.html), for documentation. - -* We use [testthat](https://cran.r-project.org/package=testthat) for unit tests. - Contributions with test cases included are easier to accept. - - -## Code of Conduct - -Please note that the hoad project is released with a -[Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this -project you agree to abide by its terms. diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c856fb5..997d283 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -8,8 +8,11 @@ jobs: run: shell: Rscript {0} container: - # this needs to be the same as in Dockerfile - image: subugoe/muggle-onbuild:f60004c31979947dab53fbf9cfbb0e7f1c4bea55 + # update muggle here and in Dockerfile + image: subugoe/muggle-buildtime-onbuild:0.1.1-20210126 + env: + MUGGLE_PKG_NAME: ${{ github.event.repository.name }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 - name: Cache R Packages @@ -26,18 +29,17 @@ jobs: R_LIBS_SITE: $R_LIBS_APP_GH run: remotes::install_deps(dependencies = TRUE) - name: Check - run: muggle::rcmdcheck2() + # TODO error out on all but note again https://github.com/subugoe/hoad/issues/194 + run: devtools::check(error_on = "error") - name: Test Coverage run: covr::codecov() - name: Build Package Website - run: | - # extra step is necessary to build index.md to integrate readme and landing page - rmarkdown::render("pkgdown/index.Rmd") - pkgdown::build_site(override = list(new_process = FALSE)) - - uses: docker/build-push-action@v1 - name: Build Dev Image + run: muggle::build_site2(new_process = FALSE) + - name: Build Buildtime Image + uses: docker/build-push-action@v1 with: - repository: ${{ github.repository }}/hoad-dev + repository: ${{ github.repository }}/${{ env.MUGGLE_PKG_NAME }}-buildtime + target: buildtime username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: docker.pkg.github.com @@ -48,14 +50,21 @@ jobs: tags: ${{ github.sha }} add_git_labels: true push: ${{ github.event_name != 'pull_request' }} - - name: Setup GCP Cloud SDK - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master + - name: Build Runtime Image + uses: docker/build-push-action@v1 with: - project_id: ${{ secrets.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SA_KEY }} - export_default_credentials: true - - run: gcloud info - shell: bash + repository: ${{ github.repository }}/${{ env.MUGGLE_PKG_NAME }}-runtime + target: runtime + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: docker.pkg.github.com + # this will set "latest" if master as per https://github.com/docker/build-push-action + tag_with_ref: true + # we're relying on long shas only to keep things easy + tag_with_sha: false + tags: ${{ github.sha }} + add_git_labels: true + push: ${{ github.event_name != 'pull_request' }} - name: Deploy Shiny Application to shinyapps.io ref env: SHINYAPPS_TOKEN: ${{ secrets.SHINYAPPS_TOKEN }} @@ -73,4 +82,3 @@ jobs: uses: maxheld83/ghpages@github-token env: BUILD_DIR: docs - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 5d13ec2..55683b0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,4 @@ .Rhistory .RData .Ruserdata -*.DS_Store docs/ -.rstudio/ diff --git a/DESCRIPTION b/DESCRIPTION index c8dfe49..ae8bff9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: hoad Title: Hybrid Open Access Dashboard -Version: 1.0.0 +Version: 1.0.1.9000 Authors@R: c( person( @@ -41,7 +41,8 @@ Authors@R: role = c("dtc") ) ) -Description: Analytics to increase cost transparency in business model transformation towards open access publishing. +Description: + Analytics to increase cost transparency in business model transformation towards open access publishing. License: AGPL-3 Encoding: UTF-8 Language: en @@ -62,7 +63,6 @@ Suggests: DT, writexl, echarts4r, - metar, DBI, dbplyr, haven, @@ -75,10 +75,11 @@ Suggests: httr, purrr, covr, - testthat + testthat, + subugoetheme URL: https://subugoe.github.io/hoad, https://github.com/subugoe/hoad/ BugReports: https://github.com/subugoe/hoad/issues -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.1.9999 Imports: dplyr, checkmate, @@ -88,4 +89,4 @@ Imports: ggplot2, rlang Remotes: - subugoe/metar@7ccc2a0 + subugoe/subugoetheme@1.1.1 diff --git a/Dockerfile b/Dockerfile index 5ea4d89..36e59d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1 @@ -FROM subugoe/muggle-onbuild:f60004c31979947dab53fbf9cfbb0e7f1c4bea55 +FROM subugoe/muggle-buildtime-onbuild:0.1.1-20210126 diff --git a/NEWS.md b/NEWS.md deleted file mode 100644 index 65be4c0..0000000 --- a/NEWS.md +++ /dev/null @@ -1,5 +0,0 @@ -# hoad 1.0.0 - -## Major changes - -- Hello world, {hoad} is now an R package (@maxheld83 #59). diff --git a/R/plots.R b/R/plots.R index b8d9f84..cae5241 100644 --- a/R/plots.R +++ b/R/plots.R @@ -1,5 +1,5 @@ #' Color palettes -#' Colors used in the hybrid open access dashboard, based on [metar::ugoe_pal()] +#' Colors used in the hybrid open access dashboard, based on [subugoetheme::ugoe_pal()] #' @family visualisation functions #' @name colors NULL diff --git a/README.md b/README.md index d1066f8..880da7c 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,24 @@ -# hoad - [![Main](https://github.com/subugoe/hoad/workflows/.github/workflows/main.yaml/badge.svg)](https://github.com/subugoe/hoad/actions) +[![Codecov test coverage](https://codecov.io/gh/subugoe/hoad/branch/master/graph/badge.svg)](https://codecov.io/gh/subugoe/hoad?branch=master) [![CRAN status](https://www.r-pkg.org/badges/version/hoad)](https://CRAN.R-project.org/package=hoad) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) -[![Codecov test coverage](https://codecov.io/gh/subugoe/hoad/branch/master/graph/badge.svg)](https://codecov.io/gh/subugoe/hoad?branch=master) +
+

Hybrid OA Dashboard

+

+ Bibliometric data analytics to increase cost transparency in hybrid open access transformation contracts. +

+

+ + Try out the dashboard + + + Sign up to the newsletter (german only) + +

+
## Overview @@ -26,21 +38,3 @@ The project is based on data gathered by the [Crossref](http://www.crossref.org/ The package is at the [Göttingen State and University Libary](https://www.sub.uni-goettingen.de/) as part of the [DFG](https://www.dfg.de)-funded eponymous Hybrid Open Access Dashboard project. An early prototype of the application, including the interactive web frontend is available at https://subugoe.github.io/hoad/. - - -## Installation - -```r -remotes::install_github("subugoe/hoad") -``` - - -## Getting Started - -```r -library(hoad) -``` - -You can start the dashboard locally, by running `runHOAD()`. - -More functions and data will be exposed in the future for modular reuse. diff --git a/hoad.code-workspace b/hoad.code-workspace deleted file mode 100644 index 5709732..0000000 --- a/hoad.code-workspace +++ /dev/null @@ -1,8 +0,0 @@ -{ - "folders": [ - { - "path": "." - } - ], - "settings": {} -} diff --git a/inst/app/dashboard.Rmd b/inst/app/dashboard.Rmd index 9017d63..57e9848 100644 --- a/inst/app/dashboard.Rmd +++ b/inst/app/dashboard.Rmd @@ -4,7 +4,7 @@ output: flexdashboard::flex_dashboard: orientation: rows vertical_layout: fill - css: !expr metar::subugoe_template()$assets$css + css: !expr subugoetheme::pkgdown_template()$assets$css runtime: shiny --- diff --git a/man/colors.Rd b/man/colors.Rd index c84793a..b680a3c 100644 --- a/man/colors.Rd +++ b/man/colors.Rd @@ -7,7 +7,7 @@ \alias{colors_license_unpaywall} \alias{colors_source_disclosure} \title{Color palettes -Colors used in the hybrid open access dashboard, based on \code{\link[metar:ugoe_pal]{metar::ugoe_pal()}}} +Colors used in the hybrid open access dashboard, based on \code{\link[subugoetheme:ugoe_pal]{subugoetheme::ugoe_pal()}}} \format{ An object of class \code{character} of length 6. @@ -24,16 +24,19 @@ colors_source_disclosure } \description{ Color palettes -Colors used in the hybrid open access dashboard, based on \code{\link[metar:ugoe_pal]{metar::ugoe_pal()}} +Colors used in the hybrid open access dashboard, based on \code{\link[subugoetheme:ugoe_pal]{subugoetheme::ugoe_pal()}} } -\section{Functions}{ +\section{Related Functions and Methods}{ +\subsection{Functions}{ \itemize{ \item \code{colors_license}: licenses - +} +\itemize{ \item \code{colors_license_unpaywall}: other types of OA license information detected by Unpaywall - +} +\itemize{ \item \code{colors_source_disclosure}: sources of disclosure of OA sponsorship -}} +}}} \concept{visualisation functions} \keyword{datasets} diff --git a/man/oa_by_license.Rd b/man/oa_by_license.Rd index 42c2640..385632b 100644 --- a/man/oa_by_license.Rd +++ b/man/oa_by_license.Rd @@ -12,10 +12,11 @@ oa_by_license_plot() \description{ Open Access Articles by Year and License } -\section{Functions}{ +\section{Related Functions and Methods}{ +\subsection{Functions}{ \itemize{ \item \code{oa_by_license_plot}: Plot by License and Year -}} +}}} \examples{ oa_by_license() diff --git a/man/oa_by_other.Rd b/man/oa_by_other.Rd index 9da7b2c..03569cb 100644 --- a/man/oa_by_other.Rd +++ b/man/oa_by_other.Rd @@ -17,10 +17,11 @@ oa_by_other_plot(x = oa_by_other()) \description{ \emph{Additional} license information (compared to \code{\link[=oa_by_license]{oa_by_license()}}) as detected by Unpaywall. } -\section{Functions}{ +\section{Related Functions and Methods}{ +\subsection{Functions}{ \itemize{ \item \code{oa_by_other_plot}: plotting -}} +}}} \examples{ oa_by_other() diff --git a/pkgdown/.gitignore b/pkgdown/.gitignore deleted file mode 100644 index fc0ab8a..0000000 --- a/pkgdown/.gitignore +++ /dev/null @@ -1 +0,0 @@ -index.md diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 0acde19..65a4593 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -17,13 +17,8 @@ authors: href: https://github.com/openapc html: template: - package: metar - opengraph: - twitter: - site: "@subugoe" - card: summary_large_image + package: subugoetheme params: - ganalytics: UA-48816137-14 docsearch: api_key: 13f4fe309e30d18dcf23516610160625 index_name: hoad diff --git a/pkgdown/index.Rmd b/pkgdown/index.Rmd deleted file mode 100644 index 51ac4f1..0000000 --- a/pkgdown/index.Rmd +++ /dev/null @@ -1,25 +0,0 @@ ---- -output: - github_document: - html_preview: FALSE ---- - -
- - -# Hybrid OA Dashboard -

- Bibliometric data analytics to increase cost transparency in hybrid open access transformation contracts. -

-

- - Try out the dashboard - - - Sign up to the newsletter (german only) - -

-
- -```{r, child="../README.md"} -``` diff --git a/vignettes/_site.yml b/vignettes/_site.yml deleted file mode 100644 index f6760a2..0000000 --- a/vignettes/_site.yml +++ /dev/null @@ -1,5 +0,0 @@ -output: - bookdown::html_document2: - number_sections: false - df_print: paged - toc: yes