-
Notifications
You must be signed in to change notification settings - Fork 9
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
simplify factory interaction with Github #86
Comments
Hi Neale There's an argument to to new_factory(use_rproj = FALSE) Does that do what you want? Also note that there is a similar |
Hi Tim, I hope I've missed something simple, but setting these arguments to FALSE does not seem to create a viable factory. I keep getting this I also tried As I look into the code of the reportfactory functions, I can see that callr::r is used in If you think this warrants a quick call I am available. Or, let me know if you suggest I just accept that the factory will be a subfolder within the root. thanks, |
I'll dig in to this now. Can you post the result of |
Hi Neale, please install the latest version from GitHub. I've change the example report as for multiple reasons this was causing an issue. This should all work now but I'll keep this issue open for you to confirm. Happy to jump on a call if not resolved. Cheers |
Thanks for these tips/corrections Tim. For posterity, here is the procedure that worked for me (I will eventually add this to the Handbook):
Thanks for your help! |
I could see a "convert" functionality that does this cut/paste for you as a useful feature request. |
Let me reread your comments and digest this a bit more as that seems far too convoluted. Will DM you about a call next week as this should be as simple as creating a new factory and running something like use_git within it (although maybe I'm misunderstanding your use case). |
Great, thanks Tim. Yes I think something with use_git() and use_github() could help. |
Hi Tim,
I am trying to create a Github repo that consists only of the contents of a report factory, but am struggling. To me this seems to be a natural use-case for reportfactory. It seems that there should be a more simple way to achieve this (perhaps an option to "convert" an existing R project into a factory, instead of creating a new factory folder within it?).
Below is an example of the desired structure of the repo (note that there is one R project file, and the report_sources and outputs folders are also in the root with the R project file).
Rproject file
report_sources folder
outputs folder
data folder
scripts folder
.gitignore
.here
factory_config
README
etc.
I assumed (and I think many would) that I could begin an R project locally, create a factory, and sync with Github fairly easily to achieve a repo structure like the above. There were a few barriers:
As we know, the default behavior of reportfactory is to create a folder within the working directory that contains the factory (including R project file, sources and outputs folders, etc.). Thus, if you follow these instructions to link an R project and Github repo (New project, Github first) you create a repo and clone it locally by creating a new R Project with version control and entering the .git address. However this means that when you subsequently create a reportfactory in this R project, there will be two R projects! One for the original repo, and one within a folder that is the reportfactory. Not ideal. Aiming for the simple structure above with only one R project file.
So, I tried an alternative method of linking a project to Github (Existing Project, Github last). This involves making an R project that is not linked to Git or Github, then creating a report factory, and then linking it to Github with
usethis::use_git()
and usethis::use_github()` (as explained in the weblink above). This does not solve the underlying problem because there are still two R projects.I also tried to modify the
path =
argument in thenew_factory()
command, thinking that I could just provide a directory one level higher (path = "C://..."
) and get only the factory where I wanted it (then link this existing report factory R project to a new Github repo usingusethis
as above). This was a disaster as somehow the name of this new factory became "report_sources"! When I manually changed the name to be more appropriate, no reports would compile because it "Expected the name of the factory to be "report_sources" ").This is the approach that (almost) worked:
setwd(utils::choose.dir())
to interactively set the working directory). Then I ranreport_factory::new_factory()
. Voila, I had a local reportfactory where I wanted it, with only one R project. Now, following the instructions above, I created an empty Github repository, ranusethis::use_git()
to get a Git pane in RStudio in that local project, then assigned the remote origin:Finally I had to do a bit of dancing (make a branch, push apparently no commits up, and then PR the branch into main), but I achieved a remote "test" branch that looked like this (exactly what I wanted!):
But when I tried to PR into main... it fell apart again:
I tried to compile a report locally to see if at least that would work? Sadly not.
So, I guess this is a call for help. I hope there's something I missed. How would you go about this?
Much thanks!
Neale
The text was updated successfully, but these errors were encountered: