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

feat!: allow overwriting rextendr templates by use_extendr #292

Merged
merged 26 commits into from
Jun 28, 2023

Conversation

eitsupi
Copy link
Contributor

@eitsupi eitsupi commented Jun 25, 2023

Resolve #275

This PR allows the use_extendr function to overwrite existing templates.
If it is not an interactive session, skip without overwriting.

@eitsupi eitsupi changed the title feat: allow overwrite rextendr templates feat!: allow overwrite rextendr templates Jun 25, 2023
@eitsupi eitsupi force-pushed the update-template branch 2 times, most recently from 6774ef9 to c035b87 Compare June 25, 2023 12:45
@eitsupi eitsupi marked this pull request as ready for review June 25, 2023 13:04
@eitsupi
Copy link
Contributor Author

eitsupi commented Jun 25, 2023

@JosiahParry Could you take a look at this?

Copy link
Member

@Ilia-Kosenkov Ilia-Kosenkov left a comment

Choose a reason for hiding this comment

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

Please also update NEWS.md since it is a significant change of the behavior.

R/use_extendr.R Outdated Show resolved Hide resolved
R/use_extendr.R Outdated Show resolved Hide resolved
R/use_extendr.R Outdated Show resolved Hide resolved
R/use_extendr.R Outdated Show resolved Hide resolved
tests/testthat/test-use_extendr.R Outdated Show resolved Hide resolved
@eitsupi
Copy link
Contributor Author

eitsupi commented Jun 25, 2023

Please also update NEWS.md since it is a significant change of the behavior.

I think I have already done that.

@Ilia-Kosenkov
Copy link
Member

I think I have already done that.

Sorry, sometimes I am just blind to the things I see in front of me :)

@eitsupi eitsupi changed the title feat!: allow overwrite rextendr templates feat!: allow overwriting rextendr templates by use_extendr Jun 25, 2023
@eitsupi eitsupi marked this pull request as draft June 26, 2023 02:27
@eitsupi eitsupi marked this pull request as ready for review June 26, 2023 03:21
@JosiahParry
Copy link
Contributor

I can give this a review tomorrow!

R/use_extendr.R Outdated Show resolved Hide resolved
@JosiahParry
Copy link
Contributor

This is the behavior I received with your new branch! I quite like it. At first I hesitated with not having an overwrite argument, but it would be really terrible to not realize your lib.rs got overwritten as well.

image

I would, personally, like for there to be a use_makevars() function or similar so that those files can be updated. I will make a new issue for it.

@eitsupi
Copy link
Contributor Author

eitsupi commented Jun 27, 2023

Thanks for reviewing this.

Yeah, overwriting lib.rs and Cargo.toml is not ideal.
I considered skipping these by default, but I think we should keep the option given the package renaming.

I would, personally, like for there to be a use_makevars() function or similar so that those files can be updated. I will make a new issue for it.

Creating a separate function may be excessive; how about adding an option to use_extendr so that the behavior can be changed to use only those files?

@JosiahParry
Copy link
Contributor

...how about adding an option to use_extendr so that the behavior can be changed to use only those files?

My hesitancy here is that once you start adding too many option to a function it becomes a bit like a magical cauldron that needs special incantations to work how you want it--i.e. the purpose becomes less straight forwrd.

Alternatively, rextendr:::use_rextendr_template() could be made part of the public API so that template files are easier to use.

@JosiahParry
Copy link
Contributor

Once the typo in the doc is fixed and regenerated in the man page I think its good to go!

Copy link
Contributor

@JosiahParry JosiahParry left a comment

Choose a reason for hiding this comment

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

I "approve" this PR! Looks quite good.

@JosiahParry
Copy link
Contributor

I'm not able to actually approve so I'm putting up the bat signal @Ilia-Kosenkov

@CGMossa
Copy link
Member

CGMossa commented Jun 27, 2023

I'll review it then; @JosiahParry you should be able to approve.. We'll investigate that too...

@eitsupi
Copy link
Contributor Author

eitsupi commented Jun 27, 2023

Approval itself can be done by anyone (There is a repository option to disallow it), but the green check is only given to approvals by those who have the permission to merge, I think.

Copy link
Member

@CGMossa CGMossa left a comment

Choose a reason for hiding this comment

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

This is a lot. LGTM. I'll wait for @Ilia-Kosenkov to give it a look. But @JosiahParry is a contributor as well, so this is approved.

@JosiahParry
Copy link
Contributor

Upon further review, why is the overwrite argument not provided? Rather it is inferred by interactive(). Could we, instead, have overwrite = NULL as the default argument so that it asks you by default. Then users can provide the option if they so desire

@Ilia-Kosenkov
Copy link
Member

If there are still comments, I will merge as soon as they are resolved.

@eitsupi
Copy link
Contributor Author

eitsupi commented Jun 28, 2023

Upon further review, why is the overwrite argument not provided? Rather it is inferred by interactive(). Could we, instead, have overwrite = NULL as the default argument so that it asks you by default. Then users can provide the option if they so desire

Indeed, it is annoying to be asked several times if we want to overwrite. I have updated it.

@eitsupi eitsupi requested a review from CGMossa June 28, 2023 11:07
@JosiahParry
Copy link
Contributor

JosiahParry commented Jun 28, 2023

@Ilia-Kosenkov all resolved

... image

@Ilia-Kosenkov Ilia-Kosenkov merged commit 84687c1 into extendr:main Jun 28, 2023
@eitsupi eitsupi deleted the update-template branch June 28, 2023 14:00
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.

Make renaming rextendr package easy
4 participants