Skip to content

Commit

Permalink
Set manifest$packages and manifest$files to NA when there are not pac…
Browse files Browse the repository at this point in the history
…kages files in the manifest.
  • Loading branch information
kippandrew committed Oct 18, 2013
1 parent 468c09d commit d4e7ed8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions R/bundle.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ createAppManifest <- function(appDir, files) {
packages[[pkg]] <- description
}


# provide checksums for all files
fileChecksums <- list()
for (file in files) {
Expand All @@ -53,8 +54,19 @@ createAppManifest <- function(appDir, files) {
manifest <- list()
manifest$version <- 1
manifest$platform <- R.version.string
manifest$packages <- I(packages)
manifest$files <- I(fileChecksums)

# if there are no packages set manifes$packages to NA (json null)
if (length(packages) > 0) {
manifest$packages <- I(packages)
} else {
manifest$packages <- NA
}
# if there are no files, set manifest$files to NA (json null)
if (length(files) > 0) {
manifest$files <- I(fileChecksums)
} else {
manifest$files <- NA
}

# return it as json
RJSONIO::toJSON(manifest, pretty = TRUE)
Expand Down

0 comments on commit d4e7ed8

Please sign in to comment.