Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean #13

Merged
merged 27 commits into from
May 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b2f7c65
Do not use Roxygen comment for separator line
hsonne May 5, 2024
18a12e8
Integrate pattern directly in grepl() call
hsonne May 5, 2024
0e15004
Improve indentation
hsonne May 5, 2024
5da4fc0
Use new function formattedMessageIf()
hsonne May 5, 2024
f8961b1
Rename arg "version_dates" to "versions"
hsonne May 5, 2024
6a8fbc2
Simplify Roxygen documentation
hsonne May 5, 2024
4e3688e
Integrate URL pattern in sprintf() call
hsonne May 5, 2024
abaae92
Add utility functions copyFile(), downloadFile()
hsonne May 5, 2024
69ec6dd
Document and export loadDescriptionFromWeb()
hsonne May 5, 2024
995985a
Clean readGithubPackageDescription()
hsonne May 5, 2024
c1d1684
Clean/simplify loadDescriptionFromArchiveUrl()
hsonne May 5, 2024
047296a
Remove tests of deleted functions
hsonne May 5, 2024
6467734
Improve names, implement simple test
hsonne May 5, 2024
a4d5ff2
Clean archivedCranVersions()
hsonne May 5, 2024
ccba59a
Use copyFile(), let it return all file paths
hsonne May 5, 2024
802fe8b
Rename "src" to "text"
hsonne May 5, 2024
172067b
Use pipe operator, add tests
hsonne May 5, 2024
f1a2d08
Clean detach.R
hsonne May 5, 2024
bc565ac
Clean and test downloadGitHubPackage()
hsonne May 5, 2024
f619301
Use intermediate variable "versionInDescription"
hsonne May 6, 2024
46fe9c4
Use sprintf() and pipe operator
hsonne May 6, 2024
4ae4298
Use pipe operator
hsonne May 6, 2024
e398130
Use functions from kwb.utils and pipe operator
hsonne May 6, 2024
4446f20
Update Rd files
hsonne May 6, 2024
bd132e4
Support 2nd version of currentCranVersion()
hsonne May 6, 2024
a6dbfb1
Do not convert "package" to a factor
hsonne May 6, 2024
d6c0709
Further cleaning
hsonne May 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add utility functions copyFile(), downloadFile()
  • Loading branch information
hsonne committed May 5, 2024
commit abaae92e537dacb1d8e67ccd21123091833839c1
24 changes: 24 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -35,6 +35,15 @@ cleanStop <- function(...)
stop(..., call. = FALSE)
}

# copyFile ---------------------------------------------------------------------
copyFile <- function(from, to, ...)
{
success <- file.copy(from, to, ...)

# Return the path(s) to the target file(s)
to
}

# createDirectory --------------------------------------------------------------
#' @importFrom kwb.utils createDirectory
createDirectory <- kwb.utils::createDirectory
@@ -47,6 +56,21 @@ defaultIfNa <- kwb.utils::defaultIfNA
#' @importFrom kwb.utils defaultIfNULL
defaultIfNull <- kwb.utils::defaultIfNULL

# downloadFile -----------------------------------------------------------------

#' Downloads File from URL and Returns the Path to the Downloaded File
#'
#' @param url URL to file to be downloaded
#' @param targetDir path to local target directory
#' @param quiet passed to \code{\link{download.file}}
#' @returns path to downloaded file
downloadFile <- function(url, targetDir = tempdir(), quiet = TRUE)
{
destfile <- file.path(targetDir, basename(url))
utils::download.file(url, destfile, quiet = quiet)
destfile
}

# equidistantAngles ------------------------------------------------------------

#' Equidistantly Distributed Angles in Degrees Between 0 and 360
21 changes: 21 additions & 0 deletions man/downloadFile.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.