Comments (8)
This would be handy
from minicran.
Here's an example based on achubaty's comment
addGithubPackage <- function(githubPath,...){
packageName <- basename(githubPath)
exDir <- file.path(tempdir(),packageName)
if(file.exists(exDir)) unlink(exDir, recursive=TRUE)
zipFile <- file.path(tempdir(),paste0(packageName,".zip"))
download.file(paste0(githubPath,"/","zipball/master"),zipFile)
unzip(zipFile, exdir = exDir)
file.rename(list.files(exDir,full.names=TRUE)[1],file.path(exDir,packageName))
addLocalPackage(packageName,exDir,...)
}
addGithubPackage(githubPath="https://github.com/js229/Vennerable/",path=reposPath,build=TRUE)
from minicran.
Hi! I needed this functionality and took the code from the branch 50-addPackageGitHub
and extended it to support private repos etc by calling the appropriate functions in the remotes
package.
The end result is below. Feel free to add it to the package or let me know if you would like a proper pull request.
addPackageGitHub <- function(repo, username = NULL, ref = "master", subdir = NULL, auth_token = remotes:::github_pat(quiet), ...) {
packageName <- basename(repo)
exDir <- file.path(tempdir(), packageName)
if (dir.exists(exDir)) unlink(exDir, recursive = TRUE)
remote <- remotes:::github_remote(repo = repo, username = username, ref = ref, subdir = subdir, auth_token = auth_token)
tarFile <- remotes:::remote_download(remote)
untar(tarFile, exdir = exDir)
file.rename(list.files(exDir, full.names = TRUE)[1], file.path(exDir, packageName))
## TODO: addLocalPackage() does not add the dependencies of the locally built package!
addLocalPackage(packageName, exDir, ..., build = TRUE)
}
addPackageGitHub("user/repo", auth_token=github_token, path=miniCRAN_dir)
from minicran.
see devtools::install_remote()
to see how the package source bundle is downloaded. from there, #23's addLocalPackage
can take over
from minicran.
@msteijaert
I resolved a file path error by setting mode = "wb"
in download.file()
. Thank you, for the function.
OS: Windows 7
R: 3.4.4
from minicran.
@msteijaert's code doesn't work anymore. I get the error Error: No files found in path with extension '.tar.gz'
from minicran.
@msteijaert thank you for taking a first crack at this. I've implemented a version of your function on the 50-addPackageGitHub
branch, though it needs work. See the commit message there.
@msteijaert's code doesn't work anymore. I get the error
Error: No files found in path with extension '.tar.gz'
Can you post the code you used? I can't reporduce the error.
from minicran.
Are there any concrete plans on adding this feature, or is it more of a "long term wish list"?
from minicran.
Related Issues (20)
- Suggestion: Hide dependencies for some R packages in `plot.pkgDepGraph()` HOT 2
- Use github actions instead of Travis
- Installation on R < 4.0 HOT 2
- Remove dependency on curl
- Incorrect identification of packages with checkVersions() HOT 2
- Vignette for using BioConductor needs update. HOT 3
- addLocalPackage() gives error HOT 2
- Support mac.binary.big-sur-arm64 HOT 5
- Add packages to repository from GitHub (or other remotes) HOT 1
- Rename master branch to main
- Fix R-CMD-check failures
- Installation fails due to lazy load in R 4.1.3 HOT 3
- UpdatePackages function with UNC paths HOT 1
- Don't redownload packages that are already on the repo HOT 2
- Controling arg `recursive` passed to tools::package_dependencies() HOT 1
- Why I cannot install my own package I've created? HOT 1
- miniCRAN::makeRepo downloads R-devel version of a package HOT 1
- Get ready for CRAN release v0.3 HOT 2
- Error when creating repo HOT 2
- Pass on `filters` argument to `pkgAvail()` in `makeRepo()` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minicran.