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

echo 'solver.allowVendorChange = true' >> /etc/zypp/zypp.conf

# packages
zypper -q ref
zypper -q -n in -t pattern devel_basis
zypper -q -n in libopenssl-devel readline-devel \
    postgresql94-server postgresql94-devel libxml2-devel libxslt-devel

# rbenv
# Based on https://en.opensuse.org/User:Tsu2/Install_Ruby#When_do_I_need_to_install_Ruby.3F
zypper -q -n in automake gdbm-devel libyaml-devel ncurses-devel readline-devel zlib-devel

su - vagrant -c "git clone git://github.com/sstephenson/rbenv.git .rbenv"
su - vagrant -c "git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build"
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> /etc/profile.d/rbenv.sh
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
su - vagrant -c "source /etc/profile"

su - vagrant -c "rbenv install 2.4.0"
su - vagrant -c "rbenv rehash"
su - vagrant -c "rbenv global 2.4.0"

# postgresql
echo -e "\nsetting up postgresl...\n"
systemctl start postgresql
systemctl enable postgresql

sed -i 's/local.*all.*all.*peer/local    all         all                               trust/' /var/lib/pgsql/data/pg_hba.conf
sed -i 's/host.*all.*all.*32.*ident/host    all         all          127\.0\.0\.1\/32         trust/' /var/lib/pgsql/data/pg_hba.conf
sed -i 's/host.*all.*all.*128.*ident/host    all         all         ::1\/128               trust/' /var/lib/pgsql/data/pg_hba.conf

systemctl restart postgresql

echo -e "\nsetting up ruby...\n"
su - vagrant -c "ln -sf /usr/bin/ruby.ruby2.4 /home/vagrant/bin/ruby"

echo -e "\ndisabling versioned gem binary names...\n"
echo 'install: --no-format-executable' >> /etc/gemrc

echo -e "\ninstalling your bundle...\n"
su - vagrant -c "gem install bundler"
su - vagrant -c "bundle config build.nokogiri '--use-system-libraries'"
su - vagrant -c "cd /vagrant/; bundle install"

# Configure the database if it isn't
if [ ! -f /vagrant/config/database.yml ] && [ -f /vagrant/config/database.yml.example ]; then
  echo -e "\nSetting up your database from config/database.yml...\n"
  cp /vagrant/config/database.yml.example /vagrant/config/database.yml
  su - postgres -c 'psql -c "create role bsteam with superuser createdb login;";'<commit_msg>Remove rbenv and use openSUSE repository<commit_after>#!/usr/bin/env bash

echo 'solver.allowVendorChange = true' >> /etc/zypp/zypp.conf

# packages
zypper -q ar -f http://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_42.2/devel:languages:ruby.repo
zypper -q --gpg-auto-import-keys --non-interactive ref
zypper -q -n in -t pattern devel_basis
zypper -q -n in libopenssl-devel readline-devel \
    postgresql94-server postgresql94-devel libxml2-devel libxslt-devel ruby2.4-devel

# postgresql
echo -e "\nsetting up postgresl...\n"
systemctl start postgresql
systemctl enable postgresql

sed -i 's/local.*all.*all.*peer/local    all         all                               trust/' /var/lib/pgsql/data/pg_hba.conf
sed -i 's/host.*all.*all.*32.*ident/host    all         all          127\.0\.0\.1\/32         trust/' /var/lib/pgsql/data/pg_hba.conf
sed -i 's/host.*all.*all.*128.*ident/host    all         all         ::1\/128               trust/' /var/lib/pgsql/data/pg_hba.conf

systemctl restart postgresql

echo -e "\nsetting up ruby...\n"
su - vagrant -c "ln -sf /usr/bin/ruby.ruby2.4 /home/vagrant/bin/ruby"

echo -e "\ndisabling versioned gem binary names...\n"
echo 'install: --no-format-executable' >> /etc/gemrc

echo -e "\ninstalling your bundle...\n"
gem.ruby2.4 install bundler
su - vagrant -c "cd /vagrant/; bundle install"

# Configure the database if it isn't
if [ ! -f /vagrant/config/database.yml ] && [ -f /vagrant/config/database.yml.example ]; then
  echo -e "\nSetting up your database from config/database.yml...\n"
  cp /vagrant/config/database.yml.example /vagrant/config/database.yml
  su - postgres -c 'psql -c "create role bsteam with superuser createdb login;";'
{'fraction_non_alphanumeric': 0.14745376235115276, 'fraction_numerical': 0.015961489739042312, 'mean_word_length': 2.7779904306220096, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '741176', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1435, 'n_words': 357}