Skip to content

Commit 05d9e95

Browse files
authored
Merge pull request #76 from KWB-R/dev
Dev
2 parents 80e3ac2 + 3e13f21 commit 05d9e95

15 files changed

Lines changed: 101 additions & 45 deletions

.travis.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
##############################################################################
2-
### Autogenerated with R package kwb.pkgbuild v0.0.0.9000
3-
### (installed from 'local' source code on 2019-06-17)
4-
### by calling the function kwb.pkgbuild::use_travis()
5-
### (file created at: 2019-06-17 13:25:13)
6-
##############################################################################
1+
################################################################################
2+
### generated-with:
3+
### type: R-package
4+
### name: kwb.pkgbuild
5+
### version: 0.1.5
6+
### installed-from: Github (kwb-r/kwb.pkgbuild@d34caef)
7+
### installed-on: '2020-10-09'
8+
### generated-by:
9+
### user: mrustl
10+
### function-call: kwb.pkgbuild::use_travis()
11+
### generated-on: 2020-10-09 08:24:34
12+
################################################################################
713

814

915
language: r
16+
pandoc_version: 2.7.3
1017
sudo: required
18+
addons:
19+
apt:
20+
packages:
21+
- libharfbuzz-dev
22+
- libfribidi-dev
1123
cache: packages
1224
r_packages:
1325
- remotes
@@ -26,6 +38,7 @@ matrix:
2638
skip_cleanup: 'true'
2739
on:
2840
branch:
41+
- main
2942
- master
3043
- dev
3144
- r: oldrel

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: kwb.pkgbuild
22
Title: R package for standardised development at KWB
3-
Version: 0.1.4
3+
Version: 0.1.5
44
Authors@R:
55
c(person(given = "Michael",
66
family = "Rustler",

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# [kwb.pkgbuild 0.1.6](https://github.com/KWB-R/kwb.pkgbuild/releases/tag/v0.1.6) <small>2020-10-09</small>
2+
3+
* Update default GitHub branch to `main` since 2020-10-01 (see: [Article](https://www.zdnet.com/article/github-to-replace-master-with-main-starting-next-month/))
4+
5+
* `add_creation_metadata`: write creation metadata in yaml format as default
6+
7+
* travis.yml template: add dependencies required for pkgdown (>= 1.6.1) installation
8+
9+
# [kwb.pkgbuild 0.1.5](https://github.com/KWB-R/kwb.pkgbuild/releases/tag/v0.1.5) <small>2020-06-25</small>
10+
11+
* Update Travis-CI badges after migrating KWB-R build from travis-ci.org to .com (#72)
12+
113
# [kwb.pkgbuild 0.1.4](https://github.com/KWB-R/kwb.pkgbuild/releases/tag/v0.1.4) <small>2020-06-23</small>
214

315
* Fix use_travis_deploy() to correctly generate key for using pkgdown on Travis to deploy to gh-pages (#70)

R/create_empty_branch.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ create_empty_branch <- function(
8282
sprintf('"%s" rm -rf .', git_exe),
8383
sprintf('"%s" commit --allow-empty -m "Initial gh-pages commit"', git_exe),
8484
sprintf('"%s" push origin %s', git_exe, branch),
85-
sprintf('"%s" checkout master', git_exe)
85+
sprintf('"%s" checkout main', git_exe)
8686
)
8787

8888
if (set_githubuser) cmd <- c(

R/grammars.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ grammars <- list(
55
url = "[![<title>](<src>)](<href>)",
66
src = "<address>/<path_1><params>",
77
href = "<address>/<path_2>",
8-
branch = "master"
8+
branch = "main"
99
),
1010
appveyor = list(
1111
title = "Appveyor build Status",
@@ -16,7 +16,7 @@ grammars <- list(
1616
),
1717
travis = list(
1818
title = "Travis build Status",
19-
address = "https://travis-ci.org",
19+
address = "https://travis-ci.com",
2020
path_1 = "<path_2>.svg?branch=<branch>",
2121
path_2 = "<user>/<pkgname>",
2222
params = ""

R/helper.R

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -203,41 +203,67 @@ write_git_batch_and_execute <- function(
203203
})
204204
}
205205

206-
207-
208206
# add_creation_metadata --------------------------------------------------
209207

210208
#' @noRd
211209
#' @keywords internal
212210
#' @importFrom sessioninfo package_info
213-
add_creation_metadata <- function()
211+
add_creation_metadata <- function(as_yaml = TRUE, line_sep = "\n")
214212
{
215-
calling_function_name <- deparse(sys.calls()[[1]])
213+
function_call <- deparse(sys.calls()[[1L]])
216214

217215
package_name <- "kwb.pkgbuild"
218216

219-
meta_creation <- sessioninfo::package_info(package_name)
217+
metadata <- sessioninfo::package_info(package_name)
220218

221-
meta_creation <- meta_creation[meta_creation$package == package_name, ]
219+
metadata <- metadata[metadata$package == package_name, ]
222220

223-
fmt <- paste(collapse = "\n", c(
224-
"##############################################################################",
225-
"### Autogenerated with R package %s v%s",
226-
"### (installed from '%s' source code on %s)",
227-
"### by calling the function %s",
228-
"### (file created at: %s)",
229-
"##############################################################################",
230-
"",
231-
""))
221+
comment_block <- function(x) {
222+
separator_line <- kwb.utils::repeated("#", 80L)
223+
paste(collapse = line_sep, c(
224+
separator_line,
225+
paste("###", x),
226+
separator_line,
227+
"",
228+
""
229+
))
230+
}
232231

233-
sprintf(fmt,
234-
meta_creation$package,
235-
meta_creation$ondiskversion,
236-
meta_creation$source,
237-
meta_creation$date,
238-
calling_function_name,
239-
Sys.time()
240-
)
232+
if (as_yaml) {
233+
234+
info <- list(
235+
"generated-with" = list(
236+
type = "R-package",
237+
name = metadata$package,
238+
version = metadata$ondiskversion,
239+
"installed-from" = metadata$source,
240+
"installed-on" = metadata$date
241+
),
242+
"generated-by" = list(
243+
user = kwb.utils::user(),
244+
"function-call" = function_call
245+
),
246+
"generated-on" = as.character(Sys.time())
247+
)
241248

249+
return(comment_block(
250+
# Create yaml text and split it into separate lines
251+
strsplit(yaml::as.yaml(info, line.sep = line_sep), line_sep)[[1L]]
252+
))
253+
}
242254

255+
sprintf(
256+
comment_block(c(
257+
"Generated with R package %s v%s",
258+
"(installed from '%s' source code on %s)",
259+
"by calling %s",
260+
"(file created on: %s)"
261+
)),
262+
metadata$package,
263+
metadata$ondiskversion,
264+
metadata$source,
265+
metadata$date,
266+
paste(function_call, collapse = paste0(line_sep, "###")),
267+
Sys.time()
268+
)
243269
}

R/use_appveyor.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# read_gitlab_ci_template ------------------------------------------------------
1+
# ci_appveyor_template ---------------------------------------------------------
22

33
#' @keywords internal
44
#' @noRd
@@ -7,7 +7,6 @@ ci_appveyor_template <- function()
77
read_template("ci_appveyor.yml")
88
}
99

10-
1110
# write_ci_appveyor ------------------------------------------------------------
1211

1312
#' @keywords internal
@@ -26,9 +25,6 @@ write_ci_appveyor <- function(yml_vector, dest_dir = getwd(), ignore)
2625
}
2726
}
2827

29-
30-
31-
3228
# use_appveyor ----------------------------------------------------------------
3329

3430
# use_appveyor with KWB default style
@@ -40,7 +36,7 @@ write_ci_appveyor <- function(yml_vector, dest_dir = getwd(), ignore)
4036
#' @export
4137
#'
4238
use_appveyor <- function(
43-
dest_dir = getwd(), yml_vector = ci_appveyor_template()
39+
dest_dir = getwd(), yml_vector = ci_appveyor_template()
4440
)
4541
{
4642
write_ci_appveyor(yml_vector, dest_dir = dest_dir, ignore = TRUE)

R/use_autopkgdown.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ use_autopkgdown <- function(
3838
...
3939
)
4040

41-
# Create .gitlab-ci.yml for "master" branch with "docs" folder
41+
# Create .gitlab-ci.yml for "main" branch with "docs" folder
4242
use_gitlab_ci_docs(dest_dir = file.path(dest_dir, repo))
4343

4444
# Update .travis.yml
4545
use_travis(auto_build_pkgdown = TRUE, dbg)
4646

47-
# Delete .gitlab-ci.yml (if existing in "master" branch)
47+
# Delete .gitlab-ci.yml (if existing in "main" branch)
4848
fs::file_delete(".gitlab-ci.yml")
4949

50-
# Delete "docs" folder (if existing in "master" branch)
50+
# Delete "docs" folder (if existing in "main" branch)
5151
#fs::dir_delete(path = "docs")
5252
}
5353

R/use_pkg.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use_pkg <- function(
7070
} else {
7171
# Create .travis.yml
7272
use_travis()
73-
# Create .gitlab-ci.yml for "master" branch with "docs" folder
73+
# Create .gitlab-ci.yml for "main" branch with "docs" folder
7474
fs::dir_create("docs")
7575
use_gitlab_ci_docs()
7676
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![Appveyor build Status](https://ci.appveyor.com/api/projects/status/github/KWB-R/kwb.pkgbuild?branch=master&svg=true)](https://ci.appveyor.com/project/KWB-R/kwb-pkgbuild/branch/master)
2-
[![Travis build Status](https://travis-ci.org/KWB-R/kwb.pkgbuild.svg?branch=master)](https://travis-ci.org/KWB-R/kwb.pkgbuild)
2+
[![Travis build Status](https://travis-ci.com/KWB-R/kwb.pkgbuild.svg?branch=master)](https://travis-ci.com/KWB-R/kwb.pkgbuild)
33
[![codecov](https://codecov.io/github/KWB-R/kwb.pkgbuild/branch/master/graphs/badge.svg)](https://codecov.io/github/KWB-R/kwb.pkgbuild)
44
[![Project Status](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
55
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/kwb.pkgbuild)]()

0 commit comments

Comments
 (0)