KentonWhite / ProjectTemplate

A template utility for R projects that provides a skeletal project.
http://projecttemplate.net
GNU General Public License v3.0
623 stars 159 forks source link

Creates RProj template based on standard RStudio generated file. #202

Closed rsangole closed 6 years ago

rsangole commented 7 years ago

I've created an example of what the 'rstudio' template should look like. Basically, it's a copy of the defaults/full with the addition of the default .RProj file created by RStudio. In my example, it has been named RStudio_Project_Name.Rproj, but in implementation, the project name must match the folder name, in our case, the project name supplied to create.project().

We will have to programmatically create the .RProj file. I propose we finally address the issue that was brought up in #36. With the advent of newer templates, it would benefit changing minimal to template.name. Else, in the short term, might want to add rstudio = FALSE to the create.project() argument list?

Traditionally, RStudio does the following activities on the creation of a new project: [copied from link ]

When a new project is created RStudio:

  • Creates a project file (with an .Rproj extension) within the project directory. This file contains various project options (discussed below) and can also be used as a shortcut for opening the project directly from the filesystem.
  • Creates a hidden directory (named .Rproj.user) where project-specific temporary files (e.g. auto-saved source documents, window-state, etc.) are stored. This directory is also automatically added to .Rbuildignore, .gitignore, etc. if required.

My intent is to not do anything about point 2. If directory .Rproj.user and it's contents are missing, RStudio automatically creates it the first time the project is loaded.

KentonWhite commented 7 years ago

Thanks @rsangole! I'll look into adding to this to integrate the .Rproj file in the the create.project() function.

rsangole commented 7 years ago

Thanks @KentonWhite , let me know if there's any further contributions I can make.

rsangole commented 7 years ago

Hi @KentonWhite, just following up on this request. If I can help in any way, do let me know, cheers!

KentonWhite commented 7 years ago

Haven't forgotten about it @rsangole, but thanks for the reminder.

KentonWhite commented 7 years ago

Hi @rsangole -- a quick update on this PR.

Shortly after you submitted it, a ProjectTemplate dependency on CRAN broke the CRAN build. I've been working on getting that fixed and submitted before adding this PR. It looks like I should have that fire put out by end of this week. So sorry this is taking so long!

rsangole commented 7 years ago

Thanks for following up! I'll keep an eye out for further communication! Good luck!

rsangole commented 7 years ago

Hi Kenton, just following up again, cheers!

KentonWhite commented 7 years ago

@rsangole Almost done with it! Just working out some details of how we want the interface to work. I'll have a sample on my personal GitHub account for you to try later this week.

Hugovdberg commented 7 years ago

I would propose to not add a separate template template for RStudio, but simply add a sample file to the full template. Possibly we integrate renaming the file to the projectname, but that is no requirement. RStudio will always show the directory name as the project name, regardless of the .RProj filename. The implementation of #36 is actually done in #206.

KentonWhite commented 7 years ago

I think the request is creating the .RProj file as part of create.project(). Am I misunderstanding how this should work?

rsangole commented 7 years ago

@KentonWhite this is correct. We have a few options based on the messages above:

  1. Add a generic R_Project.Rproj file to the full template. As @Hugovdberg says, the name of the .Rproj doesn't have to be the folder name. It's just easier for the user if the names match.
  2. Add a generic R_Project.Rprojto the full template. In addition to this, modify the create.project() function to rename the .Rproj to the name of the project.

Both these options will always insert the .Rproj if a user uses full.

Alternatively:

  1. Add an option to create.project() asking user if he desires the .Rproj file at all.
KentonWhite commented 7 years ago

I already have the code working with Option 1. It's not hard to go with option 2 -- that was how I envisaged it. I'm also happy to support RStudio since this is becoming a very popular IDE.

rsangole commented 7 years ago

@KentonWhite Following up on this conversation. What's the consensus and next steps? Need anything from me?

KentonWhite commented 7 years ago

@rsangole I'll need you soon to check out my local branch and see if it works for you. I'll let you know shortly!

rsangole commented 7 years ago

Sure, thanks @KentonWhite

KentonWhite commented 6 years ago

I've merged in the custom template generation code. Is this still needed with those changes? Please let me know!

rsangole commented 6 years ago

I'll have to check this. I haven't used the custom template yet... how to I access that?

KentonWhite commented 6 years ago

The custom template code has been merged into ProjectTemplate on Github. You can get themes recent version using install.github(). Instructions are in #206.