<commit_before>#!/bin/sh

### constants
USER=`ls -l setup.sh | awk '{print $3}'`


### functions
# ...


### main
echo ""
echo "Welcome $USER!"
echo "This setup will guide you through the process of installing Mobilot on your machine."


echo ""
echo "> Have you created a MySQL database named \"mobilot\"? (Y/n)"
read answer
if [[ $answer == n ]]
then
  echo "> Create a database named \"mobilot\" first and then run this script again."
  exit 0
fi


echo "> Creating storage folders under \"app/storage\""
sudo -u $USER mkdir app/storage
sudo -u $USER mkdir app/storage/cache
sudo -u $USER mkdir app/storage/logs
sudo -u $USER mkdir app/storage/meta
sudo -u $USER mkdir app/storage/sessions
sudo -u $USER mkdir app/storage/views

# echo "> "Setting permissions for app/storage"
# sudo chown -R $USER app/storage/

echo ""
echo "> Creating \"public/upload\" folder"
sudo -u $USER mkdir public/upload


echo ""
echo "> Running \"composer install\""
sudo composer install


echo ""
echo "> What kind of environment are you using? (H̲omestead/M̲AMP/X̲AMPP)"
read answer
if [[ $answer == H ]]
then
  path="\"app/config/local/database.php\""
  echo "> Copying \"setup/database.php\" to $path"

  # the directory "local" might be missing
  if [ ! -d "app/config/local" ]
  then
    sudo -u $USER mkdir app/config/local
  fi
  sudo cp -p setup/database.php app/config/local/database.php
else
  if [[ $answer == M || $answer == X ]]
  then
    path="\"app/config/database.php\""
    echo "> Copying \"setup/database.php\" to $path"
    sudo cp -p setup/database.php app/config/database.php
  fi
fi


echo ""
echo "> IMPORTANT: Configure $path before continuing (press ENTER)"
read answer
echo ""


echo "> php artisan migrate"
php artisan migrate


echo ""
echo "> Mobilot setup completed!"


echo "> Would you like to serve Mobilot now? (Y/n)"
read answer
if [[ $answer == n ]]
then
  echo "> INFO: To serve Mobilot run: \"php artisan serve\""
  exit 0
else
  echo "> php artisan serve"
  php artisan serve
fi

exit 0
<commit_msg>Code revision setup.sh (refs #14)<commit_after>#!/bin/sh

### constants
USER=`ls -l setup.sh | awk '{print $3}'`


### functions
# ...


### main
echo ""
echo "Welcome $USER!"
echo "This setup will guide you through the process of installing Mobilot on your machine."


echo ""
echo "> Have you created a MySQL database named \"mobilot\"? (Y/n)"
read answer
if [[ $answer == n ]]
then
  echo "> Create a database named \"mobilot\" first and then run this script again."
  exit 0
fi


echo "> Creating storage folders under \"app/storage\""
sudo -u $USER mkdir app/storage
sudo -u $USER mkdir app/storage/cache
sudo -u $USER mkdir app/storage/logs
sudo -u $USER mkdir app/storage/meta
sudo -u $USER mkdir app/storage/sessions
sudo -u $USER mkdir app/storage/views

# echo "> "Setting permissions for app/storage"
# sudo chown -R $USER app/storage/

echo ""
echo "> Creating \"public/upload\" folder"
sudo -u $USER mkdir public/upload


echo ""
echo "> composer install"
sudo composer install


echo ""
echo "> What kind of environment are you using? (H̲omestead/M̲AMP/X̲AMPP)"
read answer
if [[ $answer == H ]]
then
  path="\"app/config/local/database.php\""
  echo "> Copying \"setup/database.php\" to $path"

  # the directory "local" might be missing
  if [ ! -d "app/config/local" ]
  then
    sudo -u $USER mkdir app/config/local
  fi
  sudo cp -p setup/database.php app/config/local/database.php
else
  if [[ $answer == M || $answer == X ]]
  then
    path="\"app/config/database.php\""
    echo "> Copying \"setup/database.php\" to $path"
    sudo cp -p setup/database.php app/config/database.php
  fi
fi


echo ""
echo "> IMPORTANT: Configure $path before continuing (press ENTER)"
read answer
echo ""


echo "> php artisan migrate"
php artisan migrate


echo ""
echo "> Mobilot setup completed!"


echo "> Would you like to serve Mobilot now? (Y/n)"
read answer
if [[ $answer == n ]]
then
  echo "> INFO: To serve Mobilot run: \"php artisan serve\""
  exit 0
else
  echo "> php artisan serve"
  php artisan serve
fi

exit 0

{'fraction_non_alphanumeric': 0.13757396449704143, 'fraction_numerical': 0.002465483234714004, 'mean_word_length': 3.3954496208017333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, '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': '2571398', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1308, 'n_words': 503}