ropenscilabs / deposits

R Client for access to multiple data repository services
https://docs.ropensci.org/deposits/
Other
37 stars 3 forks source link

restructure all service-specific code out of main functions #84

Closed mpadge closed 1 year ago

mpadge commented 1 year ago

... and into sub-functions containing in distinctly-named files. All in preparation for #41

mpadge commented 1 year ago

All service-specific functionality is now contained in the files named "service-*.R":

flist <- list.files ("./R", pattern = "^service")
print (flist, width = 20)
#> [1] "service-desc-meta.R"
#> [2] "service-functions.R"
#> [3] "service-methods.R"  
#> [4] "service-urls.R"

s <- pkgstats::pkgstats ()
objs <- s$objects [which (s$objects$file_name %in% paste0 ("R/", flist)), ]
serv_pc <- round (100 * sum (objs$loc) / sum (s$objects$loc), digits = 1L)
message ("service-specific code is ", serv_pc, "%")
#> service-specific code is 8.3%

Created on 2023-06-14 with reprex v2.0.2

That is < 10% of all code, so should now be pretty easy to integrate additional services.


EDIT: Additional service-specific functions are also in:

That makes 9 files in total which have to be modified. But those latter five are all for specific methods, and should generally be fairly straightforward. I think this can be left for now, and maybe modified, improved, or streamlined while addressing #41.