<commit_before>#!/usr/bin/env bash

koopa:::linux_install_rstudio_server() { # {{{1
    # """
    # Install RStudio Server.
    # @note Updated 2021-06-14.
    #
    # RStudio Server Pro was renamed to Workbench in 2021-06.
    #
    # Verify install:
    # > sudo rstudio-server stop
    # > sudo rstudio-server verify-installation
    # > sudo rstudio-server start
    # > sudo rstudio-server status
    #
    # System config: /etc/rstudio
    #
    # @seealso
    # - https://docs.rstudio.com/rsp/installation/
    # - https://rstudio.com/products/rstudio/download-commercial/
    # - https://rstudio.com/products/rstudio/download-server/debian-ubuntu/
    # - https://rstudio.com/products/rstudio/download-server/redhat-centos/
    # Docker recipes:
    # - https://hub.docker.com/r/rocker/rstudio/dockerfile
    # - https://github.com/rocker-org/rocker-versioned/tree/master/rstudio
    # """
    local file install server dict pos tee tmp_dir url
    declare -A dict=(
        [file_ext]=''
        [install]=''
        [name]='rstudio-server'
        [name_fancy]='RStudio Server'
        [os_codename]=''
        [platform]=''
        [reinstall]=0
        [version]=''
        [workbench]=0
    )
    koopa::assert_is_installed 'R'
    tee="$(koopa::locate_tee)"
    pos=()
    while (("$#"))
    do
        case "$1" in
            --file-ext=*)
                dict[file_ext]="${1#*=}"
                shift 1
                ;;
            --install=*)
                dict[install]="${1#*=}"
                shift 1
                ;;
            --os-codename=*)
                dict[os_codename]="${1#*=}"
                shift 1
                ;;
            --platform=*)
                dict[platform]="${1#*=}"
                shift 1
                ;;
            --pro | \
            --workbench)
                dict[workbench]=1
                shift 1
                ;;
            --reinstall)
                dict[reinstall]=1
                shift 1
                ;;
            --version=*)
                dict[version]="${1#*=}"
                shift 1
                ;;
            --)
                shift 1
                break
                ;;
            --*|-*)
                koopa::invalid_arg "$1"
                ;;
            *)
                pos+=("$1")
                shift 1
                ;;
        esac
    done
    [[ "${#pos[@]}" -gt 0 ]] && set -- "${pos[@]}"
    koopa::assert_has_no_args "$#"
    if [[ "${dict[workbench]}" -eq 1 ]]
    then
        dict[name]="rstudio-workbench"
        dict[name_fancy]="RStudio Workbench"
        dict[file_stem]="${dict[name]}"
    fi
    if koopa::is_fedora_like
    then
        dict[file_stem]="${dict[file_stem]}-rhel"<commit_msg>Harden file stem<commit_after>#!/usr/bin/env bash

koopa:::linux_install_rstudio_server() { # {{{1
    # """
    # Install RStudio Server.
    # @note Updated 2021-06-14.
    #
    # RStudio Server Pro was renamed to Workbench in 2021-06.
    #
    # Verify install:
    # > sudo rstudio-server stop
    # > sudo rstudio-server verify-installation
    # > sudo rstudio-server start
    # > sudo rstudio-server status
    #
    # System config: /etc/rstudio
    #
    # @seealso
    # - https://docs.rstudio.com/rsp/installation/
    # - https://rstudio.com/products/rstudio/download-commercial/
    # - https://rstudio.com/products/rstudio/download-server/debian-ubuntu/
    # - https://rstudio.com/products/rstudio/download-server/redhat-centos/
    # Docker recipes:
    # - https://hub.docker.com/r/rocker/rstudio/dockerfile
    # - https://github.com/rocker-org/rocker-versioned/tree/master/rstudio
    # """
    local file install server dict pos tee tmp_dir url
    declare -A dict=(
        [file_ext]=''
        [install]=''
        [name]='rstudio-server'
        [name_fancy]='RStudio Server'
        [os_codename]=''
        [platform]=''
        [reinstall]=0
        [version]=''
        [workbench]=0
    )
    koopa::assert_is_installed 'R'
    tee="$(koopa::locate_tee)"
    pos=()
    while (("$#"))
    do
        case "$1" in
            --file-ext=*)
                dict[file_ext]="${1#*=}"
                shift 1
                ;;
            --install=*)
                dict[install]="${1#*=}"
                shift 1
                ;;
            --os-codename=*)
                dict[os_codename]="${1#*=}"
                shift 1
                ;;
            --platform=*)
                dict[platform]="${1#*=}"
                shift 1
                ;;
            --pro | \
            --workbench)
                dict[workbench]=1
                shift 1
                ;;
            --reinstall)
                dict[reinstall]=1
                shift 1
                ;;
            --version=*)
                dict[version]="${1#*=}"
                shift 1
                ;;
            --)
                shift 1
                break
                ;;
            --*|-*)
                koopa::invalid_arg "$1"
                ;;
            *)
                pos+=("$1")
                shift 1
                ;;
        esac
    done
    [[ "${#pos[@]}" -gt 0 ]] && set -- "${pos[@]}"
    koopa::assert_has_no_args "$#"
    if [[ "${dict[workbench]}" -eq 1 ]]
    then
        dict[name]="rstudio-workbench"
        dict[name_fancy]="RStudio Workbench"
    fi
    if [[ -z "${dict[file_stem]}" ]]
    then
        dict[file_stem]="${dict[name]}"
    fi
    if koopa::is_fedora_like
    then
        dict[file_stem]="${dict[file_stem]}-rhel"
{'fraction_non_alphanumeric': 0.1560130010834236, 'fraction_numerical': 0.013723365836041893, 'mean_word_length': 1.3341761483354404, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6541512', 'n_tokens_mistral': 1901, 'n_tokens_neox': 1709, 'n_words': 276}