-
Notifications
You must be signed in to change notification settings - Fork 1
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
start functionalizing make screenshots #153
Conversation
#' @param git_pat default is NULL; required argument; a Git secret | ||
#' @param repo default is NULL; required argument; GitHub repository name, e.g., jhudsl/OTTR_Template | ||
#' @param output_dir default is "resources/chapt_screen_images"; Output directory where the chapter's screen images should be stored | ||
#' @param base_url default is NULL; rendered bookdown URL where screenshots are taken from, if NULL, the function will use the repo_name and and git_pat to find the base_url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to edit this description to change it from the original in the script. How is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all the essentials are here! Only thing you could add if you wanted to be extra nice is a link to the page in GitHub about PATs: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
R/screenshot.R
Outdated
#' @param git_pat default is NULL; required argument; a Git secret | ||
#' @param repo default is NULL; required argument; GitHub repository name, e.g., jhudsl/OTTR_Template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the best way to communicate that these are required arguments, but by default NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just not have them be NULL if they are required because then it will automatically throw an error if no argument is provided. And docs wise the way you say its "required" is fine 👍
R/screenshot.R
Outdated
} | ||
|
||
if (is.null(base_url)){ | ||
base_url <- cow::get_pages_url(repo_name = repo, git_pat = git_pat) #what if these arguments are still NULL/not supplied? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to make this cow function part of ottrpal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! That's next up! It's mentioned in #137 but I didn't realize I didn't make it its own issue so there is one now: jhudsl/cow#27
|
||
message(paste("Image Chapter key written to: ", file.path(output_folder, "chapter_urls.tsv"))) | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I need to return something from this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think returning the file path to chapter_urls.tsv
makes sense.
pkgdown is failing because of trying to import cow as expected (and slacked) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good! 🎉 Some minor comments!
Is the unit test for this coming in a next PR?
R/screenshot.R
Outdated
#' @param git_pat default is NULL; required argument; a Git secret | ||
#' @param repo default is NULL; required argument; GitHub repository name, e.g., jhudsl/OTTR_Template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just not have them be NULL if they are required because then it will automatically throw an error if no argument is provided. And docs wise the way you say its "required" is fine 👍
#' @param git_pat default is NULL; required argument; a Git secret | ||
#' @param repo default is NULL; required argument; GitHub repository name, e.g., jhudsl/OTTR_Template | ||
#' @param output_dir default is "resources/chapt_screen_images"; Output directory where the chapter's screen images should be stored | ||
#' @param base_url default is NULL; rendered bookdown URL where screenshots are taken from, if NULL, the function will use the repo_name and and git_pat to find the base_url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all the essentials are here! Only thing you could add if you wanted to be extra nice is a link to the page in GitHub about PATs: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
R/screenshot.R
Outdated
} | ||
|
||
if (is.null(base_url)){ | ||
base_url <- cow::get_pages_url(repo_name = repo, git_pat = git_pat) #what if these arguments are still NULL/not supplied? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! That's next up! It's mentioned in #137 but I didn't realize I didn't make it its own issue so there is one now: jhudsl/cow#27
|
||
message(paste("Image Chapter key written to: ", file.path(output_folder, "chapter_urls.tsv"))) | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think returning the file path to chapter_urls.tsv
makes sense.
Thanks! And thanks for the comments and suggestions! They're very helpful
Yes, the unit test will be the next PR. Can you point me to any examples/guides you want me to follow for creating a good unit test? |
Co-authored-by: Candace Savonen <[email protected]>
For this PR my next steps will include addressing the suggestions/feedback here |
Latest commit addressed
|
copy over cow function to ottrpal
We updated the |
@cansavvy Given the R-CMD-check warnings about |
Yes this needs to be done. Probably transferring these at the same time makes sense. But probably in a next PR. 👍 |
Fixed the description file so now this is ready to merge! Next PR can include more unit tests for this! |
This PR begins implementing #145 by functionalizing
make_screenshots.R
, adding it toottrpal
.The approach I took was creating params based on the optparse options info in the script. I also carried over the functionality of the script. I'll leave a few comments with questions. Later stacked PRs will set up tests and update the base_ottr image and update
render_all.yml
as described in #145