Skip to content

Commit 5644760

Browse files
distill issue building functions mostly complete
1 parent 4dad8c9 commit 5644760

File tree

5 files changed

+167
-77
lines changed

5 files changed

+167
-77
lines changed

R/articles.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ active_articles <- function() {
1616
#' @rdname active_articles
1717
#' @export
1818
accepted_articles <- function() {
19-
paths <- dir("Accepted", full.names = TRUE)
19+
paths <- dir(file.path(get_articles_path(), "Accepted"), full.names = TRUE)
2020
lapply(paths, as.article)
2121
}
2222

2323
news_articles <- function(issue) {
24-
dir(file.path("News_items", issue))
24+
dir(file.path(get_articles_path(), "News_items", issue), full.names = TRUE)
2525
}
2626

2727
#' Generate a new id value.

R/issue.R

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ make_proof <- function(id, share_path = file.path("..", "share"), exec=FALSE) {
6868
old <- setwd(get_articles_path())
6969
on.exit(setwd(old))
7070
dir <- issue_dir(id)
71-
if (!file.exists(dir)) {
71+
if (!file.exists(file.path(dir, "news"))) {
7272
# stop("Proof ", id, " already exists")
73-
dir.create(dir)
73+
xfun::dir_create(file.path(dir, "news"))
7474
}
7575

7676
prev_id <- previous_id(id)
@@ -79,20 +79,8 @@ make_proof <- function(id, share_path = file.path("..", "share"), exec=FALSE) {
7979
# file.copy(file.path(prev_dir, inherited_files), dir)
8080
# file.copy(file.path(share_path, "RJournal.sty"), dir)
8181

82-
issue_file <- issue_file(id)
83-
# file.copy(file.path(share_path, "RJournal_template.tex"), issue_file)
84-
issue <- read_tex(issue_file)
85-
86-
number <- issue_number(id)
87-
if (number == 1L) {
88-
issue$volume <- issue$volume + 1L
89-
}
90-
issue$volnum <- number
91-
issue$year <- issue_year(id)
92-
issue$month <- issue_month(id)
93-
9482
arts <- accepted_articles()
95-
ready <- filter_status(arts, "online")
83+
ready <- filter_status(arts, "proofed")
9684
for (art in ready) {
9785
if (exec) {
9886
system(paste(
@@ -108,11 +96,11 @@ make_proof <- function(id, share_path = file.path("..", "share"), exec=FALSE) {
10896
news <- news_articles(id)
10997
for (art in news) {
11098
if (exec) {
111-
system(paste(
112-
"git mv",
113-
shQuote(art),
114-
shQuote(file.path(dir, "news", basename(art)))
115-
))
99+
file.copy(
100+
art,
101+
file.path(dir, "news"),
102+
recursive = TRUE
103+
)
116104
} else {
117105
cat(art, file.path(dir, "news", basename(art)), "\n")
118106
}

0 commit comments

Comments
 (0)