<commit_before>#!/bin/bash
set -e

CMD='./cyber-dojo'

    LS="${CMD} start-point ls --quiet"
CREATE="${CMD} start-point create"
    RM="${CMD} start-point rm"
  DOWN="${CMD} down"
    UP="${CMD} up"
UPDATE="${CMD} update"

REPO='https://github.com/cyber-dojo/start-points'

LANGUAGE_LIST='https://raw.githubusercontent.com/cyber-dojo/start-points-languages/master/languages_list'
EXERCISES_GIT=${REPO}-exercises
CUSTOM_GIT=${REPO}-custom

# - - - - - - - - - - - - - - - - - - - - - - - - - - - -

echo "===Cleaning out old images/volumes/containers"
${CMD} clean

if ${LS} | grep -q 'green_languages'; then
  echo "===Switching from green to blue"
  echo "===Preparing new blue"
  echo "===Creating languages"
  ${CREATE} blue_languages --list=${LANGUAGE_LIST}
  echo "===Creating exercises"
  ${CREATE} blue_exercises --git=${EXERCISES_GIT}
  echo "===Creating custom"
  ${CREATE} blue_custom    --git=${CUSTOM_GIT}
  echo "===Updating server and language images"
  ${UPDATE} server
  echo "===Switching to blue"
  ${UP} --languages=blue_languages --exercises=blue_exercises --custom=blue_custom
  echo "===Deleting old green"
  ${RM} green_languages &>/dev/null
  ${RM} green_exercises &>/dev/null
  ${RM} green_custom    &>/dev/null
else
  echo "===Switching from blue to green"
  echo "===Preparing new green"
  echo "===Creating languages"
  ${CREATE} green_languages --list=${LANGUAGE_LIST}
  echo "===Creating exercises"
  ${CREATE} green_exercises --git=${EXERCISES_GIT}
  echo "===Creating custom"
  ${CREATE} green_custom    --git=${CUSTOM_GIT}
  echo "===Updating server and language images"
  ${UPDATE} server
  echo "===Switching to green"
  ${UP} --languages=green_languages --exercises=green_exercises --custom=green_custom
  echo "===Deleting old blue"
  ${RM} blue_languages &>/dev/null
  ${RM} blue_exercises &>/dev/null
  ${RM} blue_custom    &>/dev/null
fi<commit_msg>update server images before creating start-points as commander may have updated validation of a start-point<commit_after>#!/bin/bash
set -e

readonly CMD='./cyber-dojo'

readonly     LS="${CMD} start-point ls --quiet"
readonly CREATE="${CMD} start-point create"
readonly     RM="${CMD} start-point rm"
readonly     UP="${CMD} up"
readonly UPDATE="${CMD} update"

readonly REPO='https://github.com/cyber-dojo/start-points'

readonly LANGUAGE_LIST='https://raw.githubusercontent.com/cyber-dojo/start-points-languages/master/languages_list'
readonly EXERCISES_GIT=${REPO}-exercises
readonly CUSTOM_GIT=${REPO}-custom

# - - - - - - - - - - - - - - - - - - - - - - - - - - - -

echo "===Cleaning out old images/volumes/containers"
${CMD} clean

echo "===Updating server images"
${UPDATE} server

if ${LS} | grep -q 'green_languages'; then
  echo "===Switching from green to blue"
  echo "===Preparing new blue"
  echo "===Creating languages"
  ${CREATE} blue_languages --list=${LANGUAGE_LIST}
  echo "===Creating exercises"
  ${CREATE} blue_exercises --git=${EXERCISES_GIT}
  echo "===Creating custom"
  ${CREATE} blue_custom    --git=${CUSTOM_GIT}
  echo "===Switching to blue"
  ${UP} --languages=blue_languages --exercises=blue_exercises --custom=blue_custom
  echo "===Deleting old green"
  ${RM} green_languages &>/dev/null
  ${RM} green_exercises &>/dev/null
  ${RM} green_custom    &>/dev/null
else
  echo "===Switching from blue to green"
  echo "===Preparing new green"
  echo "===Creating languages"
  ${CREATE} green_languages --list=${LANGUAGE_LIST}
  echo "===Creating exercises"
  ${CREATE} green_exercises --git=${EXERCISES_GIT}
  echo "===Creating custom"
  ${CREATE} green_custom    --git=${CUSTOM_GIT}
  echo "===Switching to green"
  ${UP} --languages=green_languages --exercises=green_exercises --custom=green_custom
  echo "===Deleting old blue"
  ${RM} blue_languages &>/dev/null
  ${RM} blue_exercises &>/dev/null
  ${RM} blue_custom    &>/dev/null
fi
{'fraction_non_alphanumeric': 0.17512953367875647, 'fraction_numerical': 0.0, 'mean_word_length': 4.080263157894737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1029056', 'n_tokens_mistral': 1405, 'n_tokens_neox': 1352, 'n_words': 317}