<commit_before>#!/bin/bash
VERSION=$1

if [ "$VERSION" == "" ]; then
    echo "Please provide a version."
    exit 1
fi

CONTENTS=""

function get_content {
    cd $1
    DIR=${PWD##*/}
    echo -n "<dir name=\"${DIR}\">"
    for FILE in `ls`; do
        if [ -d $FILE ]; then
            get_content $FILE
        else
            HASH=`md5sum $FILE | awk '{ print $1 }'`
            echo -n "<file name=\"$FILE\" hash=\"$HASH\"/>"
        fi
    done
    echo -n "</dir>"
    cd ..
}

for dir in app shell; do 
    CONTENTS="${CONTENTS}`get_content $dir`"
done

cat << EOF > package.xml
<?xml version="1.0"?>
<package>
    <name>CoScale</name>
    <version>$VERSION</version>
    <stability>beta</stability>
    <license>Commercial</license>
    <channel>community</channel>
    <extends/>
    <summary>This module enables you to send important business and IT metrics from Magento to CoScale.</summary>
    <description>The CoScale module exposes Magento events and metrics to the CoScale Agent. The metrics contain business metrics, such as the number of products, orders, abondoned carts, etc and technical metrics such as Magento caching metrics. The events contain magento admin actions such as page cache flushes, reindexing, etc.</description>
    <notes>The CoScale module is currently in Beta</notes>
    <authors><author><name>CoScale Developer</name><user>cs-dev</user><email><EMAIL></email></author></authors>
    <date>2015-08-13</date>
    <time>09:29:57</time>
    <contents><target name="mage"><dir name=".">$CONTENTS</dir></target></contents>
    <compatible/>
    <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
</package>
EOF

tar czf CoScale-${VERSION}.tgz package.xml app shell
rm package.xml<commit_msg>Update config.xml when building new version<commit_after>#!/bin/bash
VERSION=$1

if [ "$VERSION" == "" ]; then
    echo "Please provide a version."
    exit 1
fi

CONTENTS=""

function get_content {
    cd $1
    DIR=${PWD##*/}
    echo -n "<dir name=\"${DIR}\">"
    for FILE in `ls`; do
        if [ -d $FILE ]; then
            get_content $FILE
        else
            HASH=`md5sum $FILE | awk '{ print $1 }'`
            echo -n "<file name=\"$FILE\" hash=\"$HASH\"/>"
        fi
    done
    echo -n "</dir>"
    cd ..
}

for dir in app shell; do 
    CONTENTS="${CONTENTS}`get_content $dir`"
done

cat << EOF > package.xml
<?xml version="1.0"?>
<package>
    <name>CoScale</name>
    <version>$VERSION</version>
    <stability>beta</stability>
    <license>Commercial</license>
    <channel>community</channel>
    <extends/>
    <summary>This module enables you to send important business and IT metrics from Magento to CoScale.</summary>
    <description>The CoScale module exposes Magento events and metrics to the CoScale Agent. The metrics contain business metrics, such as the number of products, orders, abondoned carts, etc and technical metrics such as Magento caching metrics. The events contain magento admin actions such as page cache flushes, reindexing, etc.</description>
    <notes>The CoScale module is currently in Beta</notes>
    <authors><author><name>CoScale Developer</name><user>cs-dev</user><email><EMAIL></email></author></authors>
    <date>2015-08-13</date>
    <time>09:29:57</time>
    <contents><target name="mage"><dir name=".">$CONTENTS</dir></target></contents>
    <compatible/>
    <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
</package>
EOF

sed -i "s/<version>.*<\/version>/<version>$VERSION<\/version>/" app/code/community/CoScale/Monitor/etc/config.xml

tar czf CoScale-${VERSION}.tgz package.xml app shell
rm package.xml
{'fraction_non_alphanumeric': 0.15903549173665674, 'fraction_numerical': 0.014630181522622595, 'mean_word_length': 3.4268585131894485, 'pattern_counts': {'":': 0, '<': 121, '<?xml version=': 2, '>': 119, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2285662', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1136, 'n_words': 330}