<commit_before>#!/bin/bash

set -ex

if [ "x$TEST" == "x" ] ; then
  TEST=false
fi


cd `dirname $0`/..
mako_renderer=tools/buildgen/mako_renderer.py
gen_build_json=test/core/end2end/gen_build_json.py

end2end_test_build=`mktemp`
$gen_build_json > $end2end_test_build

global_plugins=`find ./tools/buildgen/plugins -name '*.py' |
  sort | grep -v __init__ |
  while read p ; do echo -n "-p $p " ; done`

for dir in . ; do
  local_plugins=`find $dir/templates -name '*.py' |
    sort | grep -v __init__ |
    while read p ; do echo -n "-p $p " ; done`

  plugins="$global_plugins $local_plugins"

  find -L $dir/templates -type f -and -name *.template | while read file ; do
    out=${dir}/${file#$dir/templates/}  # strip templates dir prefix
    out=${out%.*}  # strip template extension
    json_files="build.json $end2end_test_build"
    data=`for i in $json_files; do echo -n "-d $i "; done`
    if [ $TEST == true ] ; then
      actual_out=$out
      out=`mktemp`
    else
      g4 open $out || true
    fi
    $mako_renderer $plugins $data -o $out $file
    if [ $TEST == true ] ; then
      diff -q $out $actual_out
      rm $out
    fi<commit_msg>Make generate_projects.sh able to run from a git repo. 	Change on 2015/01/09 by ctiller <<EMAIL>> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=83627504<commit_after>#!/bin/bash

set -x

if [ "x$TEST" == "x" ] ; then
  TEST=false
fi


cd `dirname $0`/../..
mako_renderer=tools/buildgen/mako_renderer.py
gen_build_json=test/core/end2end/gen_build_json.py

end2end_test_build=`mktemp`
$gen_build_json > $end2end_test_build

global_plugins=`find ./tools/buildgen/plugins -name '*.py' |
  sort | grep -v __init__ |
  while read p ; do echo -n "-p $p " ; done`

for dir in . ; do
  local_plugins=`find $dir/templates -name '*.py' |
    sort | grep -v __init__ |
    while read p ; do echo -n "-p $p " ; done`

  plugins="$global_plugins $local_plugins"

  find -L $dir/templates -type f -and -name *.template | while read file ; do
    out=${dir}/${file#$dir/templates/}  # strip templates dir prefix
    out=${out%.*}  # strip template extension
    json_files="build.json $end2end_test_build"
    data=`for i in $json_files; do echo -n "-d $i "; done`
    if [ $TEST == true ] ; then
      actual_out=$out
      out=`mktemp`
    fi
    $mako_renderer $plugins $data -o $out $file
    if [ $TEST == true ] ; then
      diff -q $out $actual_out
      rm $out
    fi
{'fraction_non_alphanumeric': 0.149673735725938, 'fraction_numerical': 0.01101141924959217, 'mean_word_length': 2.9248, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5983648', 'n_tokens_mistral': 939, 'n_tokens_neox': 904, 'n_words': 251}