ComputationalProteomicsUnit / maker

Makefile for R packages
GNU General Public License v3.0
31 stars 5 forks source link

[Wishlist]: allow create target without PKG #23

Closed lbraglia closed 9 years ago

lbraglia commented 9 years ago

Hi (sorry for long post)

before default PKG i could use something from my makerrc to create a package from scratch (mainly using devtools)

make create PKG=foo

that is currently defined as

DEVTOOLS_CREATE_DESCRIPTION = list('Authors@R' = \"as.person('Luca Braglia <lbraglia@gmail.com> [aut, cre]')\",\
                                   'License' = 'GPL-3', 'Version' = '0.1', 'Title' = prompt('\nTitle (one line; then [ENTER][Ctrl+D]): '),\
                                   'Description' = paste(strwrap(prompt('\nDescription (one, eventually long, line; then [ENTER][Ctrl+D]): '), 65, exdent = 13), collapse = '\n'))

create:
        @ ${RSCRIPT} -e "library(devtools);\                                                                                                                                                                                       
                         prompt <- function(x){con <- if (interactive()) stdin() else file('stdin'); cat(x); readLines(con = con, n = 1)};\                                                                                        
                         create('"$(PKG)"', description = ${DEVTOOLS_CREATE_DESCRIPTION}, rstudio = FALSE)";
        make devtools-use-package-doc PKG=$(PKG)
        make devtools-use-travis PKG=${PKG}
        @ echo
        @ echo Git Setup
        @ echo
        cd $(PKGDIR) && git init
        cd $(PKGDIR) && git remote add origin https://$(GITHUB_USER)@github.com/$(GITHUB_USER)/$(PKG).git

which is fine to me because it creates a package from cli that is ready to be coded and pushed to github.

Now since default PKG has been introduced, it doesn't work anymore because PKG/NAMESPACE does not exists yet (that's just what the create target does). But that is a fine/safe check to do, and should definitely remain.

Therefore now i'm using a little modified version of maker which add create to the allowed targets in absence of PKG/NAMESPACE

ifneq ($(filter-out create get-default-pkg help maker targets usage version,${MAKECMDGOALS}),)

I think adding an "official create" (or same, but different-named, target) would be badly addressed because the standard package setup is mainly a matter of tastes (eg one could use package.skeleton, devtools' create, Rcpp.package.skeleton, pkgKitten and so on... not to mention the optionals, eg roxygen, travis, git/svn support etc) but allowing the user him/herself to define a create target which is allowed to work in absence of PKG/NAMESPACE could be nice IMHO

In the case, i could be write something in recipes to document it

what do you think? @lgatto @sgibb

sgibb commented 9 years ago

What do you think about a variable NONPKGTARGETS := get-default help maker ...? Than you could use NONPKGTARGETS += create in your .makerrc. This would be very flexible.

lgatto commented 9 years ago

NONPKGTARGETS := get-default help maker seems a great solution.

lbraglia commented 9 years ago

definitely better, thanks