Skip to content

Commit

Permalink
Parse 'bundle' field
Browse files Browse the repository at this point in the history
  • Loading branch information
Arni Magnusson committed Apr 8, 2019
1 parent 27dad9a commit cb0a4c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: icesTAF
Version: 2.3-0
Date: 2019-03-30
Date: 2019-04-08
Title: Functions to Support the ICES Transparent Assessment Framework
Authors@R: c(person("Arni", "Magnusson", role=c("aut","cre"), email="[email protected]"),
person("Colin", "Millar", role="aut"),
Expand Down
7 changes: 6 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------------
icesTAF 2.3-0 (2019-03-30)
icesTAF 2.3-0 (2019-04-08)
--------------------------------------------------------------------------------
o Added function sourceDir() to read all *.R files from a directory.

Expand All @@ -10,13 +10,18 @@ o Added arguments 'config', 'data', and 'software' to taf.bootstrap().
o Added argument 'append' to draft.data() and draft.software(). Code contributed
by Alexandros Kokkalis.

o Added argument 'colname' to xtab2taf().

o Improved draft.data() so the default value of 'year' is the current year and
user can pass period=FALSE.

o Improved file.encoding() so it handles spaces in filenames.

o Improved os.unix() so it recognizes both Linux and macOS operating systems.

o Improved process.bib() so it supports 'bundle' field and multiple filenames in
'source' field, separated by newlines.

o Improved write.taf() so file="" prints to screen, regardless of dir.


Expand Down
11 changes: 7 additions & 4 deletions R/process.bib.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,18 @@

process.bib <- function(bibfile)
{
dir <- if(bibfile == "DATA.bib") "data"
else if(bibfile == "SOFTWARE.bib") "software"
else stop("bibfile must be 'DATA.bib' or 'SOFTWARE.bib'")
mkdir(dir)
type <- if(bibfile == "DATA.bib") "data"
else if(bibfile == "SOFTWARE.bib") "software"
else stop("bibfile must be 'DATA.bib' or 'SOFTWARE.bib'")

entries <- if(file.exists(bibfile)) read.bib(bibfile) else list()

for(bib in entries)
{
## Prepare dir
dir <- if(is.null(bib$bundle)) type else file.path(type, bib$bundle)
mkdir(dir)

## If source contains multiple files then split into vector
bib$source <- trimws(unlist(strsplit(bib$source, "\\n")))
bib$source <- sub(",$", "", bib$source) # remove trailing comma
Expand Down

0 comments on commit cb0a4c0

Please sign in to comment.