Skip to content

Commit

Permalink
Merge pull request #7 from r-lib/f-git-ignore
Browse files Browse the repository at this point in the history
Export use_git_ignore()
  • Loading branch information
hadley authored Aug 9, 2017
2 parents c8633f9 + 0f39418 commit f46cdf4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export(use_description)
export(use_dev_version)
export(use_git)
export(use_git_hook)
export(use_git_ignore)
export(use_github)
export(use_github_links)
export(use_gpl3_license)
Expand Down
4 changes: 2 additions & 2 deletions R/documentation.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use_package_doc <- function(base_path = ".") {
name <- project_name(base_path)

use_template(
"packagename-package.r",
file.path("R", paste0(name, "-package.r")),
"packagename-package.R",
file.path("R", paste0(name, "-package.R")),
data = list(name = name),
base_path = base_path
)
Expand Down
1 change: 1 addition & 0 deletions R/git.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ use_git_hook <- function(hook, script, base_path = ".") {
#' @param directory Directory within \code{base_path} to set ignores
#' @inheritParams use_template
#' @family git helpers
#' @export
use_git_ignore <- function(ignores, directory = ".", base_path = ".") {
path <- file.path(base_path, directory, ".gitignore")
write_union(path, ignores)
Expand Down
2 changes: 2 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ write_union <- function(path, new_lines, quiet = FALSE) {
write_over <- function(contents, path) {
stopifnot(is.character(contents), length(contents) == 1)

dir.create(dirname(path), showWarnings = FALSE)

if (same_contents(path, contents))
return(FALSE)

Expand Down
File renamed without changes.

0 comments on commit f46cdf4

Please sign in to comment.