Skip to content

Commit 4ad3678

Browse files
committed
update version and write out generate zenodo code
1 parent 56e2996 commit 4ad3678

File tree

2 files changed

+55
-6
lines changed

2 files changed

+55
-6
lines changed

DESCRIPTION

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: RCubedIntermediate
22
Title: "Reproducible Research in R: An Intermediate Workshop on
33
Modern Approaches and Workflows to Processing Data"
4-
Version: 0.1.0
4+
Version: 1.0
55
Authors@R:
66
c(person(given = "Luke",
77
family = "Johnston",
@@ -37,6 +37,11 @@ Description: Reproducibility and open scientific practices are
3737
more details on the course, check out the <a
3838
href='https://r-cubed-intermediate.rostools.org'>website</a>.
3939
URL: https://r-cubed-intermediate.rostools.org
40+
Remotes:
41+
gadenbuie/xaringanthemer,
42+
gitlab::rostools/r3,
43+
hadley/emo
44+
Encoding: UTF-8
4045
Depends:
4146
R (>= 4.0.0)
4247
Imports:
@@ -61,8 +66,3 @@ Suggests:
6166
usethis,
6267
xaringan,
6368
xaringanthemer
64-
Remotes:
65-
gadenbuie/xaringanthemer,
66-
gitlab::rostools/r3,
67-
hadley/emo
68-
Encoding: UTF-8

R/generate-zenodo-metadata.R

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
library(desc)
2+
library(tidyverse)
3+
library(zen4R)
4+
library(git2r)
5+
6+
authors_df <- desc_get_field("Authors@R") %>%
7+
str_remove_all('("|\\(|\\)|,)') %>%
8+
str_split("person") %>%
9+
map(str_extract_all, pattern = "(given|family|affiliation|ORCID) = .*") %>%
10+
flatten() %>%
11+
map(as_tibble) %>%
12+
map_dfr(separate, col = "value", into = c("name", "value"), sep = " = ", .id = "id") %>%
13+
pivot_wider() %>%
14+
transmute(name = glue::glue("{family}, {given}"),
15+
affiliation = affiliation,
16+
orcid = ORCID)
17+
18+
lesson_title <- desc_get_field("Title") %>%
19+
str_remove_all("\"") %>%
20+
str_remove_all("\\n") %>%
21+
str_replace_all(" +", " ") %>%
22+
str_replace(":", " -")
23+
24+
description_content <- desc_get_field("Description") %>%
25+
str_remove_all("\\n") %>%
26+
str_replace_all(" +", " ")
27+
28+
repo <- repository()
29+
repo_version <- str_c("v", as.character(desc::desc_get_version()))
30+
version_tag <- tag(repo, name = repo_version, message = "Teaching material used for the Sept 8-9, 2020 course.")
31+
tag_files <- ls_tree(tree(lookup_commit(version_tag)))
32+
zip("r-cubed-intermediate.zip", tag_files)
33+
34+
new_record <- ZenodoRecord$new()
35+
pwalk(authors_df, new_record$addCreator)
36+
new_record$setUploadType("lesson")
37+
new_record$setTitle(str_c("r-cubed: ", lesson_title))
38+
new_record$setDescription(description_content)
39+
new_record$setLicense("cc-by")
40+
new_record$addRelatedIdentifier("isCompiledBy", "https://gitlab.com/rostools/r-cubed-intermediate")
41+
new_record$addRelatedIdentifier("isIdenticalTo", "https://gitlab.com/rostools/r-cubed-intermediate/-/tags/v0.1.0")
42+
43+
zenodo <- ZenodoManager$new(
44+
url = "https://sandbox.zenodo.org/api",
45+
logger = "INFO"
46+
)
47+
48+
deposited_record <- zenodo$depositRecord(new_record)
49+
zenodo$uploadFile("r-cubed-intermediate.zip", deposited_record$id)

0 commit comments

Comments
 (0)