Skip to content

Commit de00933

Browse files
authored
Merge pull request #37 from psolymos/master
2 parents 4f330ff + c9ad839 commit de00933

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

R/dockerignore.R

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
#' docker_ignore_add()
1515
#' }
1616
docker_ignore_add <- function(path) {
17-
path <- fs::path(
17+
path_di <- fs::path(
1818
path,
1919
".dockerignore"
2020
)
2121

2222
if (!fs::file_exists(
23-
path
23+
path_di
2424
)) {
25-
fs::file_create(path)
25+
fs::file_create(path_di)
2626

2727
write_ignore <- function(content) {
28-
write(content, path, append = TRUE)
28+
write(content, path_di, append = TRUE)
2929
}
3030

3131
for (i in c(
@@ -39,6 +39,24 @@ docker_ignore_add <- function(path) {
3939
)) {
4040
write_ignore(i)
4141
}
42+
43+
path_ri <- fs::path(
44+
path,
45+
".Rbuildignore"
46+
)
47+
if (fs::file_exists(
48+
path_ri
49+
)) {
50+
write(
51+
"^\\.dockerignore$",
52+
path_ri,
53+
append = TRUE)
54+
cat_bullet(
55+
".dockerignore added to the .Rbuildignore file.",
56+
bullet = "info",
57+
bullet_col = "green"
58+
)
59+
}
4260
} else {
4361
cat_bullet(
4462
".dockerignore already present, skipping its creation.",
@@ -47,5 +65,5 @@ docker_ignore_add <- function(path) {
4765
)
4866
}
4967

50-
return(invisible(path))
68+
return(invisible(path_di))
5169
}

0 commit comments

Comments
 (0)