<commit_before>#!/bin/bash
# This script pushes the styleguide into the gh-pages branch
set -e

PAGES_DIR=./gh-pages
DOCS_DIR=./out
REPO="https://${GH_TOKEN}@github.com/contentful/contentful.js.git"
VERSION=`cat package.json|grep version|sed -e 's/.*version": "//g'|sed -e 's/",.*//g'`

echo "Publishing docs"

if ! [ -d $DOCS_DIR ] ; then
  echo "Docs can't be found. Maybe you haven't generated them?"
  exit 1
fi

# get the gh-pages branch of the repo
if [ ! -d $PAGES_DIR ] ; then
  git clone --single-branch --branch gh-pages $REPO $PAGES_DIR
fi

cp -r $DOCS_DIR/* $PAGES_DIR
echo "<meta http-equiv=\"refresh\" content=\"0; url=https://contentful.github.io/contentful.js/contentful/${VERSION}/\">" > $PAGES_DIR/index.html

pushd $PAGES_DIR
git add .
git commit -a -m "Docs update"
if [ $? -eq 1 ] ; then
  echo "Nothing to update"
else
  git push origin gh-pages
fi
popd<commit_msg>fix(docs): Fix version fetching in docs publishing script<commit_after>#!/bin/bash
# This script pushes the styleguide into the gh-pages branch
set -e

PAGES_DIR=./gh-pages
DOCS_DIR=./out
REPO="https://${GH_TOKEN}@github.com/contentful/contentful.js.git"
VERSION=`cat package.json|json version`

echo "Publishing docs"

if ! [ -d $DOCS_DIR ] ; then
  echo "Docs can't be found. Maybe you haven't generated them?"
  exit 1
fi

# get the gh-pages branch of the repo
if [ ! -d $PAGES_DIR ] ; then
  git clone --single-branch --branch gh-pages $REPO $PAGES_DIR
fi

cp -r $DOCS_DIR/* $PAGES_DIR
echo "<meta http-equiv=\"refresh\" content=\"0; url=https://contentful.github.io/contentful.js/contentful/${VERSION}/\">" > $PAGES_DIR/index.html

pushd $PAGES_DIR
git add .
git commit -a -m "Docs update"
if [ $? -eq 1 ] ; then
  echo "Nothing to update"
else
  git push origin gh-pages
fi
popd
{'fraction_non_alphanumeric': 0.1513269339356296, 'fraction_numerical': 0.0033879164313946925, 'mean_word_length': 3.8021680216802167, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '189881', 'n_tokens_mistral': 694, 'n_tokens_neox': 654, 'n_words': 195}