Skip to content

Commit

Permalink
get paws version from cran (#853)
Browse files Browse the repository at this point in the history
* migrate vendor api from aws-sdk-js to botocore

* add botocore to submodules

* migrate vendor from aws-sdk-js to botocore

* update services and remove deprecated aws services

* remove aws-sdk-js as vendor api

* update r docs to reflect botocore

* fixed usage

* typo

* get version from cran
  • Loading branch information
DyfanJones authored Dec 16, 2024
1 parent 406a75e commit cb2fa2a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion make.paws/R/cran_category.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ make_category <- function(category, service_names, sdk_dir, out_dir) {
title <- category$title
description <- category$description
imports <- .paws.common.import.version
version <- get_version(sdk_dir)
version <- get_version(minor = 1)

if (is.null(name) || is.null(title) || is.null(description)) {
stop("missing name, title, or description")
Expand Down
2 changes: 1 addition & 1 deletion make.paws/R/cran_sub_category.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Make the categories from collection of sub-categories
make_category_collection <- function(sdk_dir, out_dir, categories, package, service_names) {
version <- get_version(sdk_dir)
version <- get_version(minor = 1)
package <- sprintf("paws.%s", package)
package_dir <- file.path(out_dir, package)
write_skeleton_category(package_dir)
Expand Down
7 changes: 1 addition & 6 deletions make.paws/R/make_sdk.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ make_sdk <- function(
with_cache_dir(cache_dir, {
clear_dir(temp_dir)
clear_dir(out_doc_dir)
version <- tryCatch(
get_version(out_doc_dir),
error = function(e) {
return("0.0.1")
}
)
version <- get_version(minor = 1)
write_skeleton(temp_dir, version)
write_skeleton(out_doc_dir, version)
for (api in apis) {
Expand Down
15 changes: 13 additions & 2 deletions make.paws/R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,19 @@ get_description <- function(path) {
}

# Get the version number from the package in the given path.
get_version <- function(path) {
desc::desc_get("Version", file.path(path, "DESCRIPTION"))
# get_version <- function(path) {
# desc::desc_get("Version", file.path(path, "DESCRIPTION"))
# }
cache_env <- new.env(parent = emptyenv())
get_version <- function(major = 0, minor = 0, patch = 0) {
if (is.null(cache_env$version)) {
df <- as.data.frame(utils::available.packages(repos = "https://cran.rstudio.com"))
cache_env$version <- package_version(df[df$Package == "paws", "Version"])
cache_env$version[[c(1,1)]] <- cache_env$version$major + major
cache_env$version[[c(1,2)]] <- cache_env$version$minor + minor
cache_env$version[[c(1,3)]] <- cache_env$version$patch + patch
}
return(cache_env$version)
}

# Delete all files in a folder, with some given exceptions.
Expand Down
1 change: 1 addition & 0 deletions vendor/botocore
Submodule botocore added at baca98

0 comments on commit cb2fa2a

Please sign in to comment.