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

Rationalize nested projects #1647

Merged
merged 4 commits into from
Jun 14, 2022
Merged

Rationalize nested projects #1647

merged 4 commits into from
Jun 14, 2022

Conversation

jennybc
Copy link
Member

@jennybc jennybc commented Jun 10, 2022

Closes #1643

We discourage nested projects, but it is possible, mostly for developers. So we should at least behave correctly in this code path.

Previously, a nested project would put the name of the parent project in DESCRIPTION, which causes a variety of downstream problems. The .Rproj file gets the wrong name. Every call to project_name() returns the wrong name.

Also, when proj_set(force = TRUE), we should bypass the initial early return if we discover that we are already in a project. The whole point of force = TRUE is to do exactly as we are told. This was causing the active project to be still be set to the parent, when trying to work with a nested project.

Closes #1643

We discourage nested projects, but it is possible, mostly for developers. So we should at least behave correctly in this code path.

Previously, a nested project would put the name of the parent project in DESCRIPTION, which causes a variety of downstream problems.
@jennybc jennybc requested a review from lionel- June 10, 2022 17:16
@jennybc
Copy link
Member Author

jennybc commented Jun 10, 2022

@lionel- I think this should solve your problem and this is my preferred solution.

Copy link
Member

@lionel- lionel- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Does this still prompt users about nested projects? If yes, could you also take a look at the undocumented option added in the other PR please?

Useful in tests (replaces the mock) and also to a developer, like @lionel-, who might need to do this often enough to set the option.
@jennybc
Copy link
Member Author

jennybc commented Jun 13, 2022

Does this still prompt users about nested projects? If yes, could you also take a look at the undocumented option added in the other PR please?

OK now this PR will honour the undocumented option used in your PR (and I'm using that in the usethis tests instead of a mock).

@lionel-
Copy link
Member

lionel- commented Jun 14, 2022

Thanks!

@jennybc jennybc merged commit 334971a into main Jun 14, 2022
@jennybc jennybc deleted the easier-nested-projects branch June 14, 2022 18:13
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

Successfully merging this pull request may close these issues.

2 participants