Skip to content

Commit 41e169b

Browse files
committed
support action disabling through config + disable metadataeditr (World Bank) actions (not in CRAN) in view of CRAN publication of geoflow
1 parent 3b0f5ba commit 41e169b

4 files changed

Lines changed: 664 additions & 658 deletions

File tree

R/geoflow_action.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ geoflow_action <- R6Class("geoflow_action",
3838
public = list(
3939
#'@field id action ID
4040
id = NA,
41+
#'@field enabled enabled
42+
enabled = TRUE,
4143
#'@field funders funders
4244
funders = list(),
4345
#'@field authors authors
@@ -78,6 +80,7 @@ geoflow_action <- R6Class("geoflow_action",
7880
#'@description Initialize a \link{geoflow_action}
7981
#'@param yaml a yaml file
8082
#'@param id action id
83+
#'@param enabled enabled
8184
#'@param funders funders
8285
#'@param authors authors
8386
#'@param maintainer maintainer
@@ -97,7 +100,7 @@ geoflow_action <- R6Class("geoflow_action",
97100
#'@param status status of the action (experimental, stable, deprecated, superseded)
98101
#'@param notes notes
99102
initialize = function(yaml = NULL,
100-
id = NULL,
103+
id = NULL, enabled = TRUE,
101104
funders = list(), authors = list(), maintainer = NULL,
102105
scope = "global", types = list(), def = "",
103106
target = NA, target_dir = NA,
@@ -112,6 +115,7 @@ geoflow_action <- R6Class("geoflow_action",
112115
self$fromYAML(yaml)
113116
}else{
114117
self$id <- id
118+
self$enabled <- enabled
115119
self$funders = funders
116120
self$authors = authors
117121
self$maintainer = maintainer
@@ -142,6 +146,8 @@ geoflow_action <- R6Class("geoflow_action",
142146
fromYAML = function(file){
143147
yml = yaml::read_yaml(file)
144148
self$id = yml$id
149+
self$enabled = yml$enabled
150+
if(is.null(yml$enabled)) self$enabled = TRUE
145151
self$funders = yml$funders
146152
self$authors = yml$authors
147153
self$maintainer = yml$maintainer
@@ -320,7 +326,7 @@ register_actions <- function(){
320326
objs <- lapply(yml_files, function(file){
321327
geoflow_action$new(yaml = system.file("actions", file, package = "geoflow"))
322328
})
323-
.geoflow$actions <- objs
329+
.geoflow$actions <- objs[sapply(objs, function(x){x$enabled})]
324330
}
325331

326332
#' @name list_actions

R/geoflow_software.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -693,20 +693,20 @@ register_software <- function(){
693693
#-------------------------------------------------------------------------------------------------------
694694
#WORLDBANK METADATA EDITOR CLIENT
695695
#-------------------------------------------------------------------------------------------------------
696-
geoflow_software$new(
697-
software_type = "metadataeditr",
698-
definition = "World Bank metadata editor client powered by 'metadataeditr' package",
699-
packages = list("metadataeditr"),
700-
handler = try(metadataeditr:::set_api, silent = TRUE),
701-
arguments = list(
702-
api_url = list(label = "API URL", def = "Metadata editor API endpoint URL", class = "character"),
703-
api_key = list(label = "API key", def = "An API user authorization key (to be generated in the Metadata editor)", class = "character"),
704-
verbose = list(label = "verbose", def = "Whether messages should be displayed or not", class = "logical", default = FALSE)
705-
),
706-
attributes = list(
707-
collection_names = list(label = "Collection_names", def = "A coma-separated list of collection names where projects will be associated with", class = "character")
708-
)
709-
),
696+
# geoflow_software$new(
697+
# software_type = "metadataeditr",
698+
# definition = "World Bank metadata editor client powered by 'metadataeditr' package",
699+
# packages = list("metadataeditr"),
700+
# handler = try(metadataeditr:::set_api, silent = TRUE),
701+
# arguments = list(
702+
# api_url = list(label = "API URL", def = "Metadata editor API endpoint URL", class = "character"),
703+
# api_key = list(label = "API key", def = "An API user authorization key (to be generated in the Metadata editor)", class = "character"),
704+
# verbose = list(label = "verbose", def = "Whether messages should be displayed or not", class = "logical", default = FALSE)
705+
# ),
706+
# attributes = list(
707+
# collection_names = list(label = "Collection_names", def = "A coma-separated list of collection names where projects will be associated with", class = "character")
708+
# )
709+
# ),
710710
#-------------------------------------------------------------------------------------------------------
711711
#SMTP CLIENT
712712
#-------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)