Skip to content

Commit 245cd95

Browse files
committed
Adaptation of run() to install latest release matching the svbox version
1 parent a70ee1b commit 245cd95

File tree

3 files changed

+68
-10
lines changed

3 files changed

+68
-10
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: BioDataScience
22
Type: Package
3-
Version: 0.25.0
3+
Version: 2018.0.0
44
Title: A Series of Learnr Documents for Biological Data Science
55
Description: Interactive documents using learnr for studying biological data science.
66
Authors@R: c(

NEWS.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,75 @@
11
# BioDataScience News
22

3+
## Changes in version 2018.0.0
4+
5+
- `run()` modified to install latest release matching svbox year.
6+
7+
38
## Changes in version 0.25.0
49

5-
- Review of the all tutoriels (00a - 13c) with the **svbox 2018**
10+
- Review of the all tutorials (00a - 13c) with the **svbox 2018**
611

712
## Changes in version 0.24.0
813

914
- Tutorial examen_c finalized
1015

16+
1117
## Changes in version 0.23.1
1218

1319
- Review tutorials 00 and 02 with svbox2019
1420

21+
1522
## Changes in version 0.23.0
1623

1724
- Review of the all tutoriels (02a - 12a)
1825

26+
1927
## Changes in version 0.22.0
2028

2129
- Tutorial examen_b finalized
2230

31+
2332
## Changes in version 0.21.0
2433

2534
- Tutorial examen_a finalized
2635

36+
2737
## Changes in version 0.20.0
2838

2939
- Tutorial 12a_correlation finalized
3040

41+
3142
## Changes in version 0.19.0
3243

33-
- correction of bug to 11b and 11a
44+
- Correction of bugs to 11b and 11a
45+
3446

3547
## Changes in version 0.18.2
3648

3749
- Tutorial 11b_syntaxr finalized
50+
3851
- Tutorial 11a_anova2 finalized
3952

53+
4054
## Changes in version 0.18.0
4155

4256
- Tutorial 11b_syntaxr finalized
4357

58+
4459
## Changes in version 0.17.0
4560

4661
- Tutorial 11a_anova2 finalized
4762

63+
4864
## Changes in version 0.16.0
4965

5066
- Tutorial 10b_anova finalized
5167

68+
5269
## Changes in version 0.15.0
5370

5471
- Tutorial 10a_anova finalized
72+
5573
- Addition of a test shiny app (histogram.R)
5674

5775

@@ -64,33 +82,41 @@
6482

6583
- Tutorial 09a_student finalized
6684

85+
6786
## Changes in version 0.12.1
6887

6988
- Tutorial 08b_chi2 finalized
70-
- add html file 08b_chi2
89+
90+
- Add html file 08b_chi2
91+
7192

7293
## Changes in version 0.12.0
7394

7495
- Tutorial 08b_chi2 finalized
7596

97+
7698
## Changes in version 0.11.0
7799

78100
- Tutorial 08a_chi2 finalized
79101

102+
80103
## Changes in version 0.10.0
81104

82105
- Tutorial 07b_distri finalized
83106

107+
84108
## Changes in version 0.9.0
85109

86110
- Tutorial 07a_proba finalized
111+
87112
- Tutorial 06a_test finalized
88113

89114

90115
## Changes in version 0.8.0
91116

92117
- Tutorial 05a_test finalized
93118

119+
94120
## Changes in version 0.7.0
95121

96122
- Tutorial 04a_test finalized

R/run.R

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,50 @@ run <- function(tutorial, ..., update = ask, ask = interactive()) {
8686
github_response(req)
8787
}
8888

89+
get_last_tag <- function() {
90+
# Check if run from within a SciViews Box
91+
hostname <- ""
92+
if (file.exists("/etc/hostname"))
93+
hostname <- readLines("/etc/hostname")[1]
94+
if (!grepl("^box[0-9]{4}", hostname))
95+
warning(paste("Not run from withing a SciViews Box:",
96+
"no update and expect weird behavior of the tutorials"))
97+
98+
# Get the year of the SciViews Box
99+
box_year <- substr(hostname, 4, 7)
100+
# Pattern is v[box_year].x.y
101+
v_pat <- paste0("^[vV]", box_year, "\\.[0-9]+\\.[0-9]+$")
102+
103+
# Get all tags for BioDataScience
104+
good_tags <- character(0)
105+
all_tags_data <- try(github_GET(
106+
"repos/BioDataScience-Course/BioDataScience/releases"),
107+
silent = TRUE)
108+
if (!inherits(all_tags_data, "try-error")) {
109+
all_tags <- sapply(all_tags_data, getElement, "tag_name")
110+
# Keep only tags related to this svbox
111+
good_tags <- all_tags[grepl(v_pat, all_tags)]
112+
}
113+
# Return latest (first one) among all valid tags
114+
if (length(good_tags)) good_tags[1] else NULL
115+
}
116+
89117
# Look what is latest release and compare with current version of the package
90118
updated <- FALSE
91119
if (isTRUE(update)) {
92-
last_tag <- try(github_GET(
93-
"repos/BioDataScience-Course/BioDataScience/releases/latest")$tag_name,
94-
silent = TRUE)
95-
if (!inherits(last_tag, "try-error") &&
96-
grepl("^[vV][0-9]+\\.[0-9]+\\.[0-9]+$", last_tag)) {
120+
#last_tag <- try(github_GET(
121+
# "repos/BioDataScience-Course/BioDataScience/releases/latest")$tag_name,
122+
# silent = TRUE)
123+
#if (!inherits(last_tag, "try-error") &&
124+
# grepl("^[vV][0-9]+\\.[0-9]+\\.[0-9]+$", last_tag)) {
125+
last_tag <- get_last_tag()
126+
if (!is.null(last_tag)) {
97127
last_rel <- sub("^[vV]([0-9]+\\.[0-9]+)\\.([0-9]+)$", "\\1-\\2", last_tag)
98128
curr_rel <- sub("^([0-9]+\\.[0-9]+)\\.([0-9]+)$", "\\1-\\2",
99129
packageVersion("BioDataScience"))
100-
status <- try(compareVersion(last_rel, curr_rel) > 0, silent = TRUE)
130+
# In previous version we tested if compareVersion() > 0, but here, we
131+
# rather check if it is different, cf. may need to downgrade possibly
132+
status <- try(compareVersion(last_rel, curr_rel) != 0, silent = TRUE)
101133
if (!inherits(status, "try-error")) {
102134
if (status > 0) {
103135
# We need to update the package

0 commit comments

Comments
 (0)