From 67d4e7584d4f6ce682015c495cb9e20bc85a773c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 7 Nov 2013 11:34:45 +0100 Subject: [PATCH 1/5] enable Travis CI integration via craigcitro/r-travis - build vignettes for checking - install rst2pdf - warnings are errors --- .Rbuildignore | 1 + .travis.yml | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .travis.yml diff --git a/.Rbuildignore b/.Rbuildignore index a1320b1..d01c21f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1 +1,2 @@ README.rst +^\.travis\.yml$ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..bfa7a21 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +# Sample .travis.yml for R projects. +# +# See README.md for instructions, or for more configuration options, +# see the wiki: +# https://github.com/craigcitro/r-travis/wiki + +language: c +script: ./travis-tool.sh run_tests +env: + global: + - R_BUILD_ARGS="--no-manual" + - R_CHECK_ARGS="--no-manual --as-cran" + - WARNINGS_ARE_ERRORS=1 +before_install: + - curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh + - chmod 755 ./travis-tool.sh + - ./travis-tool.sh bootstrap + - ./travis-tool.sh install_aptget rst2pdf +install: + - ./travis-tool.sh install_deps +notifications: + email: + on_success: change + on_failure: change From 9669b4b727c2949cefa659fcfede38344af4ca34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 20 Nov 2013 21:58:28 +0100 Subject: [PATCH 2/5] add RStudio project --- .Rbuildignore | 2 ++ .gitignore | 2 ++ optparse.Rproj | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 optparse.Rproj diff --git a/.Rbuildignore b/.Rbuildignore index d01c21f..a456a60 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,2 +1,4 @@ README.rst ^\.travis\.yml$ +^.*\.Rproj$ +^\.Rproj\.user$ diff --git a/.gitignore b/.gitignore index a2d973e..65a33ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.swp *.timestamp *.rst +.Rproj.user +/.Rhistory diff --git a/optparse.Rproj b/optparse.Rproj new file mode 100644 index 0000000..c60274e --- /dev/null +++ b/optparse.Rproj @@ -0,0 +1,16 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: knitr +LaTeX: pdfLaTeX + +BuildType: Package +PackageInstallArgs: --no-multiarch From d0b37e48d3f6dff9ff6cb9508b52d1e47b70d470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 24 Nov 2013 11:01:10 +0100 Subject: [PATCH 3/5] indent with four spaces --- optparse.Rproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optparse.Rproj b/optparse.Rproj index c60274e..cf43990 100644 --- a/optparse.Rproj +++ b/optparse.Rproj @@ -6,7 +6,7 @@ AlwaysSaveHistory: Default EnableCodeIndexing: Yes UseSpacesForTab: Yes -NumSpacesForTab: 2 +NumSpacesForTab: 4 Encoding: UTF-8 RnwWeave: knitr From 28b07a0411d2c93f94f001485059049f5e5154b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 24 Nov 2013 09:55:49 +0100 Subject: [PATCH 4/5] call stop instead of quit --- R/optparse.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/optparse.R b/R/optparse.R index 28149c7..5fdbfbf 100644 --- a/R/optparse.R +++ b/R/optparse.R @@ -400,7 +400,7 @@ parse_args <- function(object, args = commandArgs(trailingOnly = TRUE), } if(options_list[["help"]] & print_help_and_exit) { print_help(object) - quit(status=1) + stop("help requested") } if(positional_arguments) { return(list(options = options_list, args = arguments_positional)) From 133005b8446fcbb9da02ec470b23fd8173e6388c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 24 Nov 2013 10:00:25 +0100 Subject: [PATCH 5/5] check that --help throws error --- inst/tests/test-optparse.R | 1 + 1 file changed, 1 insertion(+) diff --git a/inst/tests/test-optparse.R b/inst/tests/test-optparse.R index 26d5e06..cfedbfa 100644 --- a/inst/tests/test-optparse.R +++ b/inst/tests/test-optparse.R @@ -72,6 +72,7 @@ test_that("parse_args works as expected", { sort_list(list(options = list(add_numbers = FALSE, help = FALSE), args = c("-add_numbers", "example.txt")))) expect_that(parse_args(parser, args = c("-add_numbers", "example.txt")), throws_error()) + expect_that(parse_args(parser, args = c("--help")), throws_error()) }) # Bug found by Miroslav Posta test_that("test using numeric instead of double", {