boB Rudis
5 years ago
12 changed files with 419 additions and 8 deletions
@ -0,0 +1,128 @@ |
|||
image: debian/buster |
|||
packages: |
|||
- bash-completion |
|||
- bison |
|||
- debhelper |
|||
- default-jdk |
|||
- g++ |
|||
- gcc |
|||
- gdb |
|||
- gfortran |
|||
- groff-base |
|||
- libblas-dev |
|||
- libbz2-dev |
|||
- libcairo2-dev |
|||
- libcurl4-openssl-dev |
|||
- libxml2-dev |
|||
- libjpeg-dev |
|||
- liblapack-dev |
|||
- liblzma-dev |
|||
- libncurses5-dev |
|||
- libpango1.0-dev |
|||
- libpcre3-dev |
|||
- libpng-dev |
|||
- libreadline-dev |
|||
- libtiff5-dev |
|||
- libx11-dev |
|||
- libxt-dev |
|||
- mpack |
|||
- pandoc |
|||
- pandoc-citeproc |
|||
- pandoc-data |
|||
- subversion |
|||
- tcl8.6-dev |
|||
- texinfo |
|||
- texlive-base |
|||
- texlive-extra-utils |
|||
- texlive-fonts-extra |
|||
- texlive-fonts-recommended |
|||
- texlive-generic-recommended |
|||
- texlive-latex-base |
|||
- texlive-latex-extra |
|||
- texlive-latex-recommended |
|||
- tk8.6-dev |
|||
- x11proto-core-dev |
|||
- xauth |
|||
- xdg-utils |
|||
- xfonts-base |
|||
- xvfb |
|||
- zlib1g-dev |
|||
- ed |
|||
- less |
|||
- locales |
|||
- vim-tiny |
|||
- wget |
|||
- ca-certificates |
|||
- fonts-texgyre |
|||
- libssl-dev |
|||
- libcurl4-openssl-dev |
|||
- r-base |
|||
- r-base-dev |
|||
- r-recommended |
|||
- r-cran-crayon |
|||
- r-cran-curl |
|||
- r-cran-desc |
|||
- r-cran-httr |
|||
- r-cran-jsonlite |
|||
- r-cran-devtools |
|||
- r-cran-knitr |
|||
- r-cran-rmarkdown |
|||
- r-cran-rprojroot |
|||
- r-cran-stringi |
|||
- r-cran-testthat |
|||
- r-cran-testit |
|||
- r-cran-tinytest |
|||
- r-cran-tidyverse |
|||
- r-cran-xml2 |
|||
environment: |
|||
R_PACKAGE: sourcehut |
|||
_R_CHECK_URLS_USE_CURL_: FALSE |
|||
_R_CHECK_LENGTH_1_CONDITION_: TRUE |
|||
_R_CHECK_LENGTH_1_LOGIC2_: TRUE |
|||
_R_CHECK_TOPLEVEL_FILES_: TRUE |
|||
_R_CHECK_VC_DIRS_: TRUE |
|||
_R_CHECK_TIMINGS_: 10 |
|||
_R_CHECK_INSTALL_DEPENDS_: TRUE |
|||
_R_CHECK_SUGGESTS_ONLY_: TRUE |
|||
_R_CHECK_NO_RECOMMENDED_: TRUE |
|||
_R_CHECK_EXECUTABLES_EXCLUSIONS_: FALSE |
|||
_R_CHECK_DOC_SIZES2_: TRUE |
|||
_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_: TRUE |
|||
_R_CHECK_CODE_ATTACH_: TRUE |
|||
_R_CHECK_CODE_DATA_INTO_GLOBALENV_: TRUE |
|||
_R_CHECK_CODE_USAGE_VIA_NAMESPACES_: TRUE |
|||
_R_CHECK_DOT_FIRSTLIB_: TRUE |
|||
_R_CHECK_DEPRECATED_DEFUNCT_: TRUE |
|||
_R_CHECK_REPLACING_IMPORTS_: TRUE |
|||
_R_CHECK_SCREEN_DEVICE_: stop |
|||
_R_CHECK_TOPLEVEL_FILES_: TRUE |
|||
_R_CHECK_S3_METHODS_NOT_REGISTERED_: TRUE |
|||
_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_: TRUE |
|||
_R_CHECK_PRAGMAS_: TRUE |
|||
_R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE |
|||
_R_CHECK_COMPILATION_FLAGS_: TRUE |
|||
_R_CHECK_R_DEPENDS_: warn |
|||
_R_CHECK_SERIALIZATION_: TRUE |
|||
_R_CHECK_R_ON_PATH_: TRUE |
|||
_R_CHECK_PACKAGES_USED_IN_TESTS_USE_SUBDIRS_: TRUE |
|||
_R_CHECK_SHLIB_OPENMP_FLAGS_: TRUE |
|||
_R_CHECK_CONNECTIONS_LEFT_OPEN_: TRUE |
|||
_R_CHECK_FUTURE_FILE_TIMESTAMPS_: TRUE |
|||
_R_CHECK_AUTOCONF_: true |
|||
sources: |
|||
- https://git.sr.ht/~hrbrmstr/sourcehut |
|||
tasks: |
|||
- setup: | |
|||
sudo locale-gen --purge "en_US.UTF-8" |
|||
sudo update-locale "LANG=en_US.UTF-8" |
|||
sudo dpkg-reconfigure --frontend noninteractive locales |
|||
export LC_ALL=en_US.UTF-8 |
|||
export LANG=en_US.UTF-8 |
|||
export LANGUAGE=en_US.UTF-8 |
|||
echo 'options(repos = c(CRAN = "https://cloud.r-project.org"))' > ~/.Rprofile |
|||
echo 'R_LIBS_USER=/home/build/packages' > ~/.Renviron |
|||
mkdir /home/build/packages |
|||
Rscript -e 'install.packages(c("covr"))' |
|||
- build: | |
|||
R CMD build ${R_PACKAGE} |
|||
R CMD check ${R_PACKAGE}_*gz |
@ -1,18 +1,20 @@ |
|||
Package: sourcehut |
|||
Type: Package |
|||
Title: sourcehut title goes here otherwise CRAN checks fail |
|||
Title: Tools to Work with the SourceHut Development Ecosystem |
|||
Version: 0.1.0 |
|||
Date: 2019-09-02 |
|||
Authors@R: c( person("Bob", "Rudis", email = "bob@rud.is", role = |
|||
c("aut", "cre"), comment = c(ORCID = "0000-0001-5670-2640")) ) |
|||
Maintainer: Bob Rudis <bob@rud.is> |
|||
Description: A good description goes here otherwise CRAN checks fail. |
|||
Description: SourceHut (<https://sourcehut.org/>) provides support for collaborative |
|||
development of anything that can can be managed by Git or Mecurial version control |
|||
systems. Tools are provided to query and ochestrate a wide variety of SourceHut servies. |
|||
URL: https://gitlab.com/hrbrmstr/sourcehut |
|||
BugReports: https://gitlab.com/hrbrmstr/sourcehut/issues |
|||
Encoding: UTF-8 |
|||
License: AGPL |
|||
Suggests: covr, tinytest |
|||
Depends: R (>= 3.2.0) |
|||
Imports: httr, jsonlite |
|||
Imports: httr, jsonlite, usethis, crayon, desc, rprojroot |
|||
Roxygen: list(markdown = TRUE) |
|||
RoxygenNote: 6.1.1 |
|||
|
@ -1,4 +1,13 @@ |
|||
# Generated by roxygen2: do not edit by hand |
|||
|
|||
export(sourcehut_user) |
|||
export(use_builds) |
|||
import(crayon) |
|||
import(desc) |
|||
import(httr) |
|||
import(rprojroot) |
|||
import(usethis) |
|||
importFrom(crayon,blue) |
|||
importFrom(crayon,make_style) |
|||
importFrom(desc,desc_get) |
|||
importFrom(jsonlite,fromJSON) |
|||
|
@ -1,9 +1,13 @@ |
|||
#' ... |
|||
#' |
|||
#' sourcehut |
|||
#' |
|||
#' SourceHut (<https://sourcehut.org/>) provides support for collaborative |
|||
#' development of anything that can can be managed by Git or Mecurial version control |
|||
#' systems. Tools are provided to query and ochestrate a wide variety of SourceHut servies. |
|||
#' |
|||
#' @md |
|||
#' @name sourcehut |
|||
#' @keywords internal |
|||
#' @author Bob Rudis (bob@@rud.is) |
|||
#' @import httr |
|||
#' @import httr usethis crayon desc rprojroot |
|||
#' @importFrom jsonlite fromJSON |
|||
"_PACKAGE" |
|||
|
@ -0,0 +1,34 @@ |
|||
#' Get or set SourceHut username value |
|||
#' |
|||
#' @param force force setting a new SourceHut username for the current environment? |
|||
#' @return atomic character vector containing the SourceHut username (with tilde) |
|||
#' @export |
|||
sourcehut_user <- function(force = FALSE) { |
|||
|
|||
user <- Sys.getenv('SOURCEHUT_USERNAME') |
|||
if (!identical(user, "") && !force) { |
|||
if (!startsWith(user, "~")) user <- sprintf("~%s", user) |
|||
return(user) |
|||
} |
|||
|
|||
if (!interactive()) { |
|||
stop("Please set env var SOURCEHUT_USERNAME to your SourceHut username (with or without the tilde)", |
|||
call. = FALSE) |
|||
} |
|||
|
|||
message("Couldn't find env var SOURCEHUT_USERNAME See ?sourcehut_user for more details.") |
|||
message("Please enter your SourceHut username and press enter:") |
|||
user <- readline(": ") |
|||
|
|||
if (identical(user, "")) { |
|||
stop("SourceHut username entry failed", call. = FALSE) |
|||
} |
|||
|
|||
if (!startsWith(user, "~")) user <- sprintf("~%s", user) |
|||
|
|||
message("Updating SOURCEHUT_USERNAME env var") |
|||
Sys.setenv(SOURCEHUT_USERNAME = user) |
|||
|
|||
user |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
#' Setup .build.yml for SourceHut builds |
|||
#' |
|||
#' @md |
|||
#' @param username your SourecHut user id (with or without the leading tilde) |
|||
#' @param open if `TRUE`, open the resultant file |
|||
#' @export |
|||
use_builds <- function(username = sourcehut_user(), open = TRUE) { |
|||
|
|||
check_is_package("use_builds()") |
|||
|
|||
pkg <- basename(rprojroot::find_package_root_file()) |
|||
|
|||
use_template( |
|||
template = "build.yml", |
|||
save_as = ".build.yml", |
|||
data = list( |
|||
username = username, |
|||
pkg = pkg |
|||
), |
|||
open = open, |
|||
ignore = TRUE, |
|||
package = "sourcehut" |
|||
) |
|||
|
|||
} |
@ -0,0 +1,45 @@ |
|||
check_is_package <- function (whos_asking = NULL) { |
|||
|
|||
if (is_package()) return(invisible()) |
|||
|
|||
message <- paste0("Project ", value(project_name()), " is not an R package.") |
|||
|
|||
if (!is.null(whos_asking)) { |
|||
message <- paste0(code(whos_asking), " is designed to work with packages. ", |
|||
message) |
|||
} |
|||
|
|||
stop(message, call. = FALSE) |
|||
|
|||
} |
|||
|
|||
#' @import rprojroot |
|||
is_package <- function (base_path = proj_get()){ |
|||
res <- tryCatch(rprojroot::find_package_root_file(path = base_path), |
|||
error = function(e) NULL) |
|||
!is.null(res) |
|||
} |
|||
|
|||
#' @importFrom crayon blue |
|||
value <- function (...) { |
|||
x <- paste0(...) |
|||
crayon::blue(encodeString(x, quote = "'")) |
|||
} |
|||
|
|||
#' @importFrom crayon make_style |
|||
code <- function (...) { |
|||
x <- paste0(...) |
|||
(crayon::make_style("darkgrey"))(encodeString(x, quote = "`")) |
|||
} |
|||
|
|||
#' @importFrom desc desc_get |
|||
#' @import usethis |
|||
project_name <- function (base_path = usethis::proj_get()) { |
|||
desc_path <- file.path(base_path, "DESCRIPTION") |
|||
if (file.exists(desc_path)) { |
|||
desc::desc_get("Package", base_path)[[1]] |
|||
} |
|||
else { |
|||
basename(normalizePath(base_path, mustWork = FALSE)) |
|||
} |
|||
} |
@ -0,0 +1,128 @@ |
|||
image: debian/buster |
|||
packages: |
|||
- bash-completion |
|||
- bison |
|||
- debhelper |
|||
- default-jdk |
|||
- g++ |
|||
- gcc |
|||
- gdb |
|||
- gfortran |
|||
- groff-base |
|||
- libblas-dev |
|||
- libbz2-dev |
|||
- libcairo2-dev |
|||
- libcurl4-openssl-dev |
|||
- libxml2-dev |
|||
- libjpeg-dev |
|||
- liblapack-dev |
|||
- liblzma-dev |
|||
- libncurses5-dev |
|||
- libpango1.0-dev |
|||
- libpcre3-dev |
|||
- libpng-dev |
|||
- libreadline-dev |
|||
- libtiff5-dev |
|||
- libx11-dev |
|||
- libxt-dev |
|||
- mpack |
|||
- pandoc |
|||
- pandoc-citeproc |
|||
- pandoc-data |
|||
- subversion |
|||
- tcl8.6-dev |
|||
- texinfo |
|||
- texlive-base |
|||
- texlive-extra-utils |
|||
- texlive-fonts-extra |
|||
- texlive-fonts-recommended |
|||
- texlive-generic-recommended |
|||
- texlive-latex-base |
|||
- texlive-latex-extra |
|||
- texlive-latex-recommended |
|||
- tk8.6-dev |
|||
- x11proto-core-dev |
|||
- xauth |
|||
- xdg-utils |
|||
- xfonts-base |
|||
- xvfb |
|||
- zlib1g-dev |
|||
- ed |
|||
- less |
|||
- locales |
|||
- vim-tiny |
|||
- wget |
|||
- ca-certificates |
|||
- fonts-texgyre |
|||
- libssl-dev |
|||
- libcurl4-openssl-dev |
|||
- r-base |
|||
- r-base-dev |
|||
- r-recommended |
|||
- r-cran-crayon |
|||
- r-cran-curl |
|||
- r-cran-desc |
|||
- r-cran-httr |
|||
- r-cran-jsonlite |
|||
- r-cran-devtools |
|||
- r-cran-knitr |
|||
- r-cran-rmarkdown |
|||
- r-cran-rprojroot |
|||
- r-cran-stringi |
|||
- r-cran-testthat |
|||
- r-cran-testit |
|||
- r-cran-tinytest |
|||
- r-cran-tidyverse |
|||
- r-cran-xml2 |
|||
environment: |
|||
R_PACKAGE: {{{pkg}}} |
|||
_R_CHECK_URLS_USE_CURL_: FALSE |
|||
_R_CHECK_LENGTH_1_CONDITION_: TRUE |
|||
_R_CHECK_LENGTH_1_LOGIC2_: TRUE |
|||
_R_CHECK_TOPLEVEL_FILES_: TRUE |
|||
_R_CHECK_VC_DIRS_: TRUE |
|||
_R_CHECK_TIMINGS_: 10 |
|||
_R_CHECK_INSTALL_DEPENDS_: TRUE |
|||
_R_CHECK_SUGGESTS_ONLY_: TRUE |
|||
_R_CHECK_NO_RECOMMENDED_: TRUE |
|||
_R_CHECK_EXECUTABLES_EXCLUSIONS_: FALSE |
|||
_R_CHECK_DOC_SIZES2_: TRUE |
|||
_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_: TRUE |
|||
_R_CHECK_CODE_ATTACH_: TRUE |
|||
_R_CHECK_CODE_DATA_INTO_GLOBALENV_: TRUE |
|||
_R_CHECK_CODE_USAGE_VIA_NAMESPACES_: TRUE |
|||
_R_CHECK_DOT_FIRSTLIB_: TRUE |
|||
_R_CHECK_DEPRECATED_DEFUNCT_: TRUE |
|||
_R_CHECK_REPLACING_IMPORTS_: TRUE |
|||
_R_CHECK_SCREEN_DEVICE_: stop |
|||
_R_CHECK_TOPLEVEL_FILES_: TRUE |
|||
_R_CHECK_S3_METHODS_NOT_REGISTERED_: TRUE |
|||
_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_: TRUE |
|||
_R_CHECK_PRAGMAS_: TRUE |
|||
_R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE |
|||
_R_CHECK_COMPILATION_FLAGS_: TRUE |
|||
_R_CHECK_R_DEPENDS_: warn |
|||
_R_CHECK_SERIALIZATION_: TRUE |
|||
_R_CHECK_R_ON_PATH_: TRUE |
|||
_R_CHECK_PACKAGES_USED_IN_TESTS_USE_SUBDIRS_: TRUE |
|||
_R_CHECK_SHLIB_OPENMP_FLAGS_: TRUE |
|||
_R_CHECK_CONNECTIONS_LEFT_OPEN_: TRUE |
|||
_R_CHECK_FUTURE_FILE_TIMESTAMPS_: TRUE |
|||
_R_CHECK_AUTOCONF_: true |
|||
sources: |
|||
- https://git.sr.ht/{{{username}}}/{{{pkg}}} |
|||
tasks: |
|||
- setup: | |
|||
sudo locale-gen --purge "en_US.UTF-8" |
|||
sudo update-locale "LANG=en_US.UTF-8" |
|||
sudo dpkg-reconfigure --frontend noninteractive locales |
|||
export LC_ALL=en_US.UTF-8 |
|||
export LANG=en_US.UTF-8 |
|||
export LANGUAGE=en_US.UTF-8 |
|||
echo 'options(repos = c(CRAN = "https://cloud.r-project.org"))' > ~/.Rprofile |
|||
echo 'R_LIBS_USER=/home/build/packages' > ~/.Renviron |
|||
mkdir /home/build/packages |
|||
Rscript -e 'install.packages(c("covr"))' |
|||
- build: | |
|||
R CMD build ${R_PACKAGE} |
|||
R CMD check ${R_PACKAGE}_*gz |
@ -0,0 +1,17 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/sourcehut-user.R |
|||
\name{sourcehut_user} |
|||
\alias{sourcehut_user} |
|||
\title{Get or set SourceHut username value} |
|||
\usage{ |
|||
sourcehut_user(force = FALSE) |
|||
} |
|||
\arguments{ |
|||
\item{force}{force setting a new SourceHut username for the current environment?} |
|||
} |
|||
\value{ |
|||
atomic character vector containing the SourceHut username (with tilde) |
|||
} |
|||
\description{ |
|||
Get or set SourceHut username value |
|||
} |
@ -0,0 +1,16 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/use-builds.R |
|||
\name{use_builds} |
|||
\alias{use_builds} |
|||
\title{Setup .build.yml for SourceHut builds} |
|||
\usage{ |
|||
use_builds(username = sourcehut_user(), open = TRUE) |
|||
} |
|||
\arguments{ |
|||
\item{username}{your SourecHut user id (with or without the leading tilde)} |
|||
|
|||
\item{open}{if \code{TRUE}, open the resultant file} |
|||
} |
|||
\description{ |
|||
Setup .build.yml for SourceHut builds |
|||
} |
Loading…
Reference in new issue