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

provision ruby

# checks if a gem is bundled
function bundles () {
    local lockfile=`readlink -f "${2:-/vagrant/Gemfile}.lock"`
    grep -o " ${1}[ $]" $lockfile >/dev/null 2>&1
}
# installs bundle from given path or /vagrant
function install-bundle () {
    local gemfile=`readlink -f "${1:-/vagrant}/Gemfile"`

    while :
    do
        can bundle && break || gem install --no-ri --no-rdoc bundler >/dev/null
    done

    bundles pg $gemfile && {
        provision pgsql
        has libpq-dev \
        || apt-install libpq-dev
    }
    bundles curb $gemfile && {
        has libcurl4-openssl-dev \
        || apt-install libcurl4-openssl-dev
    }
    bundles nokogiri $gemfile && {
        # FIXME conditional logic not working...
        has libxslt1-dev && has libxml2-dev \
        || apt-install libxslt1-dev libxml2-dev
    }

    echo "Installing bundle..."
    as vagrant "bundle install --no-deployment --path=~/gems --gemfile=${gemfile} --quiet --no-cache --without doc production"
}
# runs rake tasts as vagrant user
function carry-out () {
    local gemfile=`readlink -f "${2:-/vagrant}/Gemfile"`
    as vagrant "bundle exec --gemfile=${gemfile} rake $1 >/dev/null"
}<commit_msg>Fixed dependency detection for nokogiri and added dependencies for rmagick and sqlite3.<commit_after>#!/usr/bin/env bash

provision ruby

# checks if a gem is bundled
function bundles () {
    local lockfile=`readlink -f "${2:-/vagrant/Gemfile}.lock"`
    grep -o " ${1}[ $]" $lockfile >/dev/null 2>&1
}
# installs bundle from given path or /vagrant
function install-bundle () {
    local gemfile=`readlink -f "${1:-/vagrant}/Gemfile"`

    while :
    do
        can bundle && break || gem install --no-ri --no-rdoc bundler >/dev/null
    done

    bundles pg $gemfile && {
        provision pgsql
        has libpq-dev \
        || apt-install libpq-dev
    }
    bundles curb $gemfile && {
        has libcurl4-openssl-dev \
        || apt-install libcurl4-openssl-dev
    }
    bundles nokogiri $gemfile && {
        has libxslt-dev && has libxml2-dev \
        || apt-install libxslt-dev libxml2-dev
    }
    bundles rmagick $gemfile && {
        has libmagickwand-dev \
        || apt-install libmagickwand-dev
    }
    bundles sqlite3 $gemfile && {
        has libsqlite3-dev \
        || apt-install libsqlite3-dev
    }

    echo "Installing bundle..."
    as vagrant "bundle install --no-deployment --path=~/gems --gemfile=${gemfile} --quiet --no-cache --without doc production"
}
# runs rake tasts as vagrant user
function carry-out () {
    local gemfile=`readlink -f "${2:-/vagrant}/Gemfile"`
    as vagrant "bundle exec --gemfile=${gemfile} rake $1 >/dev/null"
}
{'fraction_non_alphanumeric': 0.13822336896424622, 'fraction_numerical': 0.010320678215997052, 'mean_word_length': 2.426767676767677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '761003', 'n_tokens_mistral': 947, 'n_tokens_neox': 897, 'n_words': 246}