Skip to content

Commit

Permalink
Parse @ref first, then owner/repo/subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
Arni Magnusson committed Dec 11, 2019
1 parent 76bc099 commit b18e055
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 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: 3.3-1
Date: 2019-12-06
Date: 2019-12-11
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
3 changes: 2 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
--------------------------------------------------------------------------------
icesTAF 3.3-1 (2019-12-06)
icesTAF 3.3-1 (2019-12-11)
--------------------------------------------------------------------------------
o Improved handling of SOFTWARE.bib GitHub entries that have owner/repo/subdir.
Code contributed by Ibrahim Umar.

o Improved process.bib() so it verifies that 'access' values match the allowed
values.
Expand Down
15 changes: 8 additions & 7 deletions R/parse.repo.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@

parse.repo <- function(repo)
{
x <- unlist(strsplit(repo, "/"))

username <- head(x, 1)
repo.ref <- tail(x, 1)
subdir <- if(length(x) == 2) "" else unlist(strsplit(x[3], "@"))[1]
## 1 Read ref, then remove @reference tail
ref <- if(grepl("@",repo)) unlist(strsplit(repo,"@"))[2] else ""
repo <- sub("@.*", "", repo)

repo <- if(length(x) == 2) unlist(strsplit(repo.ref, "@"))[1] else x[2]
ref <- if(grepl("@", repo.ref)) unlist(strsplit(repo.ref, "@"))[2] else ""
## 2 Read username, repo, subdir
x <- unlist(strsplit(repo, "/"))
username <- x[1]
repo <- x[2]
subdir <- if(length(x) > 2) paste(x[-c(1,2)],collapse="/") else ""

list(username=username, repo=repo, subdir=subdir, ref=ref)
}

0 comments on commit b18e055

Please sign in to comment.