<commit_before>#!/bin/bash

set -o nounset -o errexit -o pipefail -o errtrace

error() {
   local sourcefile=$1
   local lineno=$2
   echo "ERROR at ${sourcefile}:${lineno}; Last logs:"
   grep otto /var/log/syslog | tail -n 20
}
trap 'error "${BASH_SOURCE}" "${LINENO}"' ERR

oe() { "$@" 2>&1 | logger -t otto > /dev/null; }
ol() { echo "[otto] $@"; }

# cloud-config can interfere with apt commands if it's still in progress
ol "Waiting for cloud-config to complete..."
until [[ -f /var/lib/cloud/instance/boot-finished ]]; do
  sleep 0.5
done

ol "Adding apt respositories and updating..."
export DEBIAN_FRONTEND=noninteractive
oe sudo apt-get update -y
oe sudo apt-get install -y software-properties-common
oe sudo add-apt-repository -y ppa:chris-lea/node.js
oe sudo add-apt-repository -y ppa:ondrej/php5-5.6
# Seems to be required to prevent "unauthenticated packages"
# errors out of apt-get install.
oe sudo apt-key update
oe sudo apt-get update -y

ol "Installing PHP VCSs, Apache, and other packages..."
oe sudo apt-get install -y apache2 php5 libapache2-mod-php5 \
  bzr git mercurial build-essential \
  curl \
  php5-mcrypt php5-mysql php5-fpm php5--gd php5-readline php5-pgsql

ol "Extracting app..."
sudo mkdir -p /srv/otto-app
sudo tar zxf /tmp/otto-app.tgz -C /srv/otto-app

ol "Setting permissions..."
oe sudo chown -R www-data: /srv/otto-app

if [ -f /srv/otto-app/composer.json ]; then
  ol "Installing Composer..."
  cd /tmp<commit_msg>app/php: fix typo in package name<commit_after>#!/bin/bash

set -o nounset -o errexit -o pipefail -o errtrace

error() {
   local sourcefile=$1
   local lineno=$2
   echo "ERROR at ${sourcefile}:${lineno}; Last logs:"
   grep otto /var/log/syslog | tail -n 20
}
trap 'error "${BASH_SOURCE}" "${LINENO}"' ERR

oe() { "$@" 2>&1 | logger -t otto > /dev/null; }
ol() { echo "[otto] $@"; }

# cloud-config can interfere with apt commands if it's still in progress
ol "Waiting for cloud-config to complete..."
until [[ -f /var/lib/cloud/instance/boot-finished ]]; do
  sleep 0.5
done

ol "Adding apt respositories and updating..."
export DEBIAN_FRONTEND=noninteractive
oe sudo apt-get update -y
oe sudo apt-get install -y software-properties-common
oe sudo add-apt-repository -y ppa:chris-lea/node.js
oe sudo add-apt-repository -y ppa:ondrej/php5-5.6
# Seems to be required to prevent "unauthenticated packages"
# errors out of apt-get install.
oe sudo apt-key update
oe sudo apt-get update -y

ol "Installing PHP VCSs, Apache, and other packages..."
oe sudo apt-get install -y apache2 php5 libapache2-mod-php5 \
  bzr git mercurial build-essential \
  curl \
  php5-mcrypt php5-mysql php5-fpm php5-gd php5-readline php5-pgsql

ol "Extracting app..."
sudo mkdir -p /srv/otto-app
sudo tar zxf /tmp/otto-app.tgz -C /srv/otto-app

ol "Setting permissions..."
oe sudo chown -R www-data: /srv/otto-app

if [ -f /srv/otto-app/composer.json ]; then
  ol "Installing Composer..."
  cd /tmp
{'fraction_non_alphanumeric': 0.13408393039918118, 'fraction_numerical': 0.014329580348004094, 'mean_word_length': 3.4024024024024024, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5557220', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1045, 'n_words': 352}