Skip to content
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

Error: project name with hyphen and underscore #36

Closed
diengiau opened this issue Nov 15, 2017 · 5 comments
Closed

Error: project name with hyphen and underscore #36

diengiau opened this issue Nov 15, 2017 · 5 comments

Comments

@diengiau
Copy link

Hi, thank you for your package. Today I got an error when I tried to create a new package with underscore or hyphen, as below:

pRojects::createTrainingProject(name = "sample-one", 
dirs = c("data", "handouts", "slides"), 
handoutEngine = "rmarkdown", 
slideEngine = "rmarkdown", 
travis = F, packrat = F, git = F, readme = TRUE)
#> Creating skeleton
#> Error: sample-one is not a valid package name: it should contain only
#> ASCII letters, numbers and dot, have at least two characters
#> and start with a letter and not end in a dot.

This code created an empty folder with the name sample-one. Do you have any idea? Sometimes, it is inconvenient without the hyphen to name a project. Now my solution is a name without the hyphen first, then rename it later.

@stephlocke
Copy link
Member

Because we use the R package capability to manage dependencies, the R package naming rules apply. These are:

  • only (ASCII) letters, numbers and dot
  • have at least two characters
  • start with a letter and not end in a dot

We should probably have some sort of rollback so that it doesn't leave a partial implementation on the file system and some validation on the name to reduce confusion and errors. I'll raise separate tickets for these. I hope the above info helped and if you'd like to work on making it easier for other users we happily accept Pull Requests and offer mentoring through the process if you haven't made changes to an R package on github before.

@diengiau
Copy link
Author

After reading your answer and R Package book again, I understood the error. Because you use the R package to create the new project, I have no idea how to deal with this name rule. Anyway, I think your package approach has some advantages (e.g., dependencies as you mentioned). I will start to use package rather than a folder structure as in ProjectTemplate. Thank you for your explanations.

@stephlocke
Copy link
Member

In terms of a name that satisfies the use of a delimiter between terms and the package rules, you could run pRojects::createTrainingProject("sample.one")

In terms of making things more user friendly in the long run, we could cleanse the name so it satisfies folder name conventions and package name conventions in the DESCRIPTION. Do you think them differing would you cause you difficulties?

@diengiau
Copy link
Author

Yes, I just want to create a project's name that easy to read. So it's a good idea to use sample.one . Thank you for your suggestion.

@stephlocke
Copy link
Member

Awesome, sorry the error was unclear and we've got stuff on the TODO to try and improve the experience for folks. Please feel free to provide Issues with bugs or feedback and, of course, if you wanna make some changes yourself please feel to tackle an issue and submit a PR. We'll also offer help along the way if you need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants