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

287 add show repos and show commits user functions #292

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export(reset_language)
export(set_host)
export(set_team_member)
export(setup)
export(show_commits)
export(show_orgs)
export(show_repos)
importFrom(R6,R6Class)
importFrom(cli,cli_abort)
importFrom(cli,cli_alert_danger)
Expand Down
20 changes: 20 additions & 0 deletions R/gitstats_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,23 @@ reset_language <- function(gitstats_obj){
show_orgs <- function(gitstats_obj){
return(gitstats_obj$show_orgs())
}

#' @title Show repositories
#' @name show_repos
#' @description Prints repositories table pulled by `GitStats`.
#' @param gitstats_obj A GitStats object.
#' @return A table of repositories.
#' @export
show_repos <- function(gitstats_obj){
return(gitstats_obj$show_repos())
}

#' @title Show commits
#' @name show_commits
#' @description Prints commits table pulled by `GitStats`.
#' @param gitstats_obj A GitStats object.
#' @return A table of commits.
#' @export
show_commits <- function(gitstats_obj){
return(gitstats_obj$show_commits())
}
2 changes: 1 addition & 1 deletion devel/example_workflow.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ git_stats
# examples for getting repos (default search parameter is 'org')
get_repos(git_stats)
get_repos_contributors(git_stats)
dplyr::glimpse(git_stats$show_repos())
dplyr::glimpse(show_repos(git_stats))

get_repos(git_stats, add_contributors = TRUE)

Expand Down
17 changes: 17 additions & 0 deletions man/show_commits.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions man/show_repos.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion tests/testthat/test-show.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
test_gitstats <- create_test_gitstats(hosts = 2)

test_that("show_orgs() shows orgs", {
test_gitstats <- create_test_gitstats(hosts = 2)
expect_equal(
show_orgs(test_gitstats),
c("r-world-devs", "openpharma", "mbtests")
)
})

test_that("show_repos() shows repos table", {
test_gitstats$.__enclos_env__$private$repos <- test_mocker$use("gh_repos_table")
repos_table <- show_repos(test_gitstats)
expect_repos_table(repos_table)
})

test_that("show_commits() shows commits table", {
test_gitstats$.__enclos_env__$private$commits <- test_mocker$use("commits_table")
commits_table <- show_commits(test_gitstats)
expect_commits_table(commits_table)
})
Loading