Skip to content

Commit

Permalink
added vignettebuilder specs + allowed mepty param lists
Browse files Browse the repository at this point in the history
  • Loading branch information
bart6114 committed Aug 30, 2016
1 parent 1a54a8b commit 0c6179d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
11 changes: 8 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
Package: infuser
Type: Package
Title: A Very Basic Templating Engine
Version: 0.2.3
Date: 2016-04-06
Version: 0.2.4
Date: 2016-08-30
Author: Bart Smeets
Maintainer: Bart Smeets <bartsmeets86@gmail.com>
Description: Replace parameters in strings and/or text files with specified
values.
License: MIT + file LICENSE
LazyData: TRUE
Suggests:
testthat
testthat,
knitr,
rmarkdown,
dplyr,
magrittr
URL: https://github.com/bart6114/infuser/
BugReports: https://github.com/bart6114/infuser/issues
RoxygenNote: 5.0.1
VignetteBuilder: knitr
3 changes: 3 additions & 0 deletions R/core.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ infuse <- function(file_or_string, ..., variable_identifier = getOption("variabl

params_supplied <- list(...)

## no params supplied, return unaltered template
if(length(params_supplied)==0) return(template)

## if a list or environment is passed as the first argument, only process this
if("key_value_list" %in% names(params_supplied)) warning("specification of key_value_list no longer required; simply pass the list/environment as the first parameter")

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,23 @@ Simply create a new issue at this GitHub repository.
Changes
-------

### v.0.2.4
- allows passing of empty parameter lists

### v.0.2.3
- alligned with new `testthat` specs

### v.0.2.2

- dropped `key_value_list` parameter (will be
interpreted automatically)
- fixed passing of the `variable_identifier`
- ability to make `variable_identifier` persistent

### v.0.2.3

- added support for empty param list

### v.0.2.1

- fixed: incorrect replacement of parameters with same prefix
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test_core_functionality.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,7 @@ test_that("variable identifiers are correctly used when set as an option",{
expect_equivalent(
infuse("${test}", test = "123", simple_character=TRUE), "123")
})

test_that("empty param list is accepted",{
expect_equivalent(infuse(sql), sql)
})
2 changes: 1 addition & 1 deletion vignettes/getting_started.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ my_transform_function<-function(v){
infuse(sql, name = name, transform_function = my_transform_function)
```

Of course you can also use functions from other packages. Specifically for SQL I advise you to take a look at the ```dplyr::build_sql``` function.
Of course you can also use functions from other packages. Specifically for SQL I advise you to take a look at the `dplyr::build_sql` function.


```{r}
Expand Down

0 comments on commit 0c6179d

Please sign in to comment.