diff --git a/.Rbuildignore b/.Rbuildignore index 931662b..49862c2 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,5 @@ ^.*\.Rproj$ ^\.Rproj\.user$ ^README\.Rmd$ +^\.travis\.yml$ +^codecov\.yml$ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..eba8c65 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r + +language: R +cache: packages diff --git a/DESCRIPTION b/DESCRIPTION index 18bd3e0..03bf40e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,11 @@ Package: gitear Title: Client to the 'gitea' API -Version: 0.0.4 +Version: 1.0.0 Authors@R: c( person(family="ixpantia, SRL", role = "aut", email = "hola@ixpantia.com"), person("Frans", "van Dunné", role=c("cre", "aut"), email="frans@ixpantia.com"), person("Francisco", "Sácida", role="aut", email="francisco@delaguayaba.com"), - person("Ronny", "Hernández Mora", role="ctb", email="ronny@ixpantia.com")) + person("Ronny", "Hernández Mora", role="aut", email="ronny@ixpantia.com")) Description: 'Gitea' is a community managed, lightweight code hosting solution were projects and their respective git repositories can be managed . This package gives an interface to the 'Gitea' API to @@ -17,8 +17,10 @@ Imports: License: MIT + file LICENCE Encoding: UTF-8 LazyData: true -Suggests: testthat, +Suggests: + testthat, knitr, - rmarkdown + rmarkdown, + covr RoxygenNote: 7.0.2 VignetteBuilder: knitr diff --git a/README.Rmd b/README.Rmd index d30af87..55b6deb 100644 --- a/README.Rmd +++ b/README.Rmd @@ -11,12 +11,16 @@ knitr::opts_chunk$set( fig.path = "man/figures/README-", out.width = "100%" ) +library(gitear) +library(dplyr) ``` # gitear [![CRAN status](https://www.r-pkg.org/badges/version/gitear)](https://cran.r-project.org/package=gitear) +[![Travis build status](https://travis-ci.org/ixpantia/gitear.svg?branch=master)](https://travis-ci.org/ixpantia/gitear) +[![Codecov test coverage](https://codecov.io/gh/ixpantia/gitear/branch/master/graph/badge.svg)](https://codecov.io/gh/ixpantia/gitear?branch=master) The goal of gitear is to request your self-hosted Git service data and import @@ -52,5 +56,30 @@ issues <- get_issues(base_url = url_ixpantia, repo = "ixmandash") ``` +## **Environmental variables:** + +In order to work with environmental variables to make your scripts safer from +somebody getting your credentials, you can follow the next workflow: + + 1- Create an .Renviron file with your credentials + 2- Restart your R session + 3- Store your credentials in an object for using it in your script + +Your script could look something like this: + +```{r} +# Storing credentials in an object +example_key <- Sys.getenv("example_key") +example_url <- Sys.getenv("example_url") + +# Using a function from gitear +issues <- get_issues(base_url = example_url, + api_key = example_key, + owner = "ixpantia", + repo = "lacrmr") + +# Check the output +glimpse(issues) +``` diff --git a/README.md b/README.md index 6e6066b..373d2ac 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,10 @@ [![CRAN status](https://www.r-pkg.org/badges/version/gitear)](https://cran.r-project.org/package=gitear) +[![Travis build +status](https://travis-ci.org/ixpantia/gitear.svg?branch=master)](https://travis-ci.org/ixpantia/gitear) +[![Codecov test +coverage](https://codecov.io/gh/ixpantia/gitear/branch/master/graph/badge.svg)](https://codecov.io/gh/ixpantia/gitear?branch=master) The goal of gitear is to request your self-hosted Git service data and @@ -43,3 +47,41 @@ issues <- get_issues(base_url = url_ixpantia, owner = "ixpantia", repo = "ixmandash") ``` + +## **Environmental variables:** + +In order to work with environmental variables to make your scripts safer +from somebody getting your credentials, you can follow the next +workflow: + +1- Create an .Renviron file with your credentials 2- Restart your R +session 3- Store your credentials in an object for using it in your +script + +Your script could look something like this: + +``` r +# Storing credentials in an object +example_key <- Sys.getenv("example_key") +example_url <- Sys.getenv("example_url") + +# Using a function from gitear +issues <- get_issues(base_url = example_url, + api_key = example_key, + owner = "ixpantia", + repo = "lacrmr") + +# Check the output +glimpse(issues) +#> Observations: 4 +#> Variables: 9 +#> $ number 38, 26, 24, 15 +#> $ title "lacrmr dejó de funcionar porque llave está deshabilitad… +#> $ created_date "2020-01-25", "2019-05-03", "2019-05-03", "2019-02-07" +#> $ created_time "00:45:48", "22:28:41", "21:28:00", "19:55:19" +#> $ updated_date "2020-01-25", "2020-01-24", "2019-05-03", "2020-01-24" +#> $ updated_time "00:45:52", "22:03:13", "21:28:14", "22:03:23" +#> $ due_date NA, NA, NA, NA +#> $ author "ronny", "ronny", "ronny", "ronny" +#> $ assignee "ronny", "ronny", "ronny", "ronny" +``` diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..8f36b6c --- /dev/null +++ b/codecov.yml @@ -0,0 +1,12 @@ +comment: false + +coverage: + status: + project: + default: + target: auto + threshold: 1% + patch: + default: + target: auto + threshold: 1% diff --git a/docs/articles/Access-diff-issues-on-diff-instances.html b/docs/articles/Access-diff-issues-on-diff-instances.html index 9280f8b..b5d928b 100644 --- a/docs/articles/Access-diff-issues-on-diff-instances.html +++ b/docs/articles/Access-diff-issues-on-diff-instances.html @@ -78,7 +78,7 @@

Access different issues of different instances

ixpantia

-

2020-02-01

+

2020-02-09

@@ -92,51 +92,50 @@

2020-02-01

Get information about your issues of differents instances

The figure sizes have been customised so that you can easily put two images side-by-side.

- + diff --git a/docs/articles/Access-gitea-from-R.html b/docs/articles/Access-gitea-from-R.html index ddc720d..6095a7b 100644 --- a/docs/articles/Access-gitea-from-R.html +++ b/docs/articles/Access-gitea-from-R.html @@ -78,7 +78,7 @@

Access Gitea from R

ixpantia

-

2020-02-01

+

2020-02-09

@@ -96,20 +96,78 @@

Be aware that you should save this token somewhere because its shown just once.

This is going to be your API TOKEN.

Then you can use a function like this:

- + +

For the examples below, we are going to use credentials stored in a .Renviron file, which we are going to call from this variables:

+ -
+

-Get information about your projects

- +Get information about your organization

+ + +
+

+Get info from one project

+
repos <- get_list_repos_org(base_url = example_url, 
+                   api_key = example_key, 
+                   org = "ixpantia")
+
+glimpse(repos)
+#> Observations: 15
+#> Variables: 33
+#> $ id                          <int> 52, 63, 93, 159, 144, 65, 146, 139, 62, 1…
+#> $ owner                       <df[,10]> <data.frame[15 x 10]>
+#> $ name                        <chr> "ixcom", "lacrmr", "ixblog", "ixtiempo", …
+#> $ full_name                   <chr> "ixpantia/ixcom", "ixpantia/lacrmr", "ixp…
+#> $ description                 <chr> "Website principal de ixpantia en www.ixp…
+#> $ empty                       <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,…
+#> $ private                     <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,…
+#> $ fork                        <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,…
+#> $ parent                      <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
+#> $ mirror                      <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,…
+#> $ size                        <int> 34271, 1952, 34431, 0, 1852, 3008, 272, 2…
+#> $ html_url                    <chr> "https://secure.ixpantia.com/ixpantia/ixc…
+#> $ ssh_url                     <chr> "git@secure.ixpantia.com:ixpantia/ixcom.g…
+#> $ clone_url                   <chr> "https://secure.ixpantia.com/ixpantia/ixc…
+#> $ website                     <chr> "", "", "", "", "", "", "", "", "", "", "…
+#> $ stars_count                 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
+#> $ forks_count                 <int> 2, 2, 3, 1, 1, 4, 3, 1, 3, 2, 1, 0, 0, 2,…
+#> $ watchers_count              <int> 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,…
+#> $ open_issues_count           <int> 13, 4, 12, 0, 4, 10, 3, 0, 9, 5, 1, 3, 3,…
+#> $ default_branch              <chr> "master", "master", "master", "master", "…
+#> $ archived                    <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,…
+#> $ created_at                  <chr> "2019-01-03T23:09:59Z", "2019-01-31T21:12…
+#> $ updated_at                  <chr> "2020-02-01T09:25:04Z", "2020-01-24T22:57…
+#> $ permissions                 <df[,3]> <data.frame[15 x 3]>
+#> $ has_issues                  <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,…
+#> $ has_wiki                    <lgl> TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE…
+#> $ has_pull_requests           <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,…
+#> $ ignore_whitespace_conflicts <lgl> TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, …
+#> $ allow_merge_commits         <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,…
+#> $ allow_rebase                <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,…
+#> $ allow_rebase_explicit       <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,…
+#> $ allow_squash_merge          <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,…
+#> $ avatar_url                  <chr> "", "", "", "", "", "", "", "", "", "", "…
+
+
+

+Overview of tiquets

@@ -120,7 +178,9 @@

Contents

diff --git a/docs/index.html b/docs/index.html index d15ead4..3f9b7ac 100644 --- a/docs/index.html +++ b/docs/index.html @@ -77,129 +77,38 @@
-
+gitear +
+ -
-
-

-Overview

-

gitear is a package that communicates with the gitea API. It makes posible to request your self-hosted Git service data and import it to R in a tidy data frame.

+

The goal of gitear is to request your self-hosted Git service data and import it to R in a tidy data frame.

+

gitear is a package that communicates with the gitea API.

Installation

-

For the installation of the development version, you can install gitear from github:

-
devtools::install_github("ixpantia/gitear")
+

You can install the development version from GitHub with:

+

Usage

-

With gitear you have a set of functions to request your data from the gitea API and also to edit issues.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FunctionOutput
add_tracked_time_issue
create_comment_issue
create_issue
edit_comment
edit_issue
get_an_issue
get_an_organization
get_issues_closed_state
get_issues_open_state
get_label_issue
get_list_org_teams
get_list_comments_issue
get_list_comments_repository
get_list_org_members
get_list_repos_org
get_org_hook
get_org_list_hooks
get_organizations
get_repositories
get_times_issue
get_version
get_commits
+

First go to your gitea self hosted service and grab your API Token. Then you should be able to the following:

+
-
-

-Getting help

-
-
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index f0f8cf0..1156aac 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,5 +1,7 @@ -pandoc: 2.7.2 +pandoc: 2.3.1 pkgdown: 1.4.1 pkgdown_sha: ~ -articles: [] +articles: + Access-diff-issues-on-diff-instances: Access-diff-issues-on-diff-instances.html + Access-gitea-from-R: Access-gitea-from-R.html diff --git a/docs/readme_old.html b/docs/readme_old.html new file mode 100644 index 0000000..48e2c28 --- /dev/null +++ b/docs/readme_old.html @@ -0,0 +1,270 @@ + + + + + + + + +gitear • gitear + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + + +
+ +

+
+
+

+Overview

+

gitear is a package that communicates with the gitea API. It makes posible to request your self-hosted Git service data and import it to R in a tidy data frame.

+
+

+Installation

+

For the installation of the development version, you can install gitear from github:

+
devtools::install_github("ixpantia/gitear")
+
+
+

+Usage

+

With gitear you have a set of functions to request your data from the gitea API and also to edit issues.

+ ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionOutput
add_tracked_time_issue
create_comment_issueA table with the columns: id, html_url, pull_request_url, issue_url, user.id, user.login, user.full_name, user.email, user.avatar_url, user.language, user.username, body, created_at, updated_at
create_issueA list with $id, $url, $number, $user, $title, $body, $labels, $milestone, $assignee, $assignees, $state, $comments, $created_at, $updated_at, $closed_at, $due_date, $pull_request
edit_commentA list containing $id, $html_url, $pull_request_url, $issue_url, $user, $body, $created_at, $updated_at
edit_issueA list containing $id, $url, $number, $user, $title, $body, $labels, $milestone, $assignee, $assignees, $state, $comments, $created_at, $updated_at, $closed_at, $due_date, $pull_request
get_an_issue
get_an_organizationA dataframe with the variables id, username, full_name, avatar_url, description, website, location
get_issues_closed_stateA dataframe containing id, url, number, title, body, labels, milestones, assignees, state, comments, created_at, updated_at, closed_at, due_date, pull_request, user.id, user.login, user.full_name, user.email, user.avatar_url, user.language, user.username, assignee.id, assignee.login, assignee.full_name, asignee.email, assignee.avatar_url, assignee.language, assignee.username
get_issues_open_stateA dataframe containing id, url, number, title, body, labels, milestones, assignees, state, comments, created_at, updated_at, closed_at, due_date, pull_request, user.id, user.login, user.full_name, user.email, user.avatar_url, user.language, user.username, assignee.id, assignee.login, assignee.full_name, asignee.email, assignee.avatar_url, assignee.language, assignee.username
get_label_issueA dataframe with one variable: content_label_issue
get_list_org_teamsDataframe with id, name, description, permission and units
get_list_comments_issueA dataframe containing id, html_url, pull_request_url, issue_url, user, body, created_at, updated_at
get_list_comments_repositoryA dataframe containing id, html_url, pull_request_url, issue_url, user, body, created_at, updated_at
get_list_org_membersA dataframe with id, login, full_name, email, avatar_url, language, username
get_list_repos_orgA data frame containing id, owner, name, full_name, description, empty, private, fork, parent, mirror, size, html_url, ssh_url, clone_url, website, stars_count, forks_count, watchers_count, open_issues_count, default_branch, archived, created_at, updated_at, permissions
get_org_hook
get_org_list_hooks
get_organizationsid, username, full_name, avatar_url, description, website, location
get_repositories
get_times_issueA data frame with message and url
get_versionA data frame with one variable: version
get_commits
+
+
+

+Getting help

+
+
+ + +
+ +
+ + + +
+ + +
+

Site built with pkgdown 1.4.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html index bd2b3ff..5d3c6e5 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -229,12 +229,6 @@

get_organizations()

- -

Returns the organizations of the user

- -

get_org_hook()

@@ -247,6 +241,12 @@

get_organizations()

+ +

Returns the organizations of the user

+ +

get_repositories()