<commit_before>#!/bin/bash

if [ "$(uname)" == "Darwin" ]; then
    export JAVA_HOME=$(/usr/libexec/java_home)
    export JRE_HOME=${JAVA_HOME}/jre
else
    export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
    export JRE_HOME="/usr/lib/jvm/java-7-openjdk-amd64/jre"
fi

mkdir -vp ${PREFIX}/bin;
mkdir -vp ${PREFIX}/lib/nutch/bin;
mkdir -vp ${PREFIX}/lib/nutch/lib;
mkdir -vp ${PREFIX}/lib/nutch/plugins;
mkdir -vp ${PREFIX}/lib/nutch/conf;

# build nutch
ant

pushd runtime/local/
cp -r bin/* ${PREFIX}/lib/nutch/bin/
cp -r lib/* ${PREFIX}/lib/nutch/lib/
cp -r plugins/* ${PREFIX}/lib/nutch/plugins/
cp -r conf/* ${PREFIX}/lib/nutch/conf/
popd

cp ${RECIPE_DIR}/nutch-site.xml ${PREFIX}/lib/nutch/conf/

pushd "${PREFIX}/bin"

cat > ${PREFIX}/bin/nutch <<EOF
#!/bin/bash

if [ "$(uname)" == "Darwin" ]; then
    export JAVA_HOME=$(/usr/libexec/java_home)
    export JRE_HOME=${JAVA_HOME}/jre
else
    export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
    export JRE_HOME="/usr/lib/jvm/java-7-openjdk-amd64/jre"
fi

pushd ${PREFIX}/lib/nutch/
./bin/nutch \$@
popd
EOF

cat > ${PREFIX}/bin/crawl<<EOF
#!/bin/bash

if [ "$(uname)" == "Darwin" ]; then
    export JAVA_HOME=$(/usr/libexec/java_home)
    export JRE_HOME=${JAVA_HOME}/jre
else
    export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
    export JRE_HOME="/usr/lib/jvm/java-7-openjdk-amd64/jre"
fi

pushd ${PREFIX}/lib/nutch/
./bin/crawl \$@
popd
EOF

chmod +x ${PREFIX}/bin/crawl || exit 1;
chmod +x ${PREFIX}/bin/nutch || exit 1;

cp ${RECIPE_DIR}/nutch-site.xml ${PREFIX}/lib/nutch/conf/nutch-site.xml
cp ${RECIPE_DIR}/regex-urlfilter.txt ${PREFIX}/lib/nutch/conf/regex-urlfilter.txt<commit_msg>updating nutch recipe to check if JAVA_HOME exists already<commit_after>#!/bin/bash

if [ "$(uname)" == "Darwin" ]; then
    export JAVA_HOME=$(/usr/libexec/java_home)
    export JRE_HOME=${JAVA_HOME}/jre
else
    export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
    export JRE_HOME="/usr/lib/jvm/java-7-openjdk-amd64/jre"
fi

mkdir -vp ${PREFIX}/bin;
mkdir -vp ${PREFIX}/lib/nutch/bin;
mkdir -vp ${PREFIX}/lib/nutch/lib;
mkdir -vp ${PREFIX}/lib/nutch/plugins;
mkdir -vp ${PREFIX}/lib/nutch/conf;

# build nutch
ant

pushd runtime/local/
cp -r bin/* ${PREFIX}/lib/nutch/bin/
cp -r lib/* ${PREFIX}/lib/nutch/lib/
cp -r plugins/* ${PREFIX}/lib/nutch/plugins/
cp -r conf/* ${PREFIX}/lib/nutch/conf/
popd

cp ${RECIPE_DIR}/nutch-site.xml ${PREFIX}/lib/nutch/conf/

pushd "${PREFIX}/bin"

cat > ${PREFIX}/bin/nutch <<EOF
#!/bin/bash

if [ "$(uname)" == "Darwin" ]; then
    export JAVA_HOME=$(/usr/libexec/java_home)
    export JRE_HOME=${JAVA_HOME}/jre
else
    export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
    export JRE_HOME="/usr/lib/jvm/java-7-openjdk-amd64/jre"
fi

pushd ${PREFIX}/lib/nutch/
./bin/nutch \$@
popd
EOF

cat > ${PREFIX}/bin/crawl<<EOF
#!/bin/bash

if [ -z "$JAVA_HOME" ]; then
    if [ "$(uname)" == "Darwin" ]; then
    export JAVA_HOME=$(/usr/libexec/java_home)
    export JRE_HOME=${JAVA_HOME}/jre
else
    export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/"
    export JRE_HOME="/usr/lib/jvm/java-7-openjdk-amd64/jre"
fi

else
    echo "JAVA_HOME is set to '$JAVA_HOME'";
fi


pushd ${PREFIX}/lib/nutch/
./bin/crawl \$@
popd
EOF

chmod +x ${PREFIX}/bin/crawl || exit 1;
chmod +x ${PREFIX}/bin/nutch || exit 1;

cp ${RECIPE_DIR}/nutch-site.xml ${PREFIX}/lib/nutch/conf/nutch-site.xml
cp ${RECIPE_DIR}/regex-urlfilter.txt ${PREFIX}/lib/nutch/conf/regex-urlfilter.txt
{'fraction_non_alphanumeric': 0.200461494087107, 'fraction_numerical': 0.011537352177675224, 'mean_word_length': 3.6864864864864866, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '5899405', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1448, 'n_words': 255}