Browse Source

install_sourcehut

master
boB Rudis 5 years ago
parent
commit
9d5a7c387f
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 6
      DESCRIPTION
  2. 2
      NAMESPACE
  3. 18
      R/install-sourcehut.R
  4. 1
      R/sourcehut-package.R
  5. 12
      README.md
  6. 18
      man/install_sourcehut.Rd

6
DESCRIPTION

@ -1,8 +1,8 @@
Package: sourcehut Package: sourcehut
Type: Package Type: Package
Title: Tools to Work with the SourceHut Development Ecosystem Title: Tools to Work with the SourceHut Development Ecosystem
Version: 0.1.0 Version: 0.2.0
Date: 2019-09-02 Date: 2019-09-17
Authors@R: c( person("Bob", "Rudis", email = "bob@rud.is", role = Authors@R: c( person("Bob", "Rudis", email = "bob@rud.is", role =
c("aut", "cre"), comment = c(ORCID = "0000-0001-5670-2640")) ) c("aut", "cre"), comment = c(ORCID = "0000-0001-5670-2640")) )
Maintainer: Bob Rudis <bob@rud.is> Maintainer: Bob Rudis <bob@rud.is>
@ -15,6 +15,6 @@ Encoding: UTF-8
License: MIT + file LICENSE License: MIT + file LICENSE
Suggests: covr, tinytest Suggests: covr, tinytest
Depends: R (>= 3.2.0) Depends: R (>= 3.2.0)
Imports: httr, jsonlite, usethis, crayon, desc, rprojroot, glue, utils Imports: httr, jsonlite, usethis, crayon, desc, rprojroot, glue, utils, remotes
Roxygen: list(markdown = TRUE) Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1 RoxygenNote: 6.1.1

2
NAMESPACE

@ -5,6 +5,7 @@ export(get_build_manifest)
export(get_build_status) export(get_build_status)
export(git_repos) export(git_repos)
export(git_user) export(git_user)
export(install_sourcehut)
export(meta_audit) export(meta_audit)
export(meta_pgp_keys) export(meta_pgp_keys)
export(meta_profile) export(meta_profile)
@ -24,4 +25,5 @@ importFrom(crayon,blue)
importFrom(crayon,make_style) importFrom(crayon,make_style)
importFrom(desc,desc_get) importFrom(desc,desc_get)
importFrom(jsonlite,fromJSON) importFrom(jsonlite,fromJSON)
importFrom(remotes,install_git)
importFrom(utils,browseURL) importFrom(utils,browseURL)

18
R/install-sourcehut.R

@ -0,0 +1,18 @@
#' Install a package from a SourceHut git repository
#'
#' Works like [remotes::install_gitlab()], [remotes::install_bitbucket()], [remotes::install_github()] (etc).
#' You can also omit the leading tilde ("~") from the username portion of the repository address
#'
#' @param repo Repository address in the format `username/repo`. You can specify `subdir` and/or `ref` using the
#' respective parameters (via `...`).
#' @param ... passed on to [remotes::install_git()]
#' @export
install_sourcehut <- function(repo, ...) {
repo <- repo[1]
if (!startsWith(repo, "~")) repo <- glue::glue("~{repo}")
remotes::install_git(url = glue::glue("https://git.sr.ht/{repo}"), ...)
}

1
R/sourcehut-package.R

@ -11,4 +11,5 @@
#' @import httr usethis crayon desc rprojroot glue #' @import httr usethis crayon desc rprojroot glue
#' @importFrom jsonlite fromJSON #' @importFrom jsonlite fromJSON
#' @importFrom utils browseURL #' @importFrom utils browseURL
#' @importFrom remotes install_git
"_PACKAGE" "_PACKAGE"

12
README.md

@ -33,6 +33,8 @@ The following functions are implemented:
- `git_repos`: Retrieve metadata about repositories - `git_repos`: Retrieve metadata about repositories
- `git_user`: Retrieve metadata about yourself or another SourceHut - `git_user`: Retrieve metadata about yourself or another SourceHut
user user
- `install_sourcehut`: Install a package from a SourceHut git
repository
- `meta_audit`: Retrieve your audit log - `meta_audit`: Retrieve your audit log
- `meta_profile`: Retrieve metadata about yourself - `meta_profile`: Retrieve metadata about yourself
- `meta_ssh_keys`: Retrieve your SSH keys - `meta_ssh_keys`: Retrieve your SSH keys
@ -66,15 +68,15 @@ library(sourcehut)
# current version # current version
packageVersion("sourcehut") packageVersion("sourcehut")
## [1] '0.1.0' ## [1] '0.2.0'
``` ```
## sourcehut Metrics ## sourcehut Metrics
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) | | Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: | | :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | --: |
| R | 15 | 0.94 | 219 | 0.96 | 91 | 0.86 | 105 | 0.79 | | R | 16 | 0.94 | 224 | 0.97 | 95 | 0.86 | 115 | 0.8 |
| Rmd | 1 | 0.06 | 8 | 0.04 | 15 | 0.14 | 28 | 0.21 | | Rmd | 1 | 0.06 | 8 | 0.03 | 15 | 0.14 | 28 | 0.2 |
## Code of Conduct ## Code of Conduct

18
man/install_sourcehut.Rd

@ -0,0 +1,18 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/install-sourcehut.R
\name{install_sourcehut}
\alias{install_sourcehut}
\title{Install a package from a SourceHut git repository}
\usage{
install_sourcehut(repo, ...)
}
\arguments{
\item{repo}{Repository address in the format \code{username/repo}. You can specify \code{subdir} and/or \code{ref} using the
respective parameters (via \code{...}).}
\item{...}{passed on to \code{\link[remotes:install_git]{remotes::install_git()}}}
}
\description{
Works like \code{\link[remotes:install_gitlab]{remotes::install_gitlab()}}, \code{\link[remotes:install_bitbucket]{remotes::install_bitbucket()}}, \code{\link[remotes:install_github]{remotes::install_github()}} (etc).
You can also omit the leading tilde ("~") from the username portion of the repository address
}
Loading…
Cancel
Save