<commit_before>#!/bin/bash

set -x
set -e

# The current version of ruby.
rbenv_version=`rbenv version | awk '{ print $1 }'`

# The code under test.
config_dir=`pwd`

# A place to test the code.
project_dir=/tmp/config-test-project
database_dir=/tmp/config-test-database

# A place to store the test code.
project_repo_dir=/tmp/config-test-project-repo
database_repo_dir=/tmp/config-test-database-repo

# Initialize the test repos.
for dir in $project_repo_dir $database_repo_dir; do
  [ -d $dir ] && rm -rf $dir
  mkdir $dir
  cd $dir && git init --bare
done

# Initialize the test project directory.
[ -d $project_dir ] && rm -rf $project_dir
mkdir $project_dir
cd $project_dir

# Ensure we are using the right version of ruby.
rbenv local $rbenv_version

# =============================================================================
# Begin testing config.
# =============================================================================

# Initialize directory.
git init
bundle init

# Install dependencies
echo "gem 'config', :path => '$config_dir'" >> Gemfile
echo "gem 'vagrant'" >> Gemfile
bundle install --binstubs

# Initialize config.
bin/config-init-project

# Check in and push to git origin.
git add .
git commit -m 'initial comit'
git remote add origin $project_repo_dir
git push -u origin master

# Create a blueprint.
bin/config-create-blueprint webserver
git add blueprints/webserver.rb
git commit -m 'create webserver blueprint'

# Create a cluster.
bin/config-create-cluster prod
git add clusters/prod.rb
git commit -m 'create prod clsuter'

# Test that we can create a bootstrap script before firing up Vagrant.
bin/config-create-bootstrap prod webserver 1 > /dev/null<commit_msg>install local gems to avoid internet dependencies<commit_after>#!/bin/bash

set -x
set -e

# The current version of ruby.
rbenv_version=`rbenv version | awk '{ print $1 }'`

# The code under test.
config_dir=`pwd`

# A place to test the code.
project_dir=/tmp/config-test-project
database_dir=/tmp/config-test-database

# A place to store the test code.
project_repo_dir=/tmp/config-test-project-repo
database_repo_dir=/tmp/config-test-database-repo

# Initialize the test repos.
for dir in $project_repo_dir $database_repo_dir; do
  [ -d $dir ] && rm -rf $dir
  mkdir $dir
  cd $dir && git init --bare
done

# Initialize the test project directory.
[ -d $project_dir ] && rm -rf $project_dir
mkdir $project_dir
cd $project_dir

# Ensure we are using the right version of ruby.
rbenv local $rbenv_version

# =============================================================================
# Begin testing config.
# =============================================================================

# Initialize directory.
git init
bundle init

# Install dependencies
echo "gem 'config', :path => '$config_dir'" >> Gemfile
echo "gem 'vagrant'" >> Gemfile
bundle install --binstubs --local

# Check in and push to git origin.
git add .
git commit -m 'initial comit'
git remote add origin $project_repo_dir
git push -u origin master

# Create a blueprint.
bin/config-create-blueprint webserver
git add blueprints/webserver.rb
git commit -m 'create webserver blueprint'

# Create a cluster.
bin/config-create-cluster prod
git add clusters/prod.rb
git commit -m 'create prod clsuter'

# Test that we can create a bootstrap script before firing up Vagrant.
bin/config-create-bootstrap prod webserver 1 > /dev/null
{'fraction_non_alphanumeric': 0.18018812463256909, 'fraction_numerical': 0.0011757789535567313, 'mean_word_length': 4.587848932676519, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '6504504', 'n_tokens_mistral': 1046, 'n_tokens_neox': 998, 'n_words': 367}