<commit_before>#!/bin/bash

function installDependencies()
{
    runAptGetUpdate

    installPackage 'build-essential'
}

function install()
{
    # Clean Up

    rm -rf "${installFolder}" '/usr/local/bin/node' '/usr/local/bin/npm'
    mkdir -p "${installFolder}"

    # Install

    if [[ "${version}" = 'latest' ]]
    then
        version="$(getLatestVersionNumber)"
        local url="http://nodejs.org/dist/latest/node-v${version}-linux-x64.tar.gz"
    else
        local url="http://nodejs.org/dist/v${version}/node-v${version}-linux-x64.tar.gz"
    fi

    if [[ "$(existURL "${url}")" = 'true' ]]
    then
        unzipRemoteFile "${url}" "${installFolder}"
        chown -R "$(whoami)":"$(whoami)" "${installFolder}"
        symlinkLocalBin "${installFolder}/bin"

        # Config Profile

        local profileConfigData=('__INSTALL_FOLDER__' "${installFolder}")

        createFileFromTemplate "${appPath}/../files/profile/node-js.sh" '/etc/profile.d/node-js.sh' "${profileConfigData[@]}"
    else
        fatal "FATAL: version '${version}' not found"
    fi
}

function getLatestVersionNumber()
{
    local versionPattern='[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,3}'
    local shaSum256="$(getRemoteFileContent 'http://nodejs.org/dist/latest/SHASUMS256.txt.asc')"

    echo "${shaSum256}" | grep -Eo "node-v${versionPattern}\.tar\.gz" | grep -Eo "${versionPattern}"
}

function main()
{
    appPath="$(cd "$(dirname "${0}")" && pwd)"

    source "${appPath}/../../../lib/util.bash" || exit 1
    source "${appPath}/../attributes/default.bash" || exit 1

    checkRequireDistributor

    header 'INSTALLING NODE-JS'

    checkRequireRootUser

    installDependencies
    install
    installCleanUp
}

main "${@}"<commit_msg>minor update fatal mesh<commit_after>#!/bin/bash

function installDependencies()
{
    runAptGetUpdate

    installPackage 'build-essential'
}

function install()
{
    # Clean Up

    rm -rf "${installFolder}" '/usr/local/bin/node' '/usr/local/bin/npm'
    mkdir -p "${installFolder}"

    # Install

    if [[ "${version}" = 'latest' ]]
    then
        version="$(getLatestVersionNumber)"
        local url="http://nodejs.org/dist/latest/node-v${version}-linux-x64.tar.gz"
    else
        local url="http://nodejs.org/dist/v${version}/node-v${version}-linux-x64.tar.gz"
    fi

    if [[ "$(existURL "${url}")" = 'true' ]]
    then
        unzipRemoteFile "${url}" "${installFolder}"
        chown -R "$(whoami)":"$(whoami)" "${installFolder}"
        symlinkLocalBin "${installFolder}/bin"

        # Config Profile

        local profileConfigData=('__INSTALL_FOLDER__' "${installFolder}")

        createFileFromTemplate "${appPath}/../files/profile/node-js.sh" '/etc/profile.d/node-js.sh' "${profileConfigData[@]}"
    else
        fatal "\nFATAL: version '${version}' not found!"
    fi
}

function getLatestVersionNumber()
{
    local versionPattern='[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,3}'
    local shaSum256="$(getRemoteFileContent 'http://nodejs.org/dist/latest/SHASUMS256.txt.asc')"

    echo "${shaSum256}" | grep -Eo "node-v${versionPattern}\.tar\.gz" | grep -Eo "${versionPattern}"
}

function main()
{
    appPath="$(cd "$(dirname "${0}")" && pwd)"

    source "${appPath}/../../../lib/util.bash" || exit 1
    source "${appPath}/../attributes/default.bash" || exit 1

    checkRequireDistributor

    header 'INSTALLING NODE-JS'

    checkRequireRootUser

    installDependencies
    install
    installCleanUp
}

main "${@}"
{'fraction_non_alphanumeric': 0.19514978601997146, 'fraction_numerical': 0.012553495007132667, 'mean_word_length': 3.2190132370637787, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6631132', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1124, 'n_words': 201}