hoxo-m / githubinstall

A Helpful Way to Install R Packages Hosted on GitHub
http://hoxo-m.github.io/githubinstall/
Other
48 stars 12 forks source link

githubinstall from a specific branch #6

Closed ivanhanigan closed 8 years ago

ivanhanigan commented 8 years ago

Hi, sorry if this is already possible, I could not see it. for example I use

library(devtools)
install_github("swish-climate-impact-assessment/awaptools", ref = "develop")

to install the development version

hoxo-m commented 8 years ago

Thank you for your question. It is possible, but not write in the document.

library(githubinstall)
githubinstall("awaptools[develop]")
teramonagi commented 8 years ago

I think that the way which @ivanhanigan pointed out sounds more natural. If you don't mind, can I make the PR for this extension?

hoxo-m commented 8 years ago

We must consider to treat branch, commit, tag and subdirectory. I worry about increasing parameters or complexity.

teramonagi commented 8 years ago

ivanhanigan might want to have the same functionality with `install_github in devtools package.

It has ref argument to specify the branch of a package.

ivanhanigan commented 8 years ago

I think the current syntax is fine and if in documentation there is no worries. However I tried this and got an error:

> library(githubinstall)
> githubinstall("awaptools[develop]")
Suggestion:
 - swish-climate-impact-assessment/awaptools[develop]
Do you install the package? 

1: Yes (Install)
2: No (Cancel)

Selection: 1
Error in sprintf("Installing master branch of \"%s\", but already installed \"%s\" branch.",  : 
  object 'repo' not found
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.8 (Final)

locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C               LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8    LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] githubinstall_0.0.1

loaded via a namespace (and not attached):
 [1] httr_1.1.0       magrittr_1.5     R6_2.1.2         tools_3.2.3      curl_0.9.7       stringi_1.0-1    data.table_1.9.6
 [8] git2r_0.14.0     stringr_1.0.0    jsonlite_0.9.19  chron_2.3-47     ghit_0.2.5    
hoxo-m commented 8 years ago

That's a bug! Please first remove the package, and try it again.

remove.packages("awaptools")
githubinstall("awaptools[develop]")
hoxo-m commented 8 years ago

@teramonagi Thank you for the suggestion. I think I'll add argument for branch in next version and write in document.

ivanhanigan commented 8 years ago

that worked.

finished with

** testing if installed package can be loaded
* DONE (awaptools)
1): succeeded '/usr/lib64/R/bin/R CMD INSTALL -l '/home/ivan_hanigan/R/x86_64-redhat-linux-gnu-library/3.2' //tmp/RtmpvANESZ/ghitdrat/src/contrib/awaptools_1.2.2.tar.gz'

The downloaded source packages are in
    ‘/tmp/RtmpvANESZ/downloaded_packages’
swish-climate-impact-assessment/awaptools[develop] 
                                           "1.2.2" 

thankyou

hoxo-m commented 8 years ago

Added ref argument. You can specify ref by the same way on devtools::install_github().

9 fixed bugs and added test for ref.

I will add about it in the documents.

hoxo-m commented 8 years ago

Adopted version 0.1.0 has released. https://github.com/hoxo-m/githubinstall/releases/tag/v0.1.0