<commit_before>#!/bin/sh

set -e

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_KEY_ID" ]; then
    error 'Please specify a key-id.';
    exit 1;
else
    export AWS_ACCESS_KEY_ID="$WERCKER_OPSWORKS_DEPLOY_KEY_ID";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_KEY_SECRET" ]; then
    error 'Please specify a key-secret.';
    exit 1;
else
    export AWS_SECRET_ACCESS_KEY="$WERCKER_OPSWORKS_DEPLOY_KEY_SECRET";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_STACK_ID" ]; then
    error 'Please specify a stack-id.';
    exit 1;
else
    export AWS_OPSWORKS_STACK_ID="$WERCKER_OPSWORKS_DEPLOY_STACK_ID";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_APP_ID" ]; then
    error 'Please specify an app-id.';
    exit 1;
else
    export AWS_OPSWORKS_APP_ID="$WERCKER_OPSWORKS_DEPLOY_APP_ID";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_REGION" ]; then
    export AWS_DEFAULT_REGION="us-east-1";
else
    export AWS_DEFAULT_REGION="$WERCKER_OPSWORKS_DEPLOY_REGION";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_MIGRATE" ]; then
    export AWS_OPSWORKS_MIGRATE="false";
else
    export AWS_OPSWORKS_MIGRATE="$WERCKER_OPSWORKS_DEPLOY_MIGRATE";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_COMMENT" ]; then
    export DEPLOY_COMMENT="Wercker deploy by $WERCKER_STARTED_BY.";
else
    export DEPLOY_COMMENT="$WERCKER_OPSWORKS_DEPLOY_COMMENT";
fi

info 'Installing Python...';
sudo apt-get update -y;
sudo apt-get install python -y;

info 'Installing the AWS CLI...';
sudo pip install awscli;

info 'Deploying...';
aws opsworks create-deployment \
    --stack-id $AWS_OPSWORKS_STACK_ID \
    --app-id $AWS_OPSWORKS_APP_ID \
    --comment "$DEPLOY_COMMENT" \
    --command "{
      \"Name\": \"deploy\",
      \"Args\": {
        \"migrate\": [\"$AWS_OPSWORKS_MIGRATE\"]
      }
    }";<commit_msg>Switch over to the new deploy command<commit_after>#!/bin/sh

set -e

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_KEY_ID" ]; then
    error 'Please specify a key-id.';
    exit 1;
else
    export AWS_ACCESS_KEY_ID="$WERCKER_OPSWORKS_DEPLOY_KEY_ID";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_KEY_SECRET" ]; then
    error 'Please specify a key-secret.';
    exit 1;
else
    export AWS_SECRET_ACCESS_KEY="$WERCKER_OPSWORKS_DEPLOY_KEY_SECRET";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_STACK_ID" ]; then
    error 'Please specify a stack-id.';
    exit 1;
else
    export AWS_OPSWORKS_STACK_ID="$WERCKER_OPSWORKS_DEPLOY_STACK_ID";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_APP_ID" ]; then
    error 'Please specify an app-id.';
    exit 1;
else
    export AWS_OPSWORKS_APP_ID="$WERCKER_OPSWORKS_DEPLOY_APP_ID";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_REGION" ]; then
    export AWS_DEFAULT_REGION="us-east-1";
else
    export AWS_DEFAULT_REGION="$WERCKER_OPSWORKS_DEPLOY_REGION";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_MIGRATE" ]; then
    export AWS_OPSWORKS_MIGRATE="false";
else
    export AWS_OPSWORKS_MIGRATE="$WERCKER_OPSWORKS_DEPLOY_MIGRATE";
fi

if [ ! -n "$WERCKER_OPSWORKS_DEPLOY_COMMENT" ]; then
    export DEPLOY_COMMENT="Wercker deploy by $WERCKER_STARTED_BY.";
else
    export DEPLOY_COMMENT="$WERCKER_OPSWORKS_DEPLOY_COMMENT";
fi

info 'Installing Node...';
sudo apt-get update -y;
sudo apt-get install nodejs -y;

info 'Installing the CLI...';
sudo npm install -g .

info 'Deploying...';
deploy opsworks \
    --stack-id $AWS_OPSWORKS_STACK_ID \
    --app-id $AWS_OPSWORKS_APP_ID \
    --comment "$DEPLOY_COMMENT";
{'fraction_non_alphanumeric': 0.11908306043465317, 'fraction_numerical': 0.002977076510866329, 'mean_word_length': 4.177195685670262, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6040152', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1449, 'n_words': 266}