<commit_before>#!/bin/bash -e
announce() {
  echo \$ $@
  $@
}

travis_retry() {
  local result=0
  local count=1
  while [ $count -le 3 ]; do
    [ $result -ne 0 ] && {
      echo -e "\n\033[33;1mThe command \"$@\" failed. Retrying, $count of 3.\033[0m\n" >&2
    }
    "$@"
    result=$?
    [ $result -eq 0 ] && break
    count=$(($count + 1))
    sleep 1
  done

  [ $count -eq 3 ] && {
    echo "\n\033[33;1mThe command \"$@\" failed 3 times.\033[0m\n" >&2
  }

  return $result
}

travis_rvm_os_path() {
  if which sw_vers >> /dev/null; then
    echo "osx/$(sw_vers -productVersion | cut -d. -f1,2)/$(uname -m)"
  else
    echo "$(lsb_release -i -s | tr '[:upper:]' '[:lower:]')/$(lsb_release -r -s)/$(uname -m)"
  fi
}

fold_start() {
  echo -e "travis_fold:start:$1\033[33;1m$2\033[0m"
}

fold_end() {
  echo -e "\ntravis_fold:end:$1\r"
}

function update_mvn() {
  VERSION=$1
  fold_start mvn.1 "update mvn to $VERSION"
  wget http://mirrors.ibiblio.org/apache/maven/maven-3/${VERSION}/binaries/apache-maven-${VERSION}-bin.tar.gz
  tar xzf apache-maven-$VERSION-bin.tar.gz
  export PATH=$PWD/apache-maven-$VERSION/bin:$PATH
  export M2_HOME=$PWD/apache-maven-$VERSION
  mvn -version
  fold_end mvn.1
}

#######################################################
# update rvm
fold_start rvm.1 "update rvm"
announce rvm remove 1.8.7
announce rvm get stable
announce rvm reload
announce rvm cleanup all
fold_end rvm.1

#######################################################
# get rid of binary meta data
fold_start rvm.2 "clean up meta data"
echo -n > $rvm_path/user/md5
echo -n > $rvm_path/user/sha512
echo -n > $rvm_path/user/db || true
echo "done"
fold_end rvm.2

#######################################################
# prepare env
fold_start rvm.3 "set up env for rvm"
announce source ~/.bashrc
announce unset DYLD_LIBRARY_PATH
announce export rvm_git_clone_depth=1 # speed up git clone
fold_end rvm.3

#######################################################
# install smf etc
if which sw_vers >> /dev/null; then
  fold_start rvm.4 "OSX specific setup"
  echo "\$ curl -L https://get.smf.sh | sh"
  curl -L https://get.smf.sh | sh
  export PATH="${PATH}:/Users/travis/.sm/bin:/Users/travis/.sm/pkg/active/bin:/Users/travis/.sm/pkg/active/sbin"
  announce rvm autolibs smf
  announce sudo mkdir -p /etc/openssl
  announce sudo chown -R $USER: /etc/openssl
  announce rvm use 2.0.0 --fuzzy
  announce mkdir -p $rvm_path/patchsets/ruby
  echo '$ echo "" > $rvm_path/patchsets/ruby/osx_static'
  echo "" > $rvm_path/patchsets/ruby/osx_static
  fold_end rvm.4
else
  fold_start rvm.4 "Linux specific setup"
  announce sudo apt-get update
  announce sudo apt-get install libssl1.0.0 openssl
  fold_end rvm.4
fi

#######################################################
# check $RUBY
fold_start ruby "check which ruby to build"
if [ -z $RUBY ]; then
  announce source ./build_info.sh
fi
[[ $RUBY ]] || { echo 'please set $RUBY' && exit 1; }
export RUBY=$(rvm strings $RUBY)
announce export RUBY=${RUBY//[[:blank:]]/}
echo "EVERYBODY STAND BACK, WE'RE INSTALLING $RUBY"
announce unset CC
if [ `expr $RUBY : '.*-clang$'` -gt 0 ]; then
  announce export CC=${RUBY##*-}
fi
fold_end ruby

#######################################################
# build the binary
fold_start build "build $RUBY"
announce rvm alias delete $RUBY
announce rvm remove $RUBY

case $RUBY in
mruby*)
  announce export SKIP_CHECK=1
  if which apt-get >> /dev/null; then
    announce sudo apt-get -q install gperf
  fi
  announce rvm install $RUBY --verify-downloads 1;;
ruby-1.*)
  if which sw_vers >> /dev/null; then
    echo "not building $RUBY on OSX, can't statically compile it"
    exit
  else
    announce rvm install $RUBY --verify-downloads 1 --disable-install-doc
  fi;;
ruby-*)
  if [[ $RUBY = *head* ]]; then
    EXTRA_FLAGS="--rubygems ignore"
  fi
  announce rvm install $RUBY $EXTRA_FLAGS --verify-downloads 1 --movable --disable-install-doc -C --without-tcl,--without-tk,--without-gmp;;
jruby-head)
  update_mvn 3.3.3
  announce rvm install $RUBY --verify-downloads 1;;
*)      announce rvm install $RUBY --verify-downloads 1;;
esac

announce rvm prepare $RUBY
fold_end build<commit_msg>Use maven 3.3.9<commit_after>#!/bin/bash -e
announce() {
  echo \$ $@
  $@
}

travis_retry() {
  local result=0
  local count=1
  while [ $count -le 3 ]; do
    [ $result -ne 0 ] && {
      echo -e "\n\033[33;1mThe command \"$@\" failed. Retrying, $count of 3.\033[0m\n" >&2
    }
    "$@"
    result=$?
    [ $result -eq 0 ] && break
    count=$(($count + 1))
    sleep 1
  done

  [ $count -eq 3 ] && {
    echo "\n\033[33;1mThe command \"$@\" failed 3 times.\033[0m\n" >&2
  }

  return $result
}

travis_rvm_os_path() {
  if which sw_vers >> /dev/null; then
    echo "osx/$(sw_vers -productVersion | cut -d. -f1,2)/$(uname -m)"
  else
    echo "$(lsb_release -i -s | tr '[:upper:]' '[:lower:]')/$(lsb_release -r -s)/$(uname -m)"
  fi
}

fold_start() {
  echo -e "travis_fold:start:$1\033[33;1m$2\033[0m"
}

fold_end() {
  echo -e "\ntravis_fold:end:$1\r"
}

function update_mvn() {
  VERSION=$1
  fold_start mvn.1 "update mvn to $VERSION"
  wget http://mirrors.ibiblio.org/apache/maven/maven-3/${VERSION}/binaries/apache-maven-${VERSION}-bin.tar.gz
  tar xzf apache-maven-$VERSION-bin.tar.gz
  export PATH=$PWD/apache-maven-$VERSION/bin:$PATH
  export M2_HOME=$PWD/apache-maven-$VERSION
  mvn -version
  fold_end mvn.1
}

#######################################################
# update rvm
fold_start rvm.1 "update rvm"
announce rvm remove 1.8.7
announce rvm get stable
announce rvm reload
announce rvm cleanup all
fold_end rvm.1

#######################################################
# get rid of binary meta data
fold_start rvm.2 "clean up meta data"
echo -n > $rvm_path/user/md5
echo -n > $rvm_path/user/sha512
echo -n > $rvm_path/user/db || true
echo "done"
fold_end rvm.2

#######################################################
# prepare env
fold_start rvm.3 "set up env for rvm"
announce source ~/.bashrc
announce unset DYLD_LIBRARY_PATH
announce export rvm_git_clone_depth=1 # speed up git clone
fold_end rvm.3

#######################################################
# install smf etc
if which sw_vers >> /dev/null; then
  fold_start rvm.4 "OSX specific setup"
  echo "\$ curl -L https://get.smf.sh | sh"
  curl -L https://get.smf.sh | sh
  export PATH="${PATH}:/Users/travis/.sm/bin:/Users/travis/.sm/pkg/active/bin:/Users/travis/.sm/pkg/active/sbin"
  announce rvm autolibs smf
  announce sudo mkdir -p /etc/openssl
  announce sudo chown -R $USER: /etc/openssl
  announce rvm use 2.0.0 --fuzzy
  announce mkdir -p $rvm_path/patchsets/ruby
  echo '$ echo "" > $rvm_path/patchsets/ruby/osx_static'
  echo "" > $rvm_path/patchsets/ruby/osx_static
  fold_end rvm.4
else
  fold_start rvm.4 "Linux specific setup"
  announce sudo apt-get update
  announce sudo apt-get install libssl1.0.0 openssl
  fold_end rvm.4
fi

#######################################################
# check $RUBY
fold_start ruby "check which ruby to build"
if [ -z $RUBY ]; then
  announce source ./build_info.sh
fi
[[ $RUBY ]] || { echo 'please set $RUBY' && exit 1; }
export RUBY=$(rvm strings $RUBY)
announce export RUBY=${RUBY//[[:blank:]]/}
echo "EVERYBODY STAND BACK, WE'RE INSTALLING $RUBY"
announce unset CC
if [ `expr $RUBY : '.*-clang$'` -gt 0 ]; then
  announce export CC=${RUBY##*-}
fi
fold_end ruby

#######################################################
# build the binary
fold_start build "build $RUBY"
announce rvm alias delete $RUBY
announce rvm remove $RUBY

case $RUBY in
mruby*)
  announce export SKIP_CHECK=1
  if which apt-get >> /dev/null; then
    announce sudo apt-get -q install gperf
  fi
  announce rvm install $RUBY --verify-downloads 1;;
ruby-1.*)
  if which sw_vers >> /dev/null; then
    echo "not building $RUBY on OSX, can't statically compile it"
    exit
  else
    announce rvm install $RUBY --verify-downloads 1 --disable-install-doc
  fi;;
ruby-*)
  if [[ $RUBY = *head* ]]; then
    EXTRA_FLAGS="--rubygems ignore"
  fi
  announce rvm install $RUBY $EXTRA_FLAGS --verify-downloads 1 --movable --disable-install-doc -C --without-tcl,--without-tk,--without-gmp;;
jruby-head)
  update_mvn 3.3.9
  announce rvm install $RUBY --verify-downloads 1;;
*)      announce rvm install $RUBY --verify-downloads 1;;
esac

announce rvm prepare $RUBY
fold_end build
{'fraction_non_alphanumeric': 0.21503831417624522, 'fraction_numerical': 0.02143199233716475, 'mean_word_length': 3.6379789006107717, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '429033', 'n_tokens_mistral': 3289, 'n_tokens_neox': 3099, 'n_words': 827}