Skip to content

Commit

Permalink
New functions os(), os.macos() and os.linux()
Browse files Browse the repository at this point in the history
  • Loading branch information
Arni Magnusson committed Jan 7, 2019
1 parent b4a9d2f commit de34b87
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 40 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export(makeAll)
export(makeTAF)
export(mkdir)
export(msg)
export(os)
export(os.linux)
export(os.macos)
export(os.unix)
export(os.windows)
export(plus)
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ o Added function process.bib() to read and process metadata.
o Added functions draft.data() and draft.software() to create initial draft
versions of metadata files.

o Added functions os(), os.linux() and os.macos() to detect more operating
systems than before. Removed os.unix().

o Updated colors (taf.green, taf.orange, taf.blue, taf.dark, taf.light) to make
them equally intense and easy to distinguish.

Expand Down
6 changes: 4 additions & 2 deletions R/icesTAF-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@
#' \emph{Administrative tools:}
#' \tabular{ll}{
#' \code{\link{deps}} \tab list dependencies\cr
#' \code{\link{os.unix}} \tab OS family\cr
#' \code{\link{os.windows}} \tab OS family
#' \code{\link{os}} \tab operating system\cr
#' \code{\link{os.linux}} \tab operating system\cr
#' \code{\link{os.macos}} \tab operating system\cr
#' \code{\link{os.windows}} \tab operating system
#' }
#'
#' @author Arni Magnusson and Colin Millar.
Expand Down
52 changes: 44 additions & 8 deletions R/os.R
Original file line number Diff line number Diff line change
@@ -1,32 +1,68 @@
#' OS Family
#' Operating System
#'
#' Determine whether operating system is Windows or Unix-compatible.
#' Determine operating system name.
#'
#' @return
#' \code{os} returns the name of the operating system, typically \code{"Linux"},
#' \code{"Darwin"}, or \code{"Windows"}.
#'
#' \code{os.linux}, \code{os.macos}, and \code{os.windows} return \code{TRUE} or
#' \code{FALSE}.
#'
#' @note
#' The macOS operating system identifies itself as \code{"Darwin"}.
#'
#' These shorthand functions can be useful when writing workaround solutions in
#' platform-independent scripts.
#'
#' @seealso
#' \code{\link{.Platform}} reports the \code{OS.type} family.
#' \code{\link{Sys.info}} is the underlying function used to extract the
#' operating system name.
#'
#' \code{\link{icesTAF-package}} gives an overview of the package.
#'
#' @examples
#' os.unix()
#' os()
#' os.linux()
#' os.macos()
#' os.windows()
#'
#' @aliases os.unix
#'
#' @export

os <- function()
{
Sys.info()[["sysname"]]
}

#' @rdname os
#'
#' @export

os.unix <- function()
os.linux <- function()
{
.Platform$OS.type == "unix"
os() == "Linux"
}

#' @rdname os.unix
#' @rdname os
#'
#' @export

os.macos <- function()
{
os() == "Darwin"
}

#' @rdname os
#'
#' @export

os.windows <- function()
{
.Platform$OS.type == "windows"
os() == "Windows"
}

#' @export

os.unix <- os.linux
6 changes: 4 additions & 2 deletions man/icesTAF-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions man/os.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 0 additions & 28 deletions man/os.unix.Rd

This file was deleted.

0 comments on commit de34b87

Please sign in to comment.