~hrbrmstr/cloc

cloc/R/utils.R -rw-r--r-- 436 bytes
0350958fhrbrmstr Working on #10 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
setNames <- function(object = nm, nm)  {
  names(object) <- nm
  object
}

is_url <- function (path) { grepl("^(git|http|ftp)s?://", path) }

find_perl <- function() {

  perl <- Sys.which("perl")

  if (perl == "") {
    stop(
      "Cannot find 'perl'. cloc requires perl to be installed and on the PATH.",
      call. = FALSE
    )
  }

  return(perl)

}

is_rmd_file <- function(path) { grepl("\\.Rmd$", path, ignore.case = TRUE) }