.gitignore inside .Rprofile.d
Disclaimer: I just recently started using your package. I find it really great, and I'm still getting the hang of it.
I have setup my local ~/.Rprofile.d
And then I added a project one .../my-project/.Rprofile.d
The project profile has:
-
0-local-profile.Rwhich handles what's found in~/.Rprofile.d -
1-proj-profile.Rself contained profile -
.gitignoreto ignore the first0-local-profile.R
So the issue is that startup() cannot process .gitignore because it is not an R-profile.
And I have two questions:
- What other way is there to handle project and local profiles in parallel?
- Is there a way to make this setup work, and ask
startup()to simply ignore.gitignore?
Thank you.
Does startup::startup(all=TRUE) provide what you need?
I don't understand the .gitignore part
Thank you for your answer. I'll write in three bullets:
- Explain what I mean with
.gitignore. - Tell you about a workaround I found.
- If you still want to get to the bottom, I'll comment on parameters
all=TRUE,paths=c(...)
- In the vignette, you mention that file ending with
*\.(txt|md|~),*\.(Rhistory|RData|DS_Store)or starting with\.\.*are ignored. I'm thinking along the lines of ignoring.gitignoreas well.
I'll make a case, with a -hopefully- simple example.
# ~/.Rprofile
print("My local functions, which other developers don't need or even use.")
print("May include fortunes:fortune(), or set local repository")
# my-proj/R-src/.Rprofile.d/0-local.R
source(~/.Rprofile)
print("I thought to call them here, since I set up my proj profile.")
# my-proj/R-src/.Rprofile.d/1-package.R
proj_function <- function(x) print("Project uses this function.")
# my-proj/R-src/.Rprofile.d/.gitignore
0-local.R
This last file throws an error as it is in .Rprofile.d
- The workaround is to ignore
0-local.Rfrom an outer.gitignore
# my-proj/R-src/.gitignore
.Rprofile.d/0-local.R
This is very close to ideal, so happy to live with that.
- Going back to the ideal solution, I didn't find how to make
all=TRUEhelp.
But partially found the following does: (usingmagrittrpipes)
"my-proj/R-src/.Rprofile.d" %>%
list.files(all.files=TRUE, full.names=TRUE) %>%
str_subset("/\\.", negate=TRUE) %>% # Includes /.gitignore and others.
rprofile_d(paths=.)
I mean partially, because I can only call rprofile_d like this, but not startup.
So one final question, and one proposal:
i) Is there a parameter to ignore other files (like *.(txt|md|~)?
ii) if you think the .gitignore case is a strong one, I can look into the code and try a Pull Request.
Thank you =D
This should be fixed in startup (>= 0.21.0-9010).