<commit_before>#!/bin/bash

set -e -u
#set -x

# put npm's copy of node-gyp on the PATH
export PATH=`npm explore npm -g -- pwd`/bin/node-gyp-bin:$PATH
export PATH=`pwd`/bin:$PATH
BASE=`pwd`

function setup {
    # nothing yet
    true
}

function teardown {
    # nothing yet
    true
}

function MARK {
    echo
    echo "*** $1 ($2) ***"
    echo
}

function build_app {
    WD=$( cd $BASE/test/$1 && pwd )

    rm -rf ${WD}/lib/binding/*
    rm -rf ${WD}/build/*

    MARK "A" $1
    # test install from binary with fallback
    # run directly against node-pre-gyp
    node-pre-gyp clean -C $WD
    if [[ $1  == "app2" ]]; then
        node-pre-gyp -C $WD install --fallback-to-build --custom_include_path=$WD/include
    else
        node-pre-gyp -C $WD install --fallback-to-build
    fi
    # run npm commands from correct directory
    cd $WD && npm test && cd $BASE

    if [[ $node_pre_gyp_accessKeyId ]] || [[ -f $HOME/.node_pre_gyprc ]] ; then
        MARK "D" $1
        # it works, so now publish
        node-pre-gyp -C $WD unpublish package publish
        node-pre-gyp -C $WD testpackage --overwrite
        node-pre-gyp -C $WD unpublish
        node-pre-gyp -C $WD publish

        # now test listing published binaries
        CURRENT_ARCH=$(node -e "console.log(process.arch)")
        CURRENT_PLATFORM=$(node -e "console.log(process.platform)")
        BINARIES=$(node-pre-gyp -C $WD info --loglevel warn)
        # now ensure that both the current arch and platform
        # show up in the published listing<commit_msg>handle unbound variable<commit_after>#!/bin/bash

set -e -u
#set -x

# put npm's copy of node-gyp on the PATH
export PATH=`npm explore npm -g -- pwd`/bin/node-gyp-bin:$PATH
export PATH=`pwd`/bin:$PATH
BASE=`pwd`

function setup {
    # nothing yet
    true
}

function teardown {
    # nothing yet
    true
}

function MARK {
    echo
    echo "*** $1 ($2) ***"
    echo
}

function build_app {
    WD=$( cd $BASE/test/$1 && pwd )

    rm -rf ${WD}/lib/binding/*
    rm -rf ${WD}/build/*

    MARK "A" $1
    # test install from binary with fallback
    # run directly against node-pre-gyp
    node-pre-gyp clean -C $WD
    if [[ $1  == "app2" ]]; then
        node-pre-gyp -C $WD install --fallback-to-build --custom_include_path=$WD/include
    else
        node-pre-gyp -C $WD install --fallback-to-build
    fi
    # run npm commands from correct directory
    cd $WD && npm test && cd $BASE

    if [[ "${node_pre_gyp_accessKeyId:-false}" != false ]] || [[ -f $HOME/.node_pre_gyprc ]] ; then
        MARK "D" $1
        # it works, so now publish
        node-pre-gyp -C $WD unpublish package publish
        node-pre-gyp -C $WD testpackage --overwrite
        node-pre-gyp -C $WD unpublish
        node-pre-gyp -C $WD publish

        # now test listing published binaries
        CURRENT_ARCH=$(node -e "console.log(process.arch)")
        CURRENT_PLATFORM=$(node -e "console.log(process.platform)")
        BINARIES=$(node-pre-gyp -C $WD info --loglevel warn)
        # now ensure that both the current arch and platform
        # show up in the published listing
{'fraction_non_alphanumeric': 0.13367609254498714, 'fraction_numerical': 0.004498714652956298, 'mean_word_length': 2.2906976744186047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4448910', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1048, 'n_words': 326}