Skip to content

Commit dfac879

Browse files
committed
CI sharestats website csv
1 parent 6876a6e commit dfac879

File tree

7 files changed

+31
-32
lines changed

7 files changed

+31
-32
lines changed

.github/workflows/packaging-action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
any::png
4242
any::RJSONIO
4343
any::xml2
44+
any::dplyr
45+
any::readr
4446
4547
- name: Install Exams developer version
4648
run: Rscript -e 'install.packages("exams", repos = "http://R-Forge.R-project.org", dependencies = TRUE, type = "source")'
@@ -66,6 +68,7 @@ jobs:
6668
- run: make fingerprint_file
6769
- run: make checksums
6870
- run: make website
71+
- run: make sharestats_website_csv
6972

7073
- name: commit results
7174
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ packages/
1515
docs/
1616

1717
*.py[cod]
18+
*.csv
1819

1920
AVOIDERROR

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ website:
3838
python -c 'import packaging as p; p.simplify_item_html("docs/items.html")' \
3939

4040

41+
sharestats_website_csv:
42+
mkdir -p docs; \
43+
Rscript packaging/sharestats_website_csv.R; \
44+
mv sharestats_website.csv docs/

packaging/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .packaging import file_table, tarballs, fingerprints, save_fingerprints
22

3-
from .website import simplify_item_html
3+
from .simplify import simplify_item_html
Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
library(dplyr)
2+
library(readr)
3+
4+
extractMeta <- function(file, convert2table = FALSE) {
5+
x <- read_lines(file)
6+
lnMeta <- grep("Meta-information", x)
7+
lnMeta <- seq(lnMeta + 2, length(x), 1)
8+
x <- x[lnMeta]
9+
names(x) <- gsub("(.*):.*", "\\1", x)
10+
x <- gsub(".*: (.*)", "\\1", x)
11+
x <- as.list(x)
12+
if(!convert2table) {
13+
x <- lapply(x, function(i) ifelse(i=="", NA, i))
14+
x <- x[!is.na(x)]
15+
return(x)
16+
} else {
17+
x <- t(do.call(rbind, x))
18+
return(data.frame(x))
19+
}
20+
}
21+
122
## All in one table
223
all.item.paths <- list.files(pattern = ".Rmd", ignore.case = TRUE, recursive = TRUE)
324
n <- length(all.item.paths)
@@ -48,7 +69,6 @@ url_name_quest_df <- do.call(rbind, df)
4869

4970

5071
# Meta-info Extraction ----------------------------------------------------
51-
source('extractMeta_function.R')
5272
ErrorsMI <- c()
5373
metadf <- list()
5474
for(i in 1:n){
@@ -79,4 +99,4 @@ metadf <- metadf %>% dplyr::select(exname,
7999

80100
fulldf <- right_join(url_name_quest_df, metadf, by = c("name" = "Name"))
81101

82-
write.csv(fulldf, 'fulldf.csv')
102+
write.csv(fulldf, 'sharestats_website.csv')

scripts_website/extractMeta_function.R

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)