<commit_before>#!/bin/bash

set -e

# Default options
DEFAULT_INSTALLATION_PATH=/usr/local
DEFAULT_NODE=N
DEFAULT_NODE_OVERWRITE=N
DEFAULT_NODE_VERSION=8.11.3

# Options
if [ -z $INSTALLATION_PATH ]; then
  read -p "$LANG_COMMON_INSTALLATION_PATH: ($DEFAULT_INSTALLATION_PATH) " INSTALLATION_PATH
  if [ -z $INSTALLATION_PATH ]; then
    INSTALLATION_PATH=$DEFAULT_INSTALLATION_PATH
  fi
fi

NODE_INSTALLATION_PATH="$INSTALLATION_PATH/node"

if [ -z $NODE ]; then
  typeset -u NODE
  read -p "$LANG_INSTALL_NODE[Y/N]: ($DEFAULT_NODE) " NODE
  if [ -z $NODE ]; then
    NODE=$DEFAULT_NODE
  fi
fi

NODE_INSTALLATION_PATH="$INSTALLATION_PATH/node"
if [[ $NODE == 'Y' && -d "$NODE_INSTALLATION_PATH" ]]; then
  typeset -u NODE
  read -p "$LANG_NODE_OVERWRITE[Y/N]: ($DEFAULT_NODE_OVERWRITE) " NODE
  if [ -z $NODE ]; then
    NODE=$DEFAULT_NODE_OVERWRITE
  fi
fi

if [ $NODE == 'Y' ]; then
  if [ -z $NODE_VERSION ]; then
    read -p "$LANG_NODE_VERSION: ($DEFAULT_NODE_VERSION) " NODE_VERSION
    if [ -z $NODE_VERSION ]; then
      NODE_VERSION=$DEFAULT_NODE_VERSION
    fi
  fi
fi

# Install
install_node() {
  if [ $NODE != 'Y' ]; then
    return
  fi

  set -x
  if [ -d "$NODE_INSTALLATION_PATH" ]; then
    mv "$NODE_INSTALLATION_PATH" "$NODE_INSTALLATION_PATH.`date +%Y%m%d%H%M%S`"
  fi
  # if [ ! -f "node-v$NODE_VERSION-linux-x64.tar.xz" ]; then
  #   curl --compressed -fLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz"
  # else
  if [ -f "node-v$NODE_VERSION-linux-x64.tar.xz" ]; then
    rm -rf "node-v$NODE_VERSION-linux-x64"
  fi
  wget -c "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz"
  tar xvf "node-v$NODE_VERSION-linux-x64.tar.xz"
  mv "node-v$NODE_VERSION-linux-x64" "$NODE_INSTALLATION_PATH"
  echo "export PATH=$NODE_INSTALLATION_PATH/bin:"'$PATH' > /etc/profile.d/node.sh
  source /etc/profile.d/node.sh
  # npm install -g --registry=https://registry.npm.taobao.org cnpm npm@latest yarn
  set +x
}<commit_msg>deploy<commit_after>#!/bin/bash

set -e

# Default options
DEFAULT_INSTALLATION_PATH=/usr/local
DEFAULT_NODE=N
DEFAULT_NODE_OVERWRITE=N
DEFAULT_NODE_VERSION=8.11.3

# Options
if [ -z $INSTALLATION_PATH ]; then
  read -p "$LANG_COMMON_INSTALLATION_PATH: ($DEFAULT_INSTALLATION_PATH) " INSTALLATION_PATH
  if [ -z $INSTALLATION_PATH ]; then
    INSTALLATION_PATH=$DEFAULT_INSTALLATION_PATH
  fi
fi

NODE_INSTALLATION_PATH="$INSTALLATION_PATH/node"

if [ -z $NODE ]; then
  typeset -u NODE
  read -p "$LANG_INSTALL_NODE[Y/N]: ($DEFAULT_NODE) " NODE
  if [ -z $NODE ]; then
    NODE=$DEFAULT_NODE
  fi
fi

NODE_INSTALLATION_PATH="$INSTALLATION_PATH/node"
if [[ $NODE == 'Y' && -d "$NODE_INSTALLATION_PATH" ]]; then
  typeset -u NODE
  read -p "$LANG_NODE_OVERWRITE[Y/N]: ($DEFAULT_NODE_OVERWRITE) " NODE
  if [ -z $NODE ]; then
    NODE=$DEFAULT_NODE_OVERWRITE
  fi
fi

if [ $NODE == 'Y' ]; then
  if [ -z $NODE_VERSION ]; then
    read -p "$LANG_NODE_VERSION: ($DEFAULT_NODE_VERSION) " NODE_VERSION
    if [ -z $NODE_VERSION ]; then
      NODE_VERSION=$DEFAULT_NODE_VERSION
    fi
  fi
fi

# Install
install_node() {
  if [ $NODE != 'Y' ]; then
    return
  fi

  set -x
  if [ -d "$NODE_INSTALLATION_PATH" ]; then
    mv "$NODE_INSTALLATION_PATH" "$NODE_INSTALLATION_PATH.`date +%Y%m%d%H%M%S`"
  fi
  # if [ ! -f "node-v$NODE_VERSION-linux-x64.tar.xz" ]; then
  #   curl --compressed -fLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz"
  # else
  if [ -f "node-v$NODE_VERSION-linux-x64.tar.xz" ]; then
    rm -rf "node-v$NODE_VERSION-linux-x64"
  fi
  wget -c "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz"
  tar xvf "node-v$NODE_VERSION-linux-x64.tar.xz"
  chown root:root -R "node-v$NODE_VERSION-linux-x64"
  mv "node-v$NODE_VERSION-linux-x64" "$NODE_INSTALLATION_PATH"
  echo "export PATH=$NODE_INSTALLATION_PATH/bin:"'$PATH' > /etc/profile.d/node.sh
  source /etc/profile.d/node.sh
  # npm install -g --registry=https://registry.npm.taobao.org cnpm npm@latest yarn
  set +x
}
{'fraction_non_alphanumeric': 0.14732142857142858, 'fraction_numerical': 0.009424603174603174, 'mean_word_length': 3.9363525091799265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, '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': '6232682', 'n_tokens_mistral': 1676, 'n_tokens_neox': 1570, 'n_words': 302}