Skip to content

Commit

Permalink
v.0.2.2.2
Browse files Browse the repository at this point in the history
Merge pull request #33 from mokymai/devel
  • Loading branch information
GegznaV committed Aug 8, 2023
2 parents 6acd975 + fec24ec commit dca2be0
Show file tree
Hide file tree
Showing 25 changed files with 710 additions and 859 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,36 @@ on:
branches: [main, master, devel]
pull_request:
branches: [main, master, devel]
schedule:
# (see https://crontab.guru)
- cron: "30 3 * */2 TUE"
workflow_dispatch:

name: R-CMD-check

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

concurrency:
group: >
${{ github.workflow }}-${{ matrix.config.os }}-${{ matrix.config.r }})-
${{ github.event_name != 'pull_request' || github.run_id }}
cancel-in-progress: true

name: ${{ matrix.config.os }} (R-${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
# - {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'release'}

env:
R_KEEP_PKG_SOURCE: yes
Expand All @@ -36,11 +48,9 @@ jobs:
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
extra-repositories: "https://mokymai.github.io/download/"


- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
Expand Down
43 changes: 15 additions & 28 deletions .github/workflows/drat--publish-package.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
on:
push:
branches:
- master
branches: [master, main]
workflow_dispatch:

name: Publish package
name: Publish package (drat)

jobs:
drat:
Expand All @@ -24,13 +24,13 @@ jobs:

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
SOURCE_REPO: ${{ github.repository }}
DEST_REPO: mokymai/download
TMP_DIR: tmp_dir
CACHE_VERSION: 1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Info
run: |
Expand All @@ -39,33 +39,20 @@ jobs:
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: true
extra-repositories: "https://mokymai.github.io/download/"

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Restore R package cache
# if: runner.os != 'Windows'
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-${CACHE_VERSION}-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-${CACHE_VERSION}-

- name: Install dependencies
shell: Rscript {0}
run: |
remotes::install_cran(c("roxygen2", "devtools", "drat"))
remotes::install_deps(dependencies = TRUE)
cache-version: 1
extra-packages: |
roxygen2
devtools
drat
- name: Roxygenize
shell: Rscript {0}
run: |
roxygen2::roxygenize()
run: roxygen2::roxygenize()

- name: Build source package
if: runner.os == 'Windows' && matrix.config.r == 'release'
Expand All @@ -91,7 +78,7 @@ jobs:
TOKEN: ${{ secrets.DEPLOY_DRAT_TOKEN }}

- name: Git clone DEST_REPO
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: ${{ env.DEST_REPO }} # 'mokymai/download'
ref: 'master'
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master, devel]
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: Update website
name: Update website (pkgdown)

jobs:
pkgdown:
Expand All @@ -15,16 +17,17 @@ jobs:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

permissions:
contents: write
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: "release"
use-public-rspm: true
r-version: 'release'
extra-repositories: "https://mokymai.github.io/download/"

- uses: r-lib/actions/setup-r-dependencies@v2
Expand Down Expand Up @@ -62,7 +65,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: false
branch: gh-pages
Expand Down
10 changes: 4 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: bio
Type: Package
Title: Resources Manager for BS-2023
Version: 0.2.2.1
Date: 2023-04-23
Version: 0.2.2.2
Date: 2023-08-08
Authors@R:
person("Vilmantas", "Gegzna", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-9500-5167"),
Expand All @@ -22,7 +22,7 @@ RoxygenNote: 7.2.3
Additional_repositories:
https://mokymai.github.io/download/
Imports:
backup.tools (>= 0.0.1),
backup.tools,
checkmate,
clipr,
crayon,
Expand All @@ -37,12 +37,10 @@ Imports:
purrr,
quarto,
readr (>= 2.0.0),
rematch2,
remotes,
rlang,
rstudioapi (>= 0.13),
snippets (>= 0.0.9),
stringi,
snippets,
stringr,
styler,
tibble (>= 3.1.4),
Expand Down
10 changes: 2 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export(check_updates_pkg_bio)
export(check_updates_rcmdr_biostat)
export(check_user_info)
export(compare_version)
export(emokymai_browse_assingment)
export(emokymai_submit_assingment)
export(get_last_pkgs_installation_status)
export(get_os_type)
export(get_path_desktop)
Expand Down Expand Up @@ -46,23 +44,18 @@ export(open_rstudio_snippets_dir)
export(open_rstudio_system_dictionaries_dir)
export(open_rstudio_user_dictionaries_dir)
export(open_user_proj_list)
export(pkg_list_archived_versions)
export(read_projects)
export(restart_r)
export(restart_rstudio)
export(rstudio_compare_user_settings)
export(rstudio_delete_spellcheck_dictionaries)
export(rstudio_download_spellcheck_dictionaries)
export(rstudio_install_spellcheck_dictionaries)
export(rstudio_install_spellcheck_dictionary_lt)
export(rstudio_reload_ui)
export(rstudio_reset_keybindings)
export(rstudio_reset_user_settings)
export(rstudio_restart_r)
export(to_ascii_lower)
export(u_check_filename)
export(u_create_filename)
export(u_parse_filename)
export(u_prepare_assignment_dc)
export(update_pkg_bio)
export(update_pkg_rcmdr_biostat)
export(update_pkg_snippets)
Expand All @@ -82,6 +75,7 @@ importFrom(magrittr,"%>%")
importFrom(rlang,.data)
importFrom(snippets,get_path_rstudio_snippets_dir)
importFrom(snippets,open_rstudio_snippets_dir)
importFrom(stats,na.omit)
importFrom(stats,setNames)
importFrom(usethis,ui_code)
importFrom(usethis,ui_done)
Expand Down
8 changes: 1 addition & 7 deletions R/dictionaries.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ open_rstudio_internal_dictionaries_dir <- function() {
#' @description
#' - `rstudio_download_spellcheck_dictionaries()`
#' downloads and updates RStudio (system) spellchecking dictionaries.
#' - `rstudio_download_spellcheck_dictionaries_lt()`
#' installs improved Lithuanian spellchecking dictionary.
#' - `rstudio_delete_spellcheck_dictionaries()`
#' deletes RStudio (system) spellchecking dictionaries.
#'
Expand All @@ -92,7 +90,6 @@ open_rstudio_internal_dictionaries_dir <- function() {
#' \dontrun{\donttest{
#' rstudio_delete_spellcheck_dictionaries()
#' rstudio_download_spellcheck_dictionaries()
#' rstudio_install_spellcheck_dictionary_lt()
#' }}

rstudio_install_spellcheck_dictionaries <- function(secure = TRUE) {
Expand All @@ -109,10 +106,7 @@ rstudio_install_spellcheck_dictionaries <- function(secure = TRUE) {
rstudio_download_spellcheck_dictionaries <- rstudio_install_spellcheck_dictionaries

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#' @name spelling
#' @export
#' @concept r and rstudio settings
#' @concept dictionaries

rstudio_install_spellcheck_dictionary_lt <- function() {

tryCatch({
Expand Down
4 changes: 2 additions & 2 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ get_upgrade_str <- function(upgrade) {
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ui_msg_restart_rstudio <- function() {
usethis::ui_todo(paste0(
"To take effect, {underline('RStudio')} should be ",
"{underline('closed and reopened')}."
"To apply all changes, {underline('close and reopen')} ",
"{underline('RStudio')}."
))
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
42 changes: 42 additions & 0 deletions R/packages--check.R
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,48 @@ get_pkgs_cran_details <- function(repos = NULL) {
cran_all
}

#' Get previous package versions available on CRAN
#'
#' Function to scrape the CRAN website and retrieve archived (old) package versions
#'
#' @param package (character)
#' Package name.
#'
#' @return Vector with version numbers (the current version is not present).
#' @export
#'
#' @importFrom stats na.omit
#'
#' @examples
#' pkg_list_archived_versions("ggplot2")
#'
#' pkg_list_archived_versions("none")
pkg_list_archived_versions <- function(package) {

# Base URL of archived packages on CRAN
url <- "https://cran.r-project.org/src/contrib/Archive/"

# Create the complete URL for the package
package_url <- paste0(url, package)

# Extract the webpage table rows containing the package versions
rows <- try(
suppressWarnings(readLines(package_url, warn = FALSE)),
silent = TRUE
)

if (inherits(rows, "try-error")) {
return(as.numeric_version(NULL))
}

# Extract the archived versions
rows |>
stringr::str_extract(stringr::str_glue("{package}_(.*?)[.]tar[.]gz"), 1) |>
na.omit() |>
as.numeric_version() |>
sort(decreasing = TRUE)
}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#' Get Details About Non-CRAN Package Installation
#'
Expand Down
2 changes: 1 addition & 1 deletion R/settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ restriction_status <- function(ignore_ip = getOption("bio.ignore_ip", FALSE),
#' 1) Resets RStudio state and user preferences (incl. color scheme)
#' 2) Clears function history, plot history, console, recent project list, etc.
#' 3) Closes unnecessary windows
#' 4) Resets custom keybindings to "bio-default"
#' 4) Resets custom key bindings to "bio-default"
#' 5) Resets R Markdown and R snippets to defaults in package "snippets"
#' 6) Creates folder "~/R/darbinis" and starts using it as working directory
#' when no project is used.
Expand Down
Loading

0 comments on commit dca2be0

Please sign in to comment.