lockedata / tfsR

R Package 📦 to Work with the TFS (git) source control system in R :seedling:
http://lockedata.github.io/tfsR
Other
8 stars 3 forks source link

Add an install_tfs() function #2

Open stephlocke opened 8 years ago

stephlocke commented 8 years ago

Add a function for installing a package from tfs, similar to devtools::install_github()

robertdj commented 7 years ago

Thank you for making this package.

Packages can be installed as follows:

cred <- git2r::cred_user_pass(username = "", password = "<token>")
devtools::install_git("https://<domain>.visualstudio.com/<project>/_git/<repo>", credentials = cred)

Do you want to implement it or should I open a PR?

stephlocke commented 7 years ago

PR please 😍

stephlocke commented 7 years ago

Ideally, this'll need some unit tests n stuff - give me a shout if/when you get to needing a repo for the unit tests and I'll add an R package repo into my test VSTS instance :)

And of course, if you want to bounce ideas off me or need a hand before then - feel free to get in touch

robertdj commented 7 years ago

I'll make a PR, but it might take a couple of days/a week.

I don't have access to a public repo on VSTS, so it would be great if you can provide one :-)

Edit: Can I just reuse the token from https://github.com/stephlocke/tfsR/blob/master/tests/testthat/test-TFSAuth.R

stephlocke commented 7 years ago

Yep you can - I think you can push code to a repo (so you can make a dummy package for unit tests) using those creds but let me know if not.

robertdj commented 7 years ago

Nice. Regarding the function signature, do you prefer to enter https://<domain>.visualstudio.com/<project>/_git/<repo> or https://<domain>.visualstudio.com as tfs as in your other functions and then project and repo?

stephlocke commented 7 years ago

Great question!

I'd love for the function to work as much like install_github as possible but we have a few more moving parts.

What do you think would be the most usable option?

robertdj commented 7 years ago

I prefer the latter.

robertdj commented 7 years ago

Actually, I've changed my mind. The URL of the "code" part of a repo is the the one that should be passed to devtools::install_git, so I think that's the better option.

robertdj commented 7 years ago

@stephlocke Can you post the URL of a test repo?

stephlocke commented 7 years ago

Here ya go https://stephlocke.visualstudio.com/DefaultCollection/_git/tfsr3

robertdj commented 7 years ago

I can't make it work... R just hangs. Can you try the two commands I provided with the token from the other test file?

stephlocke commented 7 years ago

I do & get

cred <- git2r::cred_user_pass(username = "tfsRtesting", password = "fz43enydh7vi2o6jqir2gmftohh7ooz2lizqvy6jxtw4ltrpwola")
devtools::install_git("https://stephlocke.visualstudio.com/DefaultCollection/_git/tfsr3", credentials = cred)
## Downloading git repo https://stephlocke.visualstudio.com/DefaultCollection/_git/tfsr3
## Installation failed: Error in 'git2r_clone': too many redirects or authentication replays
robertdj commented 7 years ago

Hmm... That's weird. I don't recall having any problems. I'll have another look at the site I have access to.

robertdj commented 7 years ago

Now I can't make it work either..! Although I get a different error

Installation failed: Error in 'git2r_clone': failed to set credentials: The parameter is incorrect.

I have to dig some more, but I don't really have a time estimate.

stephlocke commented 7 years ago

No worries - you're doing work on this in your spare time! Any time you donate is amazing 🥇

stephlocke commented 7 years ago

Also - they're doing some stuff with ssh urls so it's possible we're just doing stuff at a bad time where links and auth are being a bit iffy

robertdj commented 7 years ago

Good point about the ssh urls -- I did get an email about ssh keys, but didn't make the connection to this problem.

robertdj commented 7 years ago

Now the devtools approach work for me again in "my" repository -- if I add my corporate email as username. Does that approach work for any of your repos?