Skip to content

Commit beeec41

Browse files
authored
Merge pull request #41 from swirldev/dev
fix errors on CRAN
2 parents 7a04c1b + 18b6796 commit beeec41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+222
-73
lines changed

.travis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
language: R
1+
language: r
2+
3+
matrix:
4+
include:
5+
- r: release
6+
- r: oldrel
7+
- r: devel
8+
29
cache: packages
310
sudo: false
411

DESCRIPTION

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Title: A Toolbox for Writing 'swirl' Courses
33
Description: A set of tools for writing and sharing interactive courses
44
to be used with swirl.
55
URL: http://swirlstats.com
6-
Version: 0.5.0
6+
Version: 0.5.2
77
License: MIT + file LICENSE
88
Authors@R: c(
99
person("Sean", "Kross", , "sean@seankross.com", c("aut", "cre")),
@@ -21,10 +21,11 @@ Imports:
2121
whisker,
2222
shiny,
2323
shinyAce,
24-
base64enc
24+
base64enc,
25+
readr
2526
Encoding: UTF-8
2627
Roxygen: list(wrap = FALSE)
2728
Suggests:
2829
testthat,
2930
digest
30-
RoxygenNote: 5.0.1
31+
RoxygenNote: 6.0.1

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2016
1+
YEAR: 2018
22
COPYRIGHT HOLDER: Team swirl

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ export(find_questions)
88
export(get_current_lesson)
99
export(google_form_decode)
1010
export(lesson_to_html)
11+
export(make_pathname)
1112
export(new_lesson)
1213
export(pack_course)
1314
export(set_lesson)
15+
export(swirl_courses_dir)
1416
export(swirlify)
1517
export(test_course)
1618
export(test_lesson)
@@ -28,6 +30,7 @@ import(shiny)
2830
import(shinyAce)
2931
import(swirl)
3032
importFrom(base64enc,base64decode)
33+
importFrom(readr,read_csv)
3134
importFrom(rmarkdown,render)
3235
importFrom(stringr,str_detect)
3336
importFrom(stringr,str_split)

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# swirlify 0.5.2
2+
3+
* Fixed failing tests by integrating new features in testthat 2.0.
4+
5+
# swirlify 0.5.1
6+
7+
* Fixed issue where Ace editor was not working on Windows.
8+
9+
* Added `make_pathname()`.
10+
11+
* Added `swirl_courses_dir()`.
12+
113
# swirlify 0.5.0
214

315
* Removed `lp()`.

R/google_form_decode.R

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#' Google Sheets which contains student's encoded responses.
55
#' @return A data frame containing each student's results.
66
#' @importFrom base64enc base64decode
7+
#' @importFrom readr read_csv
78
#' @export
89
#' @examples
910
#' \dontrun{
@@ -16,16 +17,19 @@
1617
#'
1718
#' }
1819
google_form_decode <- function(path = file.choose()){
19-
encoded <- suppressWarnings(read.csv(path, header = TRUE, stringsAsFactors = FALSE))
20+
encoded <- suppressMessages(suppressWarnings(read_csv(path)))
2021
decoded <- list()
2122

2223
for(i in 1:nrow(encoded)){
23-
temp_write <- tempfile()
24-
writeChar(encoded[i,2], temp_write)
25-
temp_log <- tempfile()
26-
base64decode(file = temp_write, output = temp_log)
27-
decoded[[i]] <- read.csv(temp_log, header = TRUE, stringsAsFactors = FALSE)
24+
decoded[[i]] <- suppressMessages(
25+
read_csv(
26+
rawToChar(
27+
base64decode(
28+
as.character(encoded[i,2])))))
2829
}
2930

30-
do.call("rbind", decoded)
31+
result <- as.data.frame(do.call("rbind", decoded))
32+
attributes(result)$spec <- NULL
33+
attributes(result)$row.names <- 1:nrow(result)
34+
result
3135
}

R/swirlify.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ make_skeleton <- function() {
3535
return(lessonPath)
3636
}
3737

38-
#' Lauch a Shiny application for writing swirl lessons
38+
#' Launch a Shiny application for writing swirl lessons
3939
#'
4040
#' This function launches a user interface for writing
4141
#' swirl lessons.

R/tools.R

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,35 @@ ensure_file_ends_with_newline <- function(path){
158158
cat("\n", file = path, append = TRUE)
159159
}
160160
}
161+
162+
#' Find the directory where swirl courses are stored
163+
#'
164+
#' @export
165+
#' @return A string with the path to where swirl is searching for courses.
166+
swirl_courses_dir <- function(){
167+
scd <- getOption("swirl_courses_dir")
168+
if (is.null(scd)) {
169+
file.path(find.package("swirl"), "Courses")
170+
}
171+
else {
172+
scd
173+
}
174+
}
175+
176+
#' Replace spaces in strings with underscores
177+
#'
178+
#' Useful for creating paths to a particular swirl course, as you might want
179+
#' to do in files like \code{initLesson.R}.
180+
#' @importFrom stringr str_trim
181+
#' @param name A vector of strings.
182+
#' @export
183+
#' @return A string vector where spaces are replaced with underscores.
184+
#' @examples
185+
#' make_pathname("Developing Data Products")
186+
#' # "Developing_Data_Products"
187+
#'
188+
#' make_pathname(c("R Programming", "Exploratory Data Analysis"))
189+
#' # "R_Programming" "Exploratory_Data_Analysis"
190+
make_pathname <- function(name){
191+
gsub(" ", "_", str_trim(name))
192+
}

R/wq.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ wq_video <- function(output = "Would you like to watch a short video about ___?"
177177
#' @param output Text that is displayed to the user.
178178
#' @param figure An R script that produces a figure that is displayed in the R
179179
#' plotting window.
180-
#' @param figure_type Either \code{"new"} or \code{"add"}. \code{"new"} idicates
180+
#' @param figure_type Either \code{"new"} or \code{"add"}. \code{"new"} indicates
181181
#' that a new plot should be displayed, while \code{"add"} indicates that
182182
#' features are being added to a plot that is already displayed.
183183
#' @importFrom whisker whisker.render

cran-comments.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
## Release summary
22

3-
This is the first attempted CRAN release of swirlify 0.5.0.
3+
This is the first attempted CRAN release of swirlify 0.5.2.
44

55
## Test environments
66

7-
* local OSX Yosemite install, R 3.3.1
8-
* Ubuntu 12.04 (on travis-ci), R 3.3.1
9-
* win-builder (devel and release)
7+
* local macOS Sierra install, R 3.4.3
8+
* Ubuntu 14.04 (on travis-ci), R 3.4.2, R 3.3.3, R-devel.
9+
* win-builder (devel)
1010

1111
## R CMD check results
1212

0 commit comments

Comments
 (0)