mirror of
https://github.com/agdamsbo/daDoctoR.git
synced 2025-01-18 03:16:34 +01:00
combining and testing
This commit is contained in:
parent
c029a09d07
commit
96479031e5
@ -1,6 +1,6 @@
|
||||
Package: daDoctoR
|
||||
Title: Functions For Health Research
|
||||
Version: 0.21.3
|
||||
Version: 0.21.4
|
||||
Year: 2021
|
||||
Author: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>
|
||||
Maintainer: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>
|
||||
|
11
packing.R
Normal file
11
packing.R
Normal file
@ -0,0 +1,11 @@
|
||||
library(roxygen2, devtools)
|
||||
|
||||
source("updatePackageVersion.R")
|
||||
|
||||
updatePackageVersion()
|
||||
|
||||
devtools::document()
|
||||
|
||||
# Inspiration: "https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/"
|
||||
|
||||
# Author@R: person("Andreas", "Gammelgaard Damsbo", email = "agdamsbo@pm.me", role = c("cre", "aut"))
|
21
update local version.R
Normal file
21
update local version.R
Normal file
@ -0,0 +1,21 @@
|
||||
# Install new version
|
||||
|
||||
# Remove
|
||||
|
||||
remove.packages("daDoctoR")
|
||||
.rs.restartR()
|
||||
|
||||
# setwd("/Users/andreas/")
|
||||
|
||||
devtools::install_github('agdamsbo/daDoctoR')
|
||||
|
||||
library(daDoctoR)
|
||||
|
||||
|
||||
## Safe alternative to devtools-approach
|
||||
|
||||
# library(downloader)
|
||||
# download("https://github.com/agdamsbo/daDoctoR/archive/master.tar.gz", "daDoctoR.tar.gz")
|
||||
# install.packages("daDoctoR.tar.gz", repos = NULL, type = "source")
|
||||
|
||||
# library(daDoctoR)
|
35
updatePackageVersion.R
Normal file
35
updatePackageVersion.R
Normal file
@ -0,0 +1,35 @@
|
||||
updatePackageVersion <- function(packageLocation ="."){
|
||||
## Seen at: https://www.mango-solutions.com/blog/how-to-auto-update-a-package-version-number
|
||||
|
||||
## Read DESCRIPTION file
|
||||
desc <- readLines(file.path(packageLocation, "DESCRIPTION"))
|
||||
|
||||
## Find the line where the version is defined
|
||||
vLine <- grep("^Version\\:", desc)
|
||||
|
||||
## Extract version number
|
||||
vNumber <- gsub("^Version\\:\\s*", "", desc[vLine])
|
||||
|
||||
## Split the version number into two; a piece to keep, a piece to increment
|
||||
versionNumber <- strsplit(vNumber, "\\.")[[1]]
|
||||
versionParts <- length(versionNumber)
|
||||
vNumberKeep <- paste(versionNumber[1:(versionParts-1)], sep= "", collapse= ".")
|
||||
vNumberUpdate <- versionNumber[versionParts]
|
||||
|
||||
## Replace old version number with new one (increment by 1)
|
||||
oldVersion <- as.numeric(vNumberUpdate)
|
||||
newVersion <- oldVersion + 1
|
||||
|
||||
## Build final version number
|
||||
vFinal <- paste(vNumberKeep, newVersion, sep = ".")
|
||||
|
||||
## Update DESCRIPTION file (in R)
|
||||
desc[vLine] <- paste0("Version: ", vFinal )
|
||||
|
||||
## Update the actual DESCRIPTION file
|
||||
writeLines(desc, file.path(packageLocation, "DESCRIPTION"))
|
||||
|
||||
## Return the updated version number to screen
|
||||
return(vFinal)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user