lockedata / starters

R Package 📦 for initializing projects for various R activities :nut_and_bolt:
https://itsalocke.com/starters/
GNU General Public License v3.0
124 stars 16 forks source link

start_here() Not providing default code #130

Closed stephlocke closed 5 years ago

stephlocke commented 5 years ago
Checking default description values...
  NULL
  [Copied to clipboard]
● DESCRIPTION defaults not set yet. Amend and paste the code above (copied to clipboard) to your .Rprofile via running usethis::edit_r_profile().
Error: Set DESCRIPTION default then run starters::start_here() again.

NULL gets copied to the clipboard


> sessioninfo::session_info()
- Session info --------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.2 (2018-12-20)
 os       Windows >= 8 x64            
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United Kingdom.1252 
 ctype    English_United Kingdom.1252 
 tz       Europe/London               
 date     2019-03-14                  

- Packages ------------------------------------------------------------------------
 package     * version    date       lib source                             
 assertthat    0.2.0      2017-04-11 [1] CRAN (R 3.5.0)                     
 callr         3.1.1      2018-12-21 [1] CRAN (R 3.5.1)                     
 cli           1.0.1      2018-09-25 [1] CRAN (R 3.5.1)                     
 clipr         0.5.0      2019-01-11 [1] CRAN (R 3.5.2)                     
 clisymbols    1.2.0      2017-05-21 [1] CRAN (R 3.5.0)                     
 crayon        1.3.4      2017-09-16 [1] CRAN (R 3.5.0)                     
 curl          3.3        2019-01-10 [1] CRAN (R 3.5.2)                     
 fs            1.2.6      2018-08-23 [1] CRAN (R 3.5.1)                     
 git2r         0.24.0     2019-01-07 [1] CRAN (R 3.5.2)                     
 glue          1.3.1      2019-03-12 [1] CRAN (R 3.5.2)                     
 httr          1.4.0      2018-12-11 [1] CRAN (R 3.5.1)                     
 jsonlite      1.6        2018-12-07 [1] CRAN (R 3.5.1)                     
 magrittr      1.5        2014-11-22 [1] CRAN (R 3.5.0)                     
 pkgbuild      1.0.2      2018-10-16 [1] CRAN (R 3.5.1)                     
 prettyunits   1.0.2      2015-07-13 [1] CRAN (R 3.5.1)                     
 processx      3.3.0      2019-03-10 [1] CRAN (R 3.5.3)                     
 ps            1.3.0      2018-12-21 [1] CRAN (R 3.5.1)                     
 R6            2.4.0      2019-02-14 [1] CRAN (R 3.5.2)                     
 Rcpp          1.0.0      2018-11-07 [1] CRAN (R 3.5.1)                     
 rlang         0.3.1      2019-01-08 [1] CRAN (R 3.5.2)                     
 rstudioapi    0.9.0      2019-01-09 [1] CRAN (R 3.5.1)                     
 sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.5.1)                     
 starters      0.0.2      2019-03-14 [1] Github (lockedata/starters@426b631)
 usethis       1.4.0.9000 2019-03-14 [1] Github (r-lib/usethis@15d1587)     
 whoami        1.2.0      2018-09-11 [1] CRAN (R 3.5.1)                     
 withr         2.1.2      2018-03-15 [1] CRAN (R 3.5.0)                     
 yaml          2.2.0      2018-07-25 [1] CRAN (R 3.5.1)                     

[1] C:/Users/steph/OneDrive/Documents/R/win-library/3.5
[2] C:/Program Files/R/R-3.5.2/library
maelle commented 5 years ago

Weird.

What do the following snippets return?

getOption("usethis.description")

and

usethis::ui_code_block(options(
      usethis.description = list(
        `Authors@R` = 'person("Jane", "Doe", email = "jane@example.com", role = c("aut", "cre"),
                          comment = c(ORCID = "YOUR-ORCID-ID"))',
        License = "MIT + file LICENSE",
        Language =  "es"
      )
    ))

?

stephlocke commented 5 years ago
> getOption("usethis.description")
$`Authors@R`
[1] "person(\"Jane\", \"Doe\", email = \"jane@example.com\", role = c(\"aut\", \"cre\"),\n                          comment = c(ORCID = \"YOUR-ORCID-ID\"))"

$License
[1] "MIT + file LICENSE"

$Language
[1] "es"

> usethis::ui_code_block(options(
+     usethis.description = list(
+         `Authors@R` = 'person("Jane", "Doe", email = "jane@example.com", role = c("aut", "cre"),
+         comment = c(ORCID = "YOUR-ORCID-ID"))',
+         License = "MIT + file LICENSE",
+         Language =  "es"
+ )
+ ))
  list(`Authors@R` = "person(\"Jane\", \"Doe\", email = \"jane@example.com\", role = c(\"aut\", \"cre\"),\n                          comment = c(ORCID = \"YOUR-ORCID-ID\"))", License = "MIT + file LICENSE", Language = "es")
  [Copied to clipboard]
maelle commented 5 years ago

:thinking: and the whole snippet below? (I expect it to give what you put in the first comment)

if(is.null(getOption("usethis.description"))){
    usethis::ui_code_block(options(
      usethis.description = list(
        `Authors@R` = 'person("Jane", "Doe", email = "jane@example.com", role = c("aut", "cre"),
                          comment = c(ORCID = "YOUR-ORCID-ID"))',
        License = "MIT + file LICENSE",
        Language =  "es"
      )
    ))

    usethis::ui_todo("DESCRIPTION defaults not set yet. Amend and paste the code above (copied to clipboard) to your .Rprofile via running usethis::edit_r_profile().")
    usethis::ui_stop("Set DESCRIPTION default then run starters::start_here() again.")
  } else{
    usethis::ui_done("DESCRIPTION defaults are already set!")
  }
stephlocke commented 5 years ago

Yep - still NULL It seems to not like the whole code snipped and is just bringing back the list bit. I don't suppose the code needs to be provided as a text string rather than bare code?

maelle commented 5 years ago

Ok can you make a PR? Not sure I 100% understand your suggestion.

stephlocke commented 5 years ago

This works

if(is.null(getOption("usethis.description"))){
  usethis::ui_code_block("options(
    usethis.description = list(
      `Authors@R` = 'person(\"Jane\", \"Doe\", email = \"jane@example.com\", role = c(\"aut\", \"cre\"),
      comment = c(ORCID = \"YOUR-ORCID-ID\"))',
      License = \"MIT + file LICENSE\",
      Language =  \"es\"
  )
  )")

  usethis::ui_todo("DESCRIPTION defaults not set yet. Amend and paste the code above (copied to clipboard) to your .Rprofile via running usethis::edit_r_profile().")
  usethis::ui_stop("Set DESCRIPTION default then run starters::start_here() again.")
} else{
  usethis::ui_done("DESCRIPTION defaults are already set!")
}
maelle commented 5 years ago

ok will commit it in a sec