#!/bin/bash

echo "Rust-ci putdocs starting"

DOCROOT=doc
export AWS_DEFAULT_REGION=eu-west-1
export AWS_ACCESS_KEY_ID={{ s3_access_key_id }}
export AWS_SECRET_ACCESS_KEY={{ s3_secret_access_key }}
DOCPATHS=`find $DOCROOT -name index.html | cut -d/ -f2 | paste -sd ","`

if [[ ! -z $DOCPATHS ]]; then
    echo "Uploading docs for $DOCPATHS"

    sudo apt-get install python-virtualenv > /dev/null
    virtualenv docenv > /dev/null
    . docenv/bin/activate
    pip install --quiet awscli
    aws s3 cp $DOCROOT s3://rust-ci-artifacts/artifacts/{{ project_identifier }}/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --recursive

    curl http://rust-ci.org/artifacts/putdocshook?build=$TRAVIS_BUILD_ID&job=$TRAVIS_JOB_ID&buildnumber=$TRAVIS_BUILD_NUMBER&token=$RUSTCI_TOKEN&docpaths=$DOCPATHS
else
    echo "No docs found in directory $DOCROOT"
fi


#!/bin/bash

echo "Rust-ci putdocs starting"

DOCROOT=doc
export AWS_DEFAULT_REGION=eu-west-1
export AWS_ACCESS_KEY_ID={{ s3_access_key_id }}
export AWS_SECRET_ACCESS_KEY={{ s3_secret_access_key }}
DOCPATHS=`find $DOCROOT -name index.html | cut -d/ -f2 | paste -sd ","`

if [[ ! -z $DOCPATHS ]]; then
    echo "Uploading docs for $DOCPATHS"

    sudo apt-get install python-virtualenv > /dev/null
    virtualenv docenv > /dev/null
    . docenv/bin/activate
    pip install --quiet awscli
    aws s3 cp $DOCROOT s3://rust-ci-artifacts/artifacts/{{ project_identifier }}/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --recursive

    curl http://www.rust-ci.org/artifacts/putdocshook?build=$TRAVIS_BUILD_ID&job=$TRAVIS_JOB_ID&buildnumber=$TRAVIS_BUILD_NUMBER&token=$RUSTCI_TOKEN&docpaths=$DOCPATHS
else
    echo "No docs found in directory $DOCROOT"
fi


Use www.rust-ci, not rust-ci for putdocs
Use www.rust-ci, not rust-ci for putdocs
