pkgKitten/0000755000176200001440000000000013553575372012231 5ustar liggesuserspkgKitten/NAMESPACE0000644000176200001440000000021313012074042013416 0ustar liggesusersexport(kitten, playWithPerPackageHelpPage) #importFrom(whoami, "fullname", "email_address") importFrom("utils", "package.skeleton") pkgKitten/demo/0000755000176200001440000000000012346602363013143 5ustar liggesuserspkgKitten/demo/simpleDemo.R0000644000176200001440000000074012346602363015365 0ustar liggesusers library(pkgKitten) setwd(tempdir()) # which gets deleted anyway kitten("simpleTest") # unfortunately testing fails :-/ R <- shQuote(file.path(R.home(component="bin"), "R")) Sys.setenv("R_TESTS"="") # needed for R CMD check; thanks for the tip, Hadley Sys.setenv("R_LIBS"=paste(.libPaths(), collapse=.Platform$path.sep)) system(paste(R, "CMD build simpleTest")) system(paste(R, "CMD check simpleTest_1.0.tar.gz")) pkgKitten/demo/00Index0000644000176200001440000000005112346561473014277 0ustar liggesuserssimpleDemo Simple demo of using kitten() pkgKitten/ChangeLog0000644000176200001440000000600113552322576013773 0ustar liggesusers2019-10-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version 2019-10-17 Andrew Coleman <30481896+aecoleman@users.noreply.github.com> * R/pkgKitten.R: Correct typo * man/playWithPerPackageHelpPage.Rd: Ditto 2019-03-24 Dirk Eddelbuettel * README.md: Add dependency badge 2018-11-15 helix123 * NEWS.Rd: Correct several typos 2017-10-14 Dirk Eddelbuettel * inst/replacements/manual-page-stub.Rd: Shorter and simpler due to more extensive use of Rd macros feeding data from DESCRIPTION 2017-10-13 Dirk Eddelbuettel * R/pkgKitten.R (kitten): Copy in .Rbuildignore if none present * inst/skel/dot.Rbuildignore: Added 2017-10-12 Dirk Eddelbuettel * R/pkgKitten.R (kitten): Copy in .gitignore if none present * inst/skel/R.gitignore: Added, courtesy of github/gitignore repo 2017-08-26 Dirk Eddelbuettel * .travis.yml: Update to using new.sh from r-travis 2016-11-13 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Release 0.1.4 * README.md: Canonical URL, added Installation note, minor edits 2016-11-12 Dirk Eddelbuettel * inst/replacements/manual-page-stub.Rd: Updated making use of the various macros defined in ${RHOME}/share/Rd/macros/system.Rd and described Section 2.13 of Writing R Extensions * NAMESPACE: Added explicit import for package.skeleton 2015-06-13 Dirk Eddelbuettel * DESCRIPTION: Version 0.1.3 2015-06-11 Dirk Eddelbuettel * DESCRIPTION (Suggests): Versioned Suggests: on whomai (>= 1.1.0) * R/pkgKitten.R (kitten): Use default value with email and name gathering functions (now offered by whoami 1.1.0 or later) 2015-06-09 Dirk Eddelbuettel * R/pkgKitten.R (kitten): Use email and name gathering functions from package 'whoami' (if available) in case email and name were not given; also rewrite Title: and Description: in a form that actually passes R CMD check --as-cran * man/kitten.Rd: Updated accordingly * DESCRIPTION (Suggests): Add whoami * .travis.yml (install): Add installation of whomai 2015-02-26 Dirk Eddelbuettel * .travis.yml (language): Using new native R support at Travis -- and reverted after realizing it leads to several additional minutes of forced installation of things we do not need 2014-09-11 Dirk Eddelbuettel * DESCRIPTION: Version 0.1.2 * R/pkgKitten.R (kitten): Correctly invoke new function 2014-09-09 Dirk Eddelbuettel * DESCRIPTION: Version 0.1.1 * inst/NEWS.Rd: Added 2014-09-07 Dirk Eddelbuettel * R/pkgKitten.R: New function playWithPerPackageHelpPage() to create a basic per-package manual page which purrs * man/playWithPerPackageHelpPage.Rd: Documentation for new function * NAMESPACE: Export new function 2014-06-13 Dirk Eddelbuettel * DESCRIPTION: Version 0.1.0 and first CRAN upload pkgKitten/README.md0000644000176200001440000000254113552323010013465 0ustar liggesusers## pkgKitten [![Build Status](https://travis-ci.org/eddelbuettel/pkgkitten.svg)](https://travis-ci.org/eddelbuettel/pkgkitten) [![License](http://img.shields.io/badge/license-GPL%20%28%3E=%202%29-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html) [![CRAN](http://www.r-pkg.org/badges/version/pkgKitten)](https://cran.r-project.org/package=pkgKitten) [![Dependencies](https://tinyverse.netlify.com/badge/pkgKitten)](https://cran.r-project.org/package=pkgKitten) [![Downloads](http://cranlogs.r-pkg.org/badges/pkgKitten?color=brightgreen)](http://www.r-pkg.org/pkg/pkgKitten) Create packages that purr ![a kitten](http://2.bp.blogspot.com/-rUsj-zdsAls/UY81UzuYHsI/AAAAAAAAAJA/QMiiNxYuvdI/s1600/burmilla-kitten.png) The base R function `package.skeleton()` is very useful for creating new packages for R. It is also very upsetting as it has been producing the same files which trigger `R CMD check` in the exact same way. And as something terrible happens each time `R CMD check` barks, this package offers a wrapper function `kitten()` which leaves an adorable little package behind which does not upset `R CMD check`. So just think of the kittens. ### Installation The package is on [CRAN](https://cran.r-project.org) and can be installed via a standard ```r install.packages("pkgKitten") ``` ### Author Dirk Eddelbuettel ### License GPL (>= 2) pkgKitten/man/0000755000176200001440000000000013552050133012762 5ustar liggesuserspkgKitten/man/pkgKitten-package.Rd0000644000176200001440000000110712337514463016614 0ustar liggesusers\name{pkgKitten-package} \alias{pkgKitten-package} \alias{pkgKitten} \docType{package} \title{ Create simple packages using the \code{kitten} function. } \description{ The base R function \code{package.skeleton()} is very helpful, but insist on creating packages which do not pass \code{R CMD check}. That is silly, This package helps with this issue. No more, no less. } \author{ Dirk Eddelbuettel wrote the package and maintains it. } \keyword{package} \seealso{ \code{\link[utils:package.skeleton]{package.skeleton}}, the \sQuote{Writing R Extensions} manual. } pkgKitten/man/playWithPerPackageHelpPage.Rd0000644000176200001440000000227213552050133020406 0ustar liggesusers% Generated by roxygen2 (4.1.1): do not edit by hand % Please edit documentation in R/pkgKitten.R \name{playWithPerPackageHelpPage} \alias{playWithPerPackageHelpPage} \title{Create a very simple package help page} \usage{ playWithPerPackageHelpPage(name = "anRpackage", path = ".", maintainer = "Your Name", email = "your@mail.com") } \arguments{ \item{name}{The name of the package to be created, defaults to \dQuote{anRpackage}} \item{path}{The path to the location where the package is to be created, defaults to the current directory.} \item{maintainer}{The name of the maintainer, defaults to \dQuote{Your Name} or \code{author} if the latter is given.} \item{email}{The maintainer email address.} } \value{ Nothing is returned as the function is invoked for its side effect of creating a new package. } \description{ The \code{playWithPerPackageHelpPage} function creates an basic package help page. } \details{ The \code{playWithPerPackageHelpPage} function can be used to create a simple help page for a package. It has been split off from the \code{kitten} function so that it can be called from other packages. As such, it is also exported from \pkg{pkgKitten}. } \author{ Dirk Eddelbuettel } pkgKitten/man/kitten.Rd0000644000176200001440000000303412535704325014560 0ustar liggesusers% Generated by roxygen2 (4.1.1): do not edit by hand % Please edit documentation in R/pkgKitten.R \name{kitten} \alias{kitten} \title{Create a very simple package} \usage{ kitten(name = "anRpackage", path = ".", author, maintainer, email, license = "GPL (>= 2)") } \arguments{ \item{name}{The name of the package to be created, defaults to \dQuote{anPackage}} \item{path}{The path to the location where the package is to be created, defaults to the current directory.} \item{author}{The name of the author, defaults to the result of \code{\link[whoami]{fullname}}.} \item{maintainer}{The name of the maintainer, also defaults to \code{\link[whoami]{fullname}} or \code{author} if the latter is given.} \item{email}{The maintainer email address, defaults to \code{\link[whoami]{email_address}}.} \item{license}{The license of the new package, default to \dQuote{GPL-2}.} } \value{ Nothing is returned as the function is invoked for its side effect of creating a new package. } \description{ The \code{kitten} function creates an (almost) empty example package. } \details{ The \code{kitten} function can be used to initialize a simple package. It is created with the minimal number of files. What distinguished it from the function \code{package.skeleton()} in base R (which it actually calls) is that the resulting package passes \code{R CMD check cleanly}. Because every time you create a new package which does \emph{not} pass \code{R CMD check}, a kitten experiences an existential trauma. Just think about the kittens. } \author{ Dirk Eddelbuettel } pkgKitten/DESCRIPTION0000644000176200001440000000123513553575372013740 0ustar liggesusersPackage: pkgKitten Type: Package Title: Create Simple Packages Which Do not Upset R Package Checks Version: 0.1.5 Date: 2019-10-22 Author: Dirk Eddelbuettel Maintainer: Dirk Eddelbuettel Description: Provides a function kitten() which creates cute little packages which pass R package checks. This sets it apart from package.skeleton() which it calls, and which leaves imperfect files behind. As this is not exactly helpful for beginners, kitten() offers an alternative. License: GPL (>= 2) Suggests: whoami (>= 1.1.0) NeedsCompilation: no Packaged: 2019-10-22 11:54:26.84363 UTC; edd Repository: CRAN Date/Publication: 2019-10-22 12:50:02 UTC pkgKitten/tests/0000755000176200001440000000000012346564426013370 5ustar liggesuserspkgKitten/tests/simpleTest.R0000644000176200001440000000007712346564426015650 0ustar liggesusers library(pkgKitten) demo("simpleDemo", package="pkgKitten") pkgKitten/R/0000755000176200001440000000000013552050133012410 5ustar liggesuserspkgKitten/R/pkgKitten.R0000644000176200001440000001721213552050133014476 0ustar liggesusers## pkgKitten -- A saner way to create packages to build upon ## ## Copyright (C) 2014 - 2017 Dirk Eddelbuettel ## ## This file is part of pkgKitten ## ## pkgKitten is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 2 of the License, or ## (at your option) any later version. ## ## pkgKitten is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with pkgKitten. If not, see . ##' The \code{kitten} function creates an (almost) empty example ##' package. ##' ##' The \code{kitten} function can be used to initialize a simple ##' package. It is created with the minimal number of files. What ##' distinguished it from the function \code{package.skeleton()} in ##' base R (which it actually calls) is that the resulting package ##' passes \code{R CMD check cleanly}. ##' ##' Because every time you create a new package which does \emph{not} ##' pass \code{R CMD check}, a kitten experiences an existential ##' trauma. Just think about the kittens. ##' @title Create a very simple package ##' @param name The name of the package to be created, defaults to \dQuote{anPackage} ##' @param path The path to the location where the package is to be ##' created, defaults to the current directory. ##' @param author The name of the author, defaults to the result of ##' \code{\link[whoami]{fullname}} (or \dQuote{Your Name} as fallback). ##' @param maintainer The name of the maintainer, also defaults to ##' \code{\link[whoami]{fullname}} or \code{author} if the latter is given. ##' @param email The maintainer email address, defaults to ##' \code{\link[whoami]{email_address}} (or \dQuote{your@email.com} as fallback). ##' @param license The license of the new package, defaults to \dQuote{GPL-2}. ##' @return Nothing is returned as the function is invoked for its ##' side effect of creating a new package. ##' @author Dirk Eddelbuettel kitten <- function(name = "anRpackage", path = ".", author, # = fullname(), # from 'whoami', wasL "Your Name", maintainer, # = if (missing(author)) fullname() else author, email, # = email_address(), # from 'whomai', was: "your@email.com", license = "GPL (>= 2)") { haswhoami <- requireNamespace("whoami", quietly=TRUE) if (missing(author)) author <- if (haswhoami) whoami::fullname("Your Name") else "Your Name" if (missing(maintainer)) maintainer <- author if (missing(email)) email <- if (haswhoami) whoami::email_address("your@email.com") else "your@email.com" call <- match.call() # how were we called call[[1]] <- as.name("package.skeleton") # run as if package.skeleton() was called env <- parent.frame(1) # access to what is in the environment if (file.exists(file.path(path, name))) { stop("Directory '", name, "' already exists. Aborting.", call.=FALSE) } assign("kitten.fake.fun", function() {}, envir = env) call <- call[ c(1L, which(names(call) %in% names(formals(package.skeleton)))) ] call[["list"]] <- "kitten.fake.fun" tryCatch(eval(call, envir = env), error = function(e){ stop(sprintf("error while calling `package.skeleton` : %s", conditionMessage(e))) }) message("\nAdding pkgKitten overrides.") root <- file.path(path, name) ## now pick things up from here DESCRIPTION <- file.path(root, "DESCRIPTION") if (file.exists(DESCRIPTION)) { x <- read.dcf(DESCRIPTION) x[, "Author"] <- author x[, "Maintainer"] <- sprintf("%s <%s>", maintainer, email) x[, "License"] <- license x[, "Title"] <- "What the Package Does Using Title Case" x[, "Description"] <- paste0("More details about what the package does. ", "See for ", "details on how to write this part.") write.dcf(x, file = DESCRIPTION) } dotgitignore <- system.file("skel", "R.gitignore", package="pkgKitten") tgtgitignore <- file.path(root, ".gitignore") if (!file.exists(tgtgitignore)) { file.copy(dotgitignore, tgtgitignore, overwrite=TRUE) message(" >> added .gitignore file") } dotRbuildignore <- system.file("skel", "dot.Rbuildignore", package="pkgKitten") tgtRbuildignore <- file.path(root, ".Rbuildignore") if (! file.exists(tgtRbuildignore)) { file.copy(dotRbuildignore, tgtRbuildignore, overwrite=TRUE) message(" >> added .Rbuildignore file") } playWithPerPackageHelpPage(name, path, maintainer, email) rtgt <- file.path(root, "R", "hello.R") rsrc <- system.file("replacements", "hello.R", package="pkgKitten") file.copy(rsrc, rtgt, overwrite=TRUE) rdtgt <- file.path(root, "man", "hello.Rd") rdsrc <- system.file("replacements", "hello.Rd", package="pkgKitten") file.copy(rdsrc, rdtgt, overwrite=TRUE) rm("kitten.fake.fun", envir = env) unlink(file.path(root, "R" , "kitten.fake.fun.R")) unlink(file.path(root, "man", "kitten.fake.fun.Rd")) unlink(file.path(root, "Read-and-delete-me")) message("Deleted 'Read-and-delete-me'.") message("Done.\n") message("Consider reading the documentation for all the packaging details.") message("A good start is the 'Writing R Extensions' manual.\n") message("And run 'R CMD check'. Run it frequently. And think of those kittens.\n") invisible(NULL) } ##' The \code{playWithPerPackageHelpPage} function creates an basic ##' package help page. ##' ##' The \code{playWithPerPackageHelpPage} function can be used to ##' create a simple help page for a package. ##' ##' It has been split off from the \code{kitten} function so that it ##' can be called from other packages. As such, it is also exported ##' from \pkg{pkgKitten}. ##' ##' @title Create a very simple package help page ##' @param name The name of the package to be created, defaults to \dQuote{anRpackage} ##' @param path The path to the location where the package is to be ##' created, defaults to the current directory. ##' @param maintainer The name of the maintainer, defaults to ##' \dQuote{Your Name} or \code{author} if the latter is given. ##' @param email The maintainer email address. ##' @return Nothing is returned as the function is invoked for its ##' side effect of creating a new package. ##' @author Dirk Eddelbuettel playWithPerPackageHelpPage <- function(name = "anRpackage", path = ".", maintainer = "Your Name", email = "your@mail.com") { root <- file.path(path, name) helptgt <- file.path(root, "man", sprintf( "%s-package.Rd", name)) helpsrc <- system.file("replacements", "manual-page-stub.Rd", package="pkgKitten") ## update the package description help page if (file.exists(helpsrc)) { lines <- readLines(helpsrc) lines <- gsub("__placeholder__", name, lines, fixed = TRUE) lines <- gsub("Who to complain to ", sprintf( "%s <%s>", maintainer, email), lines, fixed = TRUE) writeLines(lines, helptgt) } invisible(NULL) } pkgKitten/MD50000644000176200001440000000161613553575372012545 0ustar liggesusers1c6ffbf1d9fcf665248145c4b465e658 *ChangeLog 992c6d40adba0a53fd78e841ac93e3bc *DESCRIPTION d2946015b670bab9267bb69b1d2c8658 *NAMESPACE 0a487d043163f13989903611abb6f014 *R/pkgKitten.R 9707f8c2e5f3859402d05111e6a45a61 *README.md 62d719a0b4ba6c47179ef6550a200b0d *demo/00Index d3565ea965a4cc3c05a2752843d23649 *demo/simpleDemo.R c60a18172f638d8731d6ad6057b65e2b *inst/NEWS.Rd a7b870f7c2c7d2ff57c67066e227bade *inst/replacements/hello.R 4692d6b20a6276147928795918e0c496 *inst/replacements/hello.Rd 5476fe7ef88a074c77db10f3cafa46ff *inst/replacements/manual-page-stub.Rd 62b3946b656565afd058d96aa442af42 *inst/skel/R.gitignore 3221860fce76ed121b170af903e50129 *inst/skel/dot.Rbuildignore f247f0fe83685d5f11e13ac9f159224d *man/kitten.Rd 5c2a79b8606a80efec8722af664f665a *man/pkgKitten-package.Rd 38175be19e0fb10bdb092670ae5293a9 *man/playWithPerPackageHelpPage.Rd d02bd8825d2adc56b714bba08f9d1747 *tests/simpleTest.R pkgKitten/inst/0000755000176200001440000000000013373405135013173 5ustar liggesuserspkgKitten/inst/replacements/0000755000176200001440000000000013012074042015642 5ustar liggesuserspkgKitten/inst/replacements/hello.Rd0000644000176200001440000000041112337514463017247 0ustar liggesusers\name{hello} \alias{hello} \title{ A simple function doing little } \description{ This function shows a standard text on the console. In a time-honoured tradition, it defaults to displaying \emph{hello, world}. } \examples{ hello() hello("and goodbye") } pkgKitten/inst/replacements/manual-page-stub.Rd0000644000176200001440000000056413170405126021306 0ustar liggesusers\name{__placeholder__-package} \alias{__placeholder__-package} \alias{__placeholder__} \docType{package} \title{\packageTitle{__placeholder__}} \description{\packageDescription{__placeholder__}} \section{Package Content}{\packageIndices{__placeholder__}} \author{\packageAuthor{__placeholder__}} \section{Maintainer}{\packageMaintainer{__placeholder__}} \keyword{package} pkgKitten/inst/replacements/hello.R0000644000176200001440000000012512337514463017105 0ustar liggesusers ## a placeholder hello <- function(txt = "world") { cat("Hello, ", txt, "\n") } pkgKitten/inst/skel/0000755000176200001440000000000013170404076014127 5ustar liggesuserspkgKitten/inst/skel/R.gitignore0000644000176200001440000000123713170404076016244 0ustar liggesusers# Retrieved 2017-Oct-12 from https://github.com/github/gitignore/blob/master/R.gitignore # Licensed under CC0-1.0 https://github.com/github/gitignore/blob/master/LICENSE # History files .Rhistory .Rapp.history # Session Data files .RData # Example code in package build process *-Ex.R # Output files from R CMD build /*.tar.gz # Output files from R CMD check /*.Rcheck/ # RStudio files .Rproj.user/ # produced vignettes vignettes/*.html vignettes/*.pdf # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 .httr-oauth # knitr and R markdown default cache directories /*_cache/ /cache/ # Temporary files created by R markdown *.utf8.md *.knit.md pkgKitten/inst/skel/dot.Rbuildignore0000644000176200001440000000004313170404076017261 0ustar liggesusers^.git$ ^.*\.Rproj$ ^\.Rproj\.user$ pkgKitten/inst/NEWS.Rd0000644000176200001440000000340213553465765014254 0ustar liggesusers\name{NEWS} \title{News for Package \pkg{pkgKitten}} \newcommand{\ghpr}{\href{https://github.com/eddelbuettel/pkgkitten/pull/#1}{##1}} \newcommand{\ghit}{\href{https://github.com/eddelbuettel/pkgkitten/issues/#1}{##1}} \section{Changes in version 0.1.5 (2019-10-22)}{ \itemize{ \item More extensive use of newer R macros in package-default manual page. \item Install \code{.Rbuildignore} and \code{.gitignore} files. \item Use the updated Travis run script. \item Use more Rd macros in default 'stub' manual page (\ghpr{8}). \item Several typos were fixed in README.md, NEWS.Rd and the manual page (\ghpr{9}, \ghpr{10}) } } \section{Changes in version 0.1.4 (2016-11-13)}{ \itemize{ \item Utilize newer R macros in package-default manual page. \item Repair a link to Writing R Extensions (PR \ghpr{7} by Josh O'Brien). } } \section{Changes in version 0.1.3 (2015-06-12)}{ \itemize{ \item The fields Title: and Description: in the file \code{DESCRIPTION} file are now updated such that they actually pass \code{R CMD check} on current versions of R. \item If installed, the \CRANpkg{whoami} package (version 1.1.0 or later) is now used to discover the username and email in the \code{DESCRIPTION} file. } } \section{Changes in version 0.1.2 (2014-09-11)}{ \itemize{ \item Brown-bag fix of calling the new helper function with the correct order of arguments. } } \section{Changes in version 0.1.1 (2014-09-09)}{ \itemize{ \item New (exported) function \code{playWithPerPackageHelpPage()} which lets other packages create a non-complaint-generating package help page. } } \section{Changes in version 0.1.0 (2014-06-13)}{ \itemize{ \item Initial public version and CRAN upload. } }