Skip to content

Commit 5cb271f

Browse files
committed
Adding timeout to startup message
1 parent acc35cd commit 5cb271f

File tree

9 files changed

+33
-27
lines changed

9 files changed

+33
-27
lines changed

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors:
1111
- family-names: "Shang"
1212
given-names: "Yi"
1313
title: "SGP: Student Growth Percentiles & Percentile Growth Trajectories"
14-
version: 2.2-1.98
14+
version: 2.2-1.99
1515
doi: 10.5281/zenodo.13921157
16-
date-released: 2025-4-14
16+
date-released: 2025-4-24
1717
url: "https://sgp.io"

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: SGP
22
Type: Package
33
Title: Student Growth Percentiles & Percentile Growth Trajectories
4-
Version: 2.2-1.98
5-
Date: 2025-4-14
4+
Version: 2.2-1.99
5+
Date: 2025-4-24
66
Authors@R: c(person(given=c("Damian", "W."), family="Betebenner", email="dbetebenner@nciea.org", role=c("aut", "cre"), comment=c(ORCID = "0000-0003-0476-5599")),
77
person(given=c("Adam", "R."), family="Van Iwaarden", email="avaniwaarden@nciea.org", role="aut"),
88
person(given="Ben", family="Domingue", email="ben.domingue@gmail.com", role="aut"),
@@ -76,7 +76,7 @@ Authors@R: c(person(given=c("Damian", "W."), family="Betebenner", email="dbetebe
7676
Maintainer: Damian W. Betebenner <dbetebenner@nciea.org>
7777
Depends: R (>= 4.1.0)
7878
Suggests: SGPdata (>= 28.0-0), knitr, rmarkdown
79-
Imports: Cairo, callr, collapse, colorspace, crayon, datasets, data.table (>= 1.14.0), digest, doParallel, equate (>= 2.0-5), foreach, graphics, grid, grDevices, gridBase, iterators, gtools, jsonlite, matrixStats, methods, parallel, pkgsearch, quantreg, randomNames (>= 0.0-5), rngtools (>= 1.5), RSQLite, sn (>= 1.0-0), splines, stats, svglite, toOrdinal, utils
79+
Imports: Cairo, callr, collapse, colorspace, crayon, curl, datasets, data.table (>= 1.14.0), digest, doParallel, equate (>= 2.0-5), foreach, graphics, grid, grDevices, gridBase, iterators, gtools, jsonlite, matrixStats, methods, parallel, pkgsearch, quantreg, randomNames (>= 0.0-5), rngtools (>= 1.5), RSQLite, sn (>= 1.0-0), splines, stats, svglite, toOrdinal, utils
8080
Description: An analytic framework for the calculation of norm- and criterion-referenced academic growth estimates using large scale, longitudinal education assessment data as developed in Betebenner (2009) <doi:10.1111/j.1745-3992.2009.00161.x>.
8181
SystemRequirements: (PDF)LaTeX (https://www.latex-project.org/) with 'pdfpages' package for studentGrowthPlot option in visualizeSGP to bind together student growth plots into school catalogs
8282
URL: https://sgp.io, https://github.com/CenterForAssessment/SGP, https://CRAN.R-project.org/package=SGP

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ importFrom(callr,r_bg)
3838
importFrom(collapse, add_stub, add_vars, collapv, ffirst, fmean, fmedian, fnrow, fsd, ftransform, ftransformv, fvar, get_vars, join, na_omit, pivot, .quantile, replace_outliers, roworderv, rm_stub)
3939
importFrom(colorspace,rainbow_hcl,diverge_hcl)
4040
importFrom(crayon,bold,cyan,green,magenta,red,yellow)
41+
importFrom(curl,curl_fetch_memory,new_handle)
4142
importFrom(digest,digest)
4243
importFrom(doParallel,registerDoParallel)
4344
importFrom(equate,freqtab,equate)

R/getAchievementLevel.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function(sgp_data,
4646
} else {
4747
return("Achievement_Levels")
4848
}
49-
}
49+
} ### END get.achievement_level.label Function
5050

5151
getAchievementLevel_INTERNAL <- function(state, content_area, year, grade, scale_score) {
5252
if (!is.null(SGP::SGPstateData[[state]][["Achievement"]][["Cutscores"]][[get.cutscore.label(state, year, content_area)]][[paste0("GRADE_", grade)]])) {
@@ -64,7 +64,7 @@ function(sgp_data,
6464
} else {
6565
rep(as.character(NA), length(scale_score))
6666
}
67-
}
67+
} ### END getAchievementLevel_INTERNAL Function
6868

6969
if ("STATE" %in% names(sgp_data) & !is.null(SGP::SGPstateData[[state]][["Achievement"]][["Cutscore_Information"]])) {
7070
cutscore.states <- SGP::SGPstateData[[state]][["Achievement"]][["Cutscore_Information"]][["Cutscore_States"]]

R/rliCutscoreCreation.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ function(rli.cs.long,
5656

5757

5858
### cutscore.list creation.
59-
6059
for (state in unique(rli.cs$STATE)) {
6160

6261
for (ca in content_areas) {

R/zzz.R

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,41 @@ function(libname, pkgname) {
77

88
`.onAttach` <- function(libname, pkgname) {
99
if (interactive()) {
10-
# Utility function
11-
get_dev_version <- function(package) {
10+
# Utility function with timeout
11+
get_dev_version <- function(package, timeout = 2) {
1212
url <- paste0("https://raw.githubusercontent.com/CenterForAssessment/", package, "/refs/heads/master/DESCRIPTION")
1313
tryCatch({
14-
lines <- readLines(url, warn = FALSE)
15-
version_line <- grep("^Version:", lines, value = TRUE)
16-
if (length(version_line) > 0) {
17-
return(cyan("v", strsplit(version_line, ": ")[[1]][2], sep=""))
18-
} else {
19-
return(red("Not Available"))
14+
# Use curl with timeout
15+
response <- curl::curl_fetch_memory(url, handle = curl::new_handle(timeout = timeout))
16+
if (response$status_code == 200) {
17+
lines <- strsplit(rawToChar(response$content), "\n")[[1]]
18+
version_line <- grep("^Version:", lines, value = TRUE)
19+
if (length(version_line) > 0) {
20+
return(cyan("v", strsplit(version_line, ": ")[[1]][2], sep=""))
21+
}
2022
}
23+
return(red("Not Available"))
2124
}, error = function(e) {
2225
return(red("Not Available"))
2326
}, warning = function(w) {
2427
return(red("Not Available"))
2528
})
2629
}
2730

28-
# Extract version information
31+
# Extract version information with timeout
2932
installed.version <- utils::packageDescription("SGP")[['Version']]
30-
cran.version <- tryCatch(
31-
green("v", pkgsearch::cran_package("SGP")[['Version']], sep=""),
32-
error = function(e) red("Not Available"),
33-
warning = function(w) red("Not Available"))
33+
cran.version <- tryCatch({
34+
# Add timeout to CRAN check
35+
curl::curl_fetch_memory("https://cran.r-project.org/web/packages/SGP/index.html",
36+
handle = curl::new_handle(timeout = 2))
37+
green("v", pkgsearch::cran_package("SGP")[['Version']], sep="")
38+
}, error = function(e) red("Not Available"),
39+
warning = function(w) red("Not Available"))
3440
dev.version <- get_dev_version("SGP")
3541

3642
# Define a friendly startup message
3743
message_text <- paste0(
38-
magenta(bold("\uD83C\uDF89 SGP v", installed.version, sep="")), " - ", toOrdinal::toOrdinalDate("2025-4-14"), "\n",
44+
magenta(bold("\uD83C\uDF89 SGP v", installed.version, sep="")), " - ", toOrdinal::toOrdinalDate("2025-4-24"), "\n",
3945
strrep("\u2501", 40), "\n",
4046
bold("\U1F4E6 CRAN: "), cran.version, "\n",
4147
bold("\U1F527 Dev: "), dev.version, "\n",

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SGP
55
[![R-CMD-check](https://github.com/CenterForAssessment/SGP/workflows/R-CMD-check/badge.svg)](https://github.com/CenterForAssessment/SGP/actions)
66
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/centerforassessment/SGP?branch=master&svg=true)](https://ci.appveyor.com/project/centerforassessment/SGP)
77
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/SGP)](https://cran.r-project.org/package=SGP)
8-
[![Development Version](https://img.shields.io/badge/devel-2.2--1.98-brightgreen.svg)](https://github.com/CenterForAssessment/SGP)
8+
[![Development Version](https://img.shields.io/badge/devel-2.2--1.99-brightgreen.svg)](https://github.com/CenterForAssessment/SGP)
99
[![Rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/grand-total/SGP)](https://github.com/metacran/cranlogs.app)
1010
[![License](https://img.shields.io/badge/license-GPL%203-brightgreen.svg?style=flat)](https://github.com/CenterForAssessment/SGP/blob/master/LICENSE.md)
1111
[![Join the chat at https://gitter.im/CenterForAssessment/SGP](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/CenterForAssessment/SGP?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

inst/CITATION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ bibentry(
99
person(given = c("Yi"), family = "Shang")
1010
),
1111
year = "2025",
12-
note = "R package version 2.2-1.98",
12+
note = "R package version 2.2-1.99",
1313
url = "https://sgp.io",
1414
textVersion = paste(
1515
"Damian W. Betebenner, Adam R. Van Iwaarden, Benjamin Domingue and Yi Shang (2025).",
1616
"SGP: Student Growth Percentiles & Percentile Growth Trajectories.",
17-
"(R package version 2.2-1.98)",
17+
"(R package version 2.2-1.99)",
1818
"URL: https://sgp.io"
1919
)
2020
)

man/SGP-package.Rd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ growth projections to be calculated across assessment transitions by equating th
1919
\tabular{ll}{
2020
Package: \tab SGP\cr
2121
Type: \tab Package\cr
22-
Version: \tab 2.2-1.98\cr
23-
Date: \tab 2025-4-14\cr
22+
Version: \tab 2.2-1.99\cr
23+
Date: \tab 2025-4-15\cr
2424
License: \tab GPL-3\cr
2525
LazyLoad: \tab yes\cr
2626
}

0 commit comments

Comments
 (0)