Skip to content

Commit

Permalink
Merge pull request #31 from atorus-research/dev
Browse files Browse the repository at this point in the history
Version 0.2.0 release
  • Loading branch information
mstackhouse authored Jan 9, 2024
2 parents 50f04a8 + 3e9b5fe commit 0bad723
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 2,421 deletions.
1 change: 0 additions & 1 deletion .Rprofile

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# 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
- dev
pull_request:
branches:
- main
- master
- dev

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: datasetjson
Type: Package
Title: Read and Write CDISC Dataset JSON Files
Version: 0.1.0
Version: 0.2.0
Authors@R: c(
person(given = "Mike",
family = "Stackhouse",
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# datasetjson 0.2.0

- Remove schema validation on read and write (#26)
- Address CRAN issues (#29)

# datasetjson 0.1.0

- Capability to read and validate Dataset JSON files from URLs has been added (#8)
Expand Down
9 changes: 0 additions & 9 deletions R/read_dataset_json.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ read_dataset_json <- function(file) {
file_contents <- file
}

# Validate the input file against the schema
valid <- jsonvalidate::json_validate(file_contents, schema = schema_1_0_0, engine="ajv")

if (!valid) {
stop(paste0(c("Dataset JSON file is invalid per the JSON schema. ",
"Run datasetjson::validate_dataset_json(",substitute(file),") to see details")),
call.=FALSE)
}

# Read the file and convert to datasetjson object
ds_json <- jsonlite::fromJSON(file_contents)

Expand Down
9 changes: 0 additions & 9 deletions R/write_dataset_json.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ write_dataset_json <- function(x, file, pretty=FALSE) {
auto_unbox = TRUE,
pretty = pretty)

# Run the validator
valid <- jsonvalidate::json_validate(js, schema_1_0_0, engine="ajv")

if (!valid) {
stop(paste0(c("Dataset JSON file is invalid per the JSON schema. ",
"Run datasetjson::validate_dataset_json(",substitute(file),") to see details")),
call.=FALSE)
}

if (!missing(file)) {
# Write file to disk
cat(js, "\n", file = file)
Expand Down
Loading

0 comments on commit 0bad723

Please sign in to comment.