Skip to content

Commit

Permalink
Better support for version number in build
Browse files Browse the repository at this point in the history
  • Loading branch information
dfalster committed Aug 20, 2020
1 parent 758e616 commit 5ebbd02
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
19 changes: 17 additions & 2 deletions R/steps.R
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,6 @@ combine_austraits <- function(..., d=list(...), definitions) {
contributors=combine("contributors", d),
sources = sources,
build_info = list(
version=desc::desc_get_field("Version"),
git_SHA=get_SHA(),
session_info = sessionInfo()
)
)
Expand Down Expand Up @@ -744,3 +742,20 @@ update_taxonomy <- function(austraits_raw, taxa) {

austraits_raw
}

add_version_info <- function(austraits, version, git_sha) {

austraits$build_info <- list(
version=version,
git_SHA=git_sha,
session_info = austraits$build_info$session_info
)

austraits
}


export_version <- function(austraits_versioned, target_name, version_number) {
saveRDS(austraits_versioned, target_name)
saveRDS(austraits_versioned, gsub(".rds", sprintf("_%s.rds",version_number), target_name, fixed=TRUE))
}
12 changes: 9 additions & 3 deletions remake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ targets:
- export/data/austraits.rds

export/data/austraits.rds:
command: saveRDS(austraits, target_name)
command: export_version(austraits_versioned, target_name, version_number)

version_number:
command: desc_get_version()
command: desc_get_version("./DESCRIPTION")

git_SHA:
command: get_SHA()
depends:
- .git/index

definitions:
command: read_yaml("config/definitions.yml")
Expand Down Expand Up @@ -3409,8 +3414,9 @@ targets:
Zieminska_2013,
Zieminska_2015,
definitions=definitions)
depends: version_number
austraits:
command: update_taxonomy(austraits_raw, taxon_list)

austraits_versioned:
command: add_version_info(austraits, version_number, git_SHA)
12 changes: 9 additions & 3 deletions scripts/remake.yml.whisker
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ targets:
- export/data/austraits.rds

export/data/austraits.rds:
command: saveRDS(austraits, target_name)
command: export_version(austraits_versioned, target_name, version_number)

version_number:
command: desc_get_version()
command: desc_get_version("./DESCRIPTION")

git_SHA:
command: get_SHA()
depends:
- .git/index

definitions:
command: read_yaml("config/definitions.yml")
Expand Down Expand Up @@ -72,8 +77,9 @@ targets:
{{dataset_id}},
{{/dataset_ids}}
definitions=definitions)
depends: version_number

austraits:
command: update_taxonomy(austraits_raw, taxon_list)

austraits_versioned:
command: add_version_info(austraits, version_number, git_SHA)

0 comments on commit 5ebbd02

Please sign in to comment.