Skip to content

Commit

Permalink
version 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig authored and cran-robot committed Sep 2, 2023
1 parent ba6dec7 commit 32ffdeb
Show file tree
Hide file tree
Showing 29 changed files with 172 additions and 177 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: minioclient
Title: Interface to the 'MinIO' Client
Version: 0.0.4
Version: 0.0.5
Authors@R: c(person(
"Carl", "Boettiger",
email = "cboettig@gmail.com",
Expand Down Expand Up @@ -31,9 +31,9 @@ Config/testthat/edition: 3
Imports: fs, glue, tools, utils, processx, jsonlite
Language: en-US
NeedsCompilation: no
Packaged: 2023-08-08 14:59:51 UTC; cboettig
Packaged: 2023-08-12 17:43:37 UTC; cboettig
Author: Carl Boettiger [aut, cre] (<https://orcid.org/0000-0002-1642-628X>),
Markus Skyttner [ctb]
Maintainer: Carl Boettiger <cboettig@gmail.com>
Repository: CRAN
Date/Publication: 2023-08-09 09:10:05 UTC
Date/Publication: 2023-09-02 06:40:04 UTC
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2022
COPYRIGHT HOLDER: minio authors
COPYRIGHT HOLDER: minioclient authors
56 changes: 28 additions & 28 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
6045b1b2740d81bd66c23e5b65af1466 *DESCRIPTION
389c8e3b05e4a05a39e656226e21dcea *LICENSE
e045bf395f06558f394be4cc56980c9a *DESCRIPTION
c3e39d27af518564d1bf3abe53155396 *LICENSE
6d225983bd5b3d22f1c1e7cbb0de4e58 *NAMESPACE
6e37ae8c8fcce0c34467fd64b85222fe *NEWS.md
29b697f68c0a42bf905f53cd9de84580 *R/install_mc.R
7979906d3746afa5637458821ccdea2a *R/mc.R
ff9997bcbdb4557008422acd3e7e022c *NEWS.md
14b2ac292510abff4731f623d28218d4 *R/install_mc.R
e27ab3bf5ccb1ddbb0eb9988129d30e1 *R/mc.R
433b34583296e57098fd9d9476748019 *R/mc_alias.R
6828ee400ef5bcee6302c9ef9c9a1e6e *R/mc_anonymous.R
015babf4a4f0969662d4dc60a55ebf9f *R/mc_cat.R
7008f09e28715ac5574780e11c45e734 *R/mc_config_set.R
4c044508ed6a57f0066e37a2b9317bf4 *R/mc_cat.R
fc3c5168a35fa0fa6fb51ead8e005983 *R/mc_config_set.R
275b7ea32aa3ad782dfc4e02f50013c0 *R/mc_cp.R
29416a945da9945c0278f7fe6c80198d *R/mc_diff.R
ff2b51aac099876cc876d101bb43f435 *R/mc_du.R
1df91160c89b4385de4b6575f7f9c9f3 *R/mc_head.R
d9e77f03c2d8f34d6a2878e161c0ebf3 *R/mc_head.R
550c2e26bd4aefefc13d1e79415aa72d *R/mc_ls.R
eb231dfe2b85269ff9fc9f705f8bddc0 *R/mc_mb.R
f9976b841e6a40b28377dccb48a441ea *R/mc_mirror.R
75c1651f6ba3d71f4b453e9fa85e8811 *R/mc_mv.R
e43b5a6495d0b5e5ae006796f635f6d0 *R/mc_mirror.R
9ed86b5575fb7a6546e2618b934db192 *R/mc_mv.R
5f09cc518b1bc1fad9252f0cb6b0e69e *R/mc_rb.R
f0c516a610ba479e806d343e08674c0d *R/mc_rm.R
61ba35dae2ce98f34fe77ce0f8ee04af *R/mc_sql.R
8e1d9026c441ce47f38a4bd34e4e1645 *R/mc_rm.R
1254e5d5296aef4038a4ec763d5fefea *R/mc_sql.R
721bc728abb15c05d6ce647688bcd667 *R/mc_stat.R
259a845d43bad5e46ae7f39eab92be6e *README.md
9532cd4d901cb8c3d9fbf9b59965e8f9 *inst/WORDLIST
712b6688fef5102b027caa77a97975fb *man/install_mc.Rd
48fce050f4898284e36e1c0d15a79dbc *man/mc.Rd
63c42f6048f66bdb28ae545171fe27ef *README.md
ea980cbfed78c854898fbf3f86d98a91 *inst/WORDLIST
4bc02a7dfbeea391d5173bf048dca2b4 *man/install_mc.Rd
bf4e1fd5bec4ce43d37ef6c55b343122 *man/mc.Rd
b9cdcf37f9e42f2e4eba4238c309788c *man/mc_alias_ls.Rd
2e3482696e2dfe304b78203f7b972a39 *man/mc_alias_set.Rd
36f8ba694633327640f19a614777f823 *man/mc_anonymous_set.Rd
9fb0d1a94a99f1da2af470dc42f9a2e7 *man/mc_cat.Rd
b23fc899599b75810d25b4442347fd87 *man/mc_config_set.Rd
1eee1c0a31b3586ba89ae122473a7d4e *man/mc_cat.Rd
dc67a9ac321e6f7398cc8455f0e4a67d *man/mc_config_set.Rd
7a09d43f222f87902c777d7214c9bb24 *man/mc_cp.Rd
58015ad58ea1a665688a620e476ac866 *man/mc_du.Rd
b756e99bb9fdc300df5a691104972bd7 *man/mc_head.Rd
8d532d8dd2d34e58dab6c7737101ff2e *man/mc_head.Rd
75fada449ed4f98b060fd3c14dd13874 *man/mc_ls.Rd
b04523a63e82214ef994cf8d53dd80cb *man/mc_mb.Rd
b397d87bf809f0fd973f08c538251d2e *man/mc_mirror.Rd
1b99bb192f49842cf7a763b77dc8057d *man/mc_mv.Rd
5986bc6e8c56f3768c97b01d953cfc60 *man/mc_mirror.Rd
fab0da0dd70063a3a267cdfe43df4630 *man/mc_mv.Rd
c6b93c41957b41b07e4947accf926a29 *man/mc_rb.Rd
8332d1d3d576736d119b546632f31e6a *man/mc_rm.Rd
65d68183b96d60b85c7f67862a468cea *man/mc_sql.Rd
52defaf6f773aa9fba2eabd54f96903c *man/mc_rm.Rd
1cb0dbd778786bd3166bc0143a15f26f *man/mc_sql.Rd
0622a97a2aaa3c342f09636052c2d7f5 *tests/spelling.R
f8eeaf8007d7662006958a2935ef654c *tests/testthat.R
1f7fbd3952da5d077e4b67a0bf3902c5 *tests/testthat/test-mc.R
5417a3cd54509c595f0c4e78e93f3824 *tests/testthat/test-mc_cat.R
7e4c642eb609fe18bf3a6542771df745 *tests/testthat/test-mc_head.R
00b2cd397f569a43f0587141d9bb7ef4 *tests/testthat/test-mc_ls.R
b0cf2599bfabd63f9ca09cf3787eaaf0 *tests/testthat/test-s3-select.R
7ddc76a8f1e2ad0f76672d4544573852 *tests/testthat/test-mc.R
2f172fa35f82a805c83079f2c6f7eeb3 *tests/testthat/test-mc_cat.R
cc276a2db14bef8e8aeb31890ab45713 *tests/testthat/test-mc_head.R
18062a1f2e6e889a9ca9c89241ddd49c *tests/testthat/test-mc_ls.R
8a806150f8ad403c2c7e742afbe535a8 *tests/testthat/test-s3-select.R
15 changes: 15 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# minioclient 0.0.5

CRAN-policy based bugfix release.

* bug-fix: 0.0.4 release introduced unit tests that wrote to `~/.mc`.
Configuration files are now placed in `minio_path()` directory,
using OS-specific path from `tools::R_user_dir()`,
or configured as `options("minioclient.dir")`
* bug-fix: 0.0.4 introduced unit tests that downloaded binary without prompt.
`install_mc()` will now prompt before install in interactive mode and must
be called explicitly in batch scripts.
* bug-fix: 0.0.4 some tests may not have fail gracefully when depending on
external resources. This is now patched.


# minioclient 0.0.4

* Refactored function `mc_ls()` to provide results as a data.frame
Expand Down
18 changes: 9 additions & 9 deletions R/install_mc.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
#' For details, see official MINIO docs for your operating system,
#' e.g. <https://min.io/docs/minio/macos/index.html>.
#'
#' NOTE: If you want to install to other than the default location, OR if you
#' already have a minio client installed somewhere and want to use that,
#' simply set the option "mc.bin.dir", to the appropriate location of the
#' NOTE: If you want to install to other than the default location,
#' simply set the option "minioclient.dir", to the appropriate location of the
#' directory containing your "mc" binary, e.g.
#' `options("mc.bin.dir" = "/usr/local/bin)`. Note that this package
#' `options("minioclient.dir" = "~/.mc")`. This is also used as the location
#' of the config directory. Note that this package
#' will not automatically use MINIO available on $PATH (to promote security
#' and portability in design).
#' and portability in design).
#' @examplesIf interactive()
#' install_mc()
#'
Expand All @@ -29,7 +29,7 @@
#'
#' @export
install_mc <- function(os = system_os(), arch = system_arch(),
path = bin_path(), force = FALSE ) {
path = minio_path(), force = FALSE ) {

os <- switch(os,
"mac" = "darwin",
Expand Down Expand Up @@ -58,9 +58,9 @@ install_mc <- function(os = system_os(), arch = system_arch(),
invisible(binary)
}

bin_path <- function() {
getOption("mc.bin.dir",
tools::R_user_dir("mc", "data")
minio_path <- function() {
getOption("minioclient.dir",
tools::R_user_dir("minioclient", "data")
)
}

Expand Down
9 changes: 6 additions & 3 deletions R/mc.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
#' see <https://min.io/docs/minio/linux/reference/minio-mc.html>.
#' The R package provides wrappers only for the most common use cases,
#' which provide a more natural R syntax and native documentation.
mc <- function(command, ..., path = bin_path(), verbose = interactive()) {
mc <- function(command, ..., path = minio_path(), verbose = interactive()) {

binary <- fs::path(path, "mc")
if(!file.exists(binary)) {
install_mc()
if(!file.exists(binary) && interactive()) {
proceed <- utils::askYesNo(
"the mc client is not yet installed, should we install it now?")
if(proceed) install_mc()
}

command <- paste("--config-dir", path, command)
args <- strsplit(command, split = " ")[[1]]
p <- processx::run(binary, args, ...)

Expand Down
5 changes: 3 additions & 2 deletions R/mc_cat.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
#' @param flags additional flags to be passed to the `cat` command.
#' Default is an empty string.
#' @returns a character string with the contents of the file
#' @examples \dontrun{
#' @examplesIf interactive()
#' # upload a file to a bucket and read it back
#' install_mc()
#' mc_mb("play/mcr")
#' mc_cp(system.file(package = "minioclient", "DESCRIPTION"), "play/mcr/DESCRIPTION")
#' mc_cat("play/mcr/DESCRIPTION")
#' }
#'
#' @export

mc_cat <- function(target, offset = 0, tail = 0, flags = "") {
Expand Down
4 changes: 2 additions & 2 deletions R/mc_config_set.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' @param key the parameter name, e.g. `sessionToken`
#' @param value the value to set the parameter to
#' @param json path to the config
#'
#' @return updates configuration and returns silently (`NULL`).
#' @examplesIf interactive()
#'
#' mc_config_set("play", key="sessionToken", value="MyTmpSessionToken")
Expand All @@ -14,7 +14,7 @@
mc_config_set <- function(alias,
key,
value,
json = "~/.mc/config.json") {
json = file.path(minio_path(), "config.json")) {
config <- jsonlite::read_json(json)

config[["aliases"]][[alias]][[key]] <- value
Expand Down
4 changes: 2 additions & 2 deletions R/mc_head.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
#' @param flags additional flags to be passed to the `cat` command.
#' Default is an empty string.
#' @returns a character string with the contents of the file
#' @examples \dontrun{
#' @examplesIf interactive()
#' # upload a CSV file
#' install_mc()
#' tf <- tempfile()
#' write.csv(iris, tf, row.names = FALSE)
#' mc_mb("play/iris")
#' mc_cp(tf, "play/iris/iris.csv")
#'
#' # read first 13 lines from the CSV (header + 12 rows of data)
#' read.csv(text = mc_head("play/iris/iris.csv", n = 13))
#' }
#' @export

mc_head <- function(target, n = 10, flags = "") {
Expand Down
2 changes: 1 addition & 1 deletion R/mc_mirror.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#'
#' @inherit mc return
#'
#' @examplesIf FALSE
#' @examplesIf interactive()
#'
#' # Mirror files and directories from source to destination
#' mc_mirror("path/to/source", "path/to/destination")
Expand Down
2 changes: 1 addition & 1 deletion R/mc_mv.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @inherit mc return
#' @details see `mc("mv -h")` for details.
#' @seealso mc_cp
#' @examplesIf FALSE
#' @examplesIf interactive()
#'
#' # move a file
#' mc_mv("local/path/to/file.txt", "alias/bucket/path/file.txt")
Expand Down
2 changes: 1 addition & 1 deletion R/mc_rm.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' @details see `mc("rm -h")` for details.
#' @inherit mc return
#'
#' @examplesIf FALSE
#' @examplesIf interactive()
#'
#' # Remove a file
#' mc_rm("path/to/file.txt")
Expand Down
13 changes: 9 additions & 4 deletions R/mc_sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' @param recursive logical, by default TRUE, allowing a s3 select query to work
#' across a minio ALIAS/PATH specification
#' @param verbose logical, by default FALSE
#' @return SQL query results as a `data.frame` of class `tbl_df`
#' @export
#' @details
#'
Expand All @@ -20,7 +21,8 @@
#'
#' More examples of query syntax here:
#' <https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-select-sql-reference-select.html>
#' @examples \dontrun{
#' @examplesIf interactive()
#' install_mc()
#' # upload a CSV file
#' tf <- tempfile()
#' write.csv(iris, tf, row.names = FALSE)
Expand All @@ -29,10 +31,13 @@
#'
#' # read first 12 lines from the CSV
#' mc_sql("play/iris/iris.csv", query = "select * from S3Object limit 12")
#' }#'
mc_sql <- function(target, query = "select * from S3Object", recursive = TRUE, verbose = FALSE) {
#'
mc_sql <- function(target,
query = "select * from S3Object",
recursive = TRUE,
verbose = FALSE) {

binary <- fs::path(bin_path(), "mc")
binary <- fs::path(minio_path(), "mc")

if(!file.exists(binary)) {
install_mc()
Expand Down

0 comments on commit 32ffdeb

Please sign in to comment.