dev_history.R

require(usethis)
require(devtools)
require(attachment)
require(pkgdown)
require(dplyr)
## See tutorials here : https://rtask.thinkr.fr/blog/rmd-first-when-development-starts-with-documentation/ and here : https://stateofther.github.io/finistR2019/d-mypkg.html and here https://jef.works/blog/2019/02/17/automate-testing-of-your-R-package/
## and https://usethis.r-lib.org/articles/articles/usethis-setup.html
## and video here : http://www.user2019.fr/static/pres/t257651.zip

## create the package
usethis::create_package("/home/ptaconet/eodataflow")
## Manual step : Create a dev_history.R file that archives all the package history steps. Then copy it to the package folder.
## Then proceed :
usethis::use_build_ignore("dev_history.R")
usethis::use_git()
usethis::use_git_ignore("dev_history.R")
usethis::use_gpl3_license()
devtools::check()
usethis::proj_get()

## Manual steps : If not installed, install these packages
# system("brew install libssh2")
# system("brew install libgit2")
# install.packages("git2r")

## Manual step : Fill-in DESCRIPTION file with title and description of the package
## Manual step : If not already done, add a local SSH key following the instructions here : https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
## Then proceed :
usethis::use_github()
devtools::install()
usethis::use_readme_rmd()
usethis::use_package("magrittr","dplyr","httr","sf","purrr","lubridate","xml2","stringr","rvest","utils","parallel","curl")
# pour que les vignettes s'installent : ajouter VignetteBuilder: knitr dans le DESCRIPTION file
# Intégration continue avec Travis-CI
usethis::use_travis()

## Manual step : Commit and push

## Document functions and dependencies
attachment::att_to_description()
## Check the package
devtools::check()

usethis::use_testthat()

## Manual step : Add example dataset in inst/example-data

#usethis::use_vignette("aa-exploration")
# Document functions and dependencies
attachment::att_to_description()
# Check the package
devtools::check()

devtools::document()

# For CRAN-like check
devtools::check(args = c('--as-cran'))

#then :
devtools::install(build_vignettes = TRUE)
devtools::test() #reloads your code with load_all(), then runs all testthat tests.
## Ajouter manuellement dans le description file, la liste des packages dont dépend le package

roi_modis2tiles<-"/home/ptaconet/Documents/modis2tiles.gpkg"
file.copy(roi_modis2tiles,gsub("Documents","opendapr/inst/extdata",roi_modis2tiles))

### To add a config file with username and password to usgs. More info : https://db.rstudio.com/best-practices/managing-credentials/
file.create("config.yml")
usethis::use_build_ignore("config.yml")
usethis::use_git_ignore("config.yml")

## To build vignettes
devtools::build_vignettes() # ne pas oublier d'avoir ajouté au préalable VignetteBuilder: knitr dans le DESCRIPTION file
devtools::install(build_vignettes = TRUE)
devtools::install()

# to test build on windows
#check_win()

## To build a website with home and vignettes
usethis::use_package_doc()
usethis::use_tibble()
devtools::document()
pkgdown::build_site()
usethis::use_build_ignore("docs")
## Manual step : go to the settings of the package on the github page, then under "github page" put "master branch /docs folder"


usethis::use_build_ignore(c("korhogo"))
ptaconet/eodataflow documentation built on June 14, 2024, 6:43 p.m.