Skip to content

Commit

Permalink
Merge pull request #41 from swirldev/dev
Browse files Browse the repository at this point in the history
fix errors on CRAN
  • Loading branch information
seankross authored Feb 7, 2018
2 parents 7a04c1b + 18b6796 commit beeec41
Show file tree
Hide file tree
Showing 46 changed files with 222 additions and 73 deletions.
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
language: R
language: r

matrix:
include:
- r: release
- r: oldrel
- r: devel

cache: packages
sudo: false

Expand Down
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Title: A Toolbox for Writing 'swirl' Courses
Description: A set of tools for writing and sharing interactive courses
to be used with swirl.
URL: http://swirlstats.com
Version: 0.5.0
Version: 0.5.2
License: MIT + file LICENSE
Authors@R: c(
person("Sean", "Kross", , "[email protected]", c("aut", "cre")),
Expand All @@ -21,10 +21,11 @@ Imports:
whisker,
shiny,
shinyAce,
base64enc
base64enc,
readr
Encoding: UTF-8
Roxygen: list(wrap = FALSE)
Suggests:
testthat,
digest
RoxygenNote: 5.0.1
RoxygenNote: 6.0.1
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2016
YEAR: 2018
COPYRIGHT HOLDER: Team swirl
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ export(find_questions)
export(get_current_lesson)
export(google_form_decode)
export(lesson_to_html)
export(make_pathname)
export(new_lesson)
export(pack_course)
export(set_lesson)
export(swirl_courses_dir)
export(swirlify)
export(test_course)
export(test_lesson)
Expand All @@ -28,6 +30,7 @@ import(shiny)
import(shinyAce)
import(swirl)
importFrom(base64enc,base64decode)
importFrom(readr,read_csv)
importFrom(rmarkdown,render)
importFrom(stringr,str_detect)
importFrom(stringr,str_split)
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# swirlify 0.5.2

* Fixed failing tests by integrating new features in testthat 2.0.

# swirlify 0.5.1

* Fixed issue where Ace editor was not working on Windows.

* Added `make_pathname()`.

* Added `swirl_courses_dir()`.

# swirlify 0.5.0

* Removed `lp()`.
Expand Down
18 changes: 11 additions & 7 deletions R/google_form_decode.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#' Google Sheets which contains student's encoded responses.
#' @return A data frame containing each student's results.
#' @importFrom base64enc base64decode
#' @importFrom readr read_csv
#' @export
#' @examples
#' \dontrun{
Expand All @@ -16,16 +17,19 @@
#'
#' }
google_form_decode <- function(path = file.choose()){
encoded <- suppressWarnings(read.csv(path, header = TRUE, stringsAsFactors = FALSE))
encoded <- suppressMessages(suppressWarnings(read_csv(path)))
decoded <- list()

for(i in 1:nrow(encoded)){
temp_write <- tempfile()
writeChar(encoded[i,2], temp_write)
temp_log <- tempfile()
base64decode(file = temp_write, output = temp_log)
decoded[[i]] <- read.csv(temp_log, header = TRUE, stringsAsFactors = FALSE)
decoded[[i]] <- suppressMessages(
read_csv(
rawToChar(
base64decode(
as.character(encoded[i,2])))))
}

do.call("rbind", decoded)
result <- as.data.frame(do.call("rbind", decoded))
attributes(result)$spec <- NULL
attributes(result)$row.names <- 1:nrow(result)
result
}
2 changes: 1 addition & 1 deletion R/swirlify.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ make_skeleton <- function() {
return(lessonPath)
}

#' Lauch a Shiny application for writing swirl lessons
#' Launch a Shiny application for writing swirl lessons
#'
#' This function launches a user interface for writing
#' swirl lessons.
Expand Down
32 changes: 32 additions & 0 deletions R/tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,35 @@ ensure_file_ends_with_newline <- function(path){
cat("\n", file = path, append = TRUE)
}
}

#' Find the directory where swirl courses are stored
#'
#' @export
#' @return A string with the path to where swirl is searching for courses.
swirl_courses_dir <- function(){
scd <- getOption("swirl_courses_dir")
if (is.null(scd)) {
file.path(find.package("swirl"), "Courses")
}
else {
scd
}
}

#' Replace spaces in strings with underscores
#'
#' Useful for creating paths to a particular swirl course, as you might want
#' to do in files like \code{initLesson.R}.
#' @importFrom stringr str_trim
#' @param name A vector of strings.
#' @export
#' @return A string vector where spaces are replaced with underscores.
#' @examples
#' make_pathname("Developing Data Products")
#' # "Developing_Data_Products"
#'
#' make_pathname(c("R Programming", "Exploratory Data Analysis"))
#' # "R_Programming" "Exploratory_Data_Analysis"
make_pathname <- function(name){
gsub(" ", "_", str_trim(name))
}
2 changes: 1 addition & 1 deletion R/wq.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ wq_video <- function(output = "Would you like to watch a short video about ___?"
#' @param output Text that is displayed to the user.
#' @param figure An R script that produces a figure that is displayed in the R
#' plotting window.
#' @param figure_type Either \code{"new"} or \code{"add"}. \code{"new"} idicates
#' @param figure_type Either \code{"new"} or \code{"add"}. \code{"new"} indicates
#' that a new plot should be displayed, while \code{"add"} indicates that
#' features are being added to a plot that is already displayed.
#' @importFrom whisker whisker.render
Expand Down
8 changes: 4 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Release summary

This is the first attempted CRAN release of swirlify 0.5.0.
This is the first attempted CRAN release of swirlify 0.5.2.

## Test environments

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

## R CMD check results

Expand Down
8 changes: 4 additions & 4 deletions inst/swirlify-app/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ shinyServer(function(input, output, session) {
observeEvent(input$save, {
cat(input$ace, file = getOption("swirlify_lesson_file_path"))
updateAceEditor(session, "ace",
value = readChar(getOption("swirlify_lesson_file_path"),
file.info(getOption("swirlify_lesson_file_path"))$size)
value = gsub("\r", "", readChar(getOption("swirlify_lesson_file_path"),
file.info(getOption("swirlify_lesson_file_path"))$size))
)
})

Expand Down Expand Up @@ -54,8 +54,8 @@ shinyServer(function(input, output, session) {
}

updateAceEditor(session, "ace",
value = readChar(getOption("swirlify_lesson_file_path"),
file.info(getOption("swirlify_lesson_file_path"))$size))
value = gsub("\r", "", readChar(getOption("swirlify_lesson_file_path"),
file.info(getOption("swirlify_lesson_file_path"))$size)))
})

observeEvent(input$selectnone, {
Expand Down
4 changes: 2 additions & 2 deletions inst/swirlify-app/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ shinyUI(navbarPage("swirlify 0.5",
actionButton("add", "Add Question")
),
column(6,
aceEditor("ace", value = readChar(getOption("swirlify_lesson_file_path"),
file.info(getOption("swirlify_lesson_file_path"))$size), mode = "yaml",
aceEditor("ace", value = gsub("\r", "", readChar(getOption("swirlify_lesson_file_path"),
file.info(getOption("swirlify_lesson_file_path"))$size)), mode = "yaml",
debounce = 100),
actionButton("save", "Save Lesson"),
actionButton("demo", "Demo Lesson"),
Expand Down
4 changes: 4 additions & 0 deletions inst/test/correct_responses.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Timestamp,Submission
2016/06/06 11:21:49 AM AST,InVzZXIiLCJjb3Vyc2VfbmFtZSIsImxlc3Nvbl9uYW1lIiwicXVlc3Rpb25fbnVtYmVyIiwiY29ycmVjdCIsImF0dGVtcHQiLCJza2lwcGVkIiwiZGF0ZXRpbWUiCiJzZWFuIiwiR29vZ2xlIEZvcm1zIENvdXJzZSIsIkxlc3NvbiAxIiwyLFRSVUUsMSxGQUxTRSwxNDY1MjI2NDE5LjM5ODEzCiJzZWFuIiwiR29vZ2xlIEZvcm1zIENvdXJzZSIsIkxlc3NvbiAxIiwzLFRSVUUsMSxGQUxTRSwxNDY1MjI2NDIzLjAxMzg1CiJzZWFuIiwiR29vZ2xlIEZvcm1zIENvdXJzZSIsIkxlc3NvbiAxIiwyLFRSVUUsMSxGQUxT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zMjk5Cg==
2016/06/06 11:28:18 AM AST,InVzZXIiLCJjb3Vyc2VfbmFtZSIsImxlc3Nvbl9uYW1lIiwicXVlc3Rpb25fbnVtYmVyIiwiY29ycmVjdCIsImF0dGVtcHQiLCJza2lwcGVkIiwiZGF0ZXRpbWUiCiJzZWFuIiwiR29vZ2xlIEZvcm1zIENvdXJzZSIsIkxlc3NvbiAxIiwyLFRSVUUsMSxGQUxTRSwxNDY1MjI2NDE5LjM5ODEzCiJzZWFuIiwiR29vZ2xlIEZvcm1zIENvdXJzZSIsIkxlc3NvbiAxIiwzLFRSVUUsMSxGQUxTRSwxNDY1MjI2NDIzLjAxMzg1CiJzZWFuIiwiR29vZ2xlIEZvcm1zIENvdXJzZSIsIkxlc3NvbiAxIiwyLFRSVUUsMSxGQUxTRSwxNDY1MjI2ODM5LjYxNzIyCiJzZWFuIiwiR29vZ2xlIEZvcm1zIENvdXJzZSIsIkxlc3NvbiAxIiwzLFRSVUUsMSxGQUxTRSwxNDY1MjI2ODQ2LjAzMTcxCiJzZWFuIiwiR29vZ2xlIEZvcm1zIENvdXJzZSIsIkxlc3NvbiAxIiwyLFRSVUUsMSxGQUxTRSwxNDY1MjI2ODY3Ljg1MzQ3CiJzZWFuIiwiR29vZ2xlIEZvcm1zIENvdXJzZSIsIkxlc3NvbiAxIiwzLFRSVUUsMSxGQUxTRSwxNDY1MjI2ODk1LjkzMjk5Cg==
4 changes: 4 additions & 0 deletions inst/test/diacritics_greek_cyrillic.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Timestamp,Submission
2016/06/06 11:21:49 AM AST,InVzZXIiLCJjb3Vyc2VfbmFtZSIsImxlc3Nvbl9uYW1lIiwicXVlc3Rpb25fbnVtYmVyIiwiY29ycmVjdCIsImF0dGVtcHQiLCJza2lwcGVkIiwiZGF0ZXRpbWUiCiJTw6vDo8WEIMOHcm/DuMWhxbwiLCLOo8+EzrHPhM65z4PPhM65zrrOriIsItCS0LLQtdC00LXQvdC40LU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yCiJTw6vDo8WEIMOHcm/DuMWhxbwiLCLOo8+EzrHPhM65z4PPhM65zrrOriIsItCS0LLQtdC00LXQvdC40LUiLDMsVFJVRSwxLEZBTFNFLDE0NjUyMjY4NDYuMDMxNzEKIlPDq8OjxYQgw4dyb8O4xaHFvCIsIs6jz4TOsc+EzrnPg8+EzrnOus6uIiwi0JLQstC10LTQtdC90LjQtSIsMixUUlVFLDEsRkFMU0UsMTQ2NTIyNjg2Ny44NTM0NwoiU8Orw6PFhCDDh3Jvw7jFocW8IiwizqPPhM6xz4TOuc+Dz4TOuc66zq4iLCLQktCy0LXQtNC10L3QuNC1IiwzLFRSVUUsMSxGQUxTRSwxNDY1MjI2ODk1LjkzMjk5Cg==
4 changes: 0 additions & 4 deletions inst/test/responses.csv

This file was deleted.

1 change: 0 additions & 1 deletion man/add_license.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/add_to_manifest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/count_questions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/demo_lesson.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/find_questions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/get_current_lesson.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/google_form_decode.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/lesson_to_html.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions man/make_pathname.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/new_lesson.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/pack_course.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/set_lesson.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions man/swirl_courses_dir.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/swirlify.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/test_course.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/test_lesson.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/testit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/unpack_course.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/wq_command.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/wq_figure.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/wq_message.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/wq_multiple.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/wq_numerical.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit beeec41

Please sign in to comment.