extendr / rextendr

An R package that helps scaffolding extendr-enabled packages or compiling Rust code dynamically
https://extendr.github.io/rextendr/
Other
196 stars 28 forks source link

Use templates in `use_extendr()` #106

Closed malcolmbarrett closed 3 years ago

malcolmbarrett commented 3 years ago

This PR refactors use_extendr() a bit more to use templates in the style of usethis::use_template(). When usethis is available, we just use that, and when it's not, we use a simplified version (use_template() is more robust but some of the protections that it has aren't strictly necessary here since we don't write at all if there are pre-existing files).

Using this approach is more consistent with usethis, but I also find that templates are much easier to understand and maintain than hard-coded text in code.

This PR also adds mockr to Suggests to enable mocking of functions in tests.

Finally closes #62

clauswilke commented 3 years ago

Let me know when this is ready to review and I'll take a look then. One more week of classes and then I'll be able to focus a bit more on rextendr again, and hopefully submit to CRAN.

malcolmbarrett commented 3 years ago

Thanks! Ready to review. Had some weird issues with line endings on Windows, but it's resolved.

That sounds great! Good luck with the end of the semester

clauswilke commented 3 years ago

@Ilia-Kosenkov If you have reviewed this carefully and are happy with it then please approve. I don't want to hold this up.

Ilia-Kosenkov commented 3 years ago

@clauswilke, it seems Ok to me. However, I would like to ask @malcolmbarrett to update our guidelines with info on snapshot testing and templates. Perhaps, as a follow-up PR.

Ilia-Kosenkov commented 3 years ago

@malcolmbarrett, should I merge this?