<commit_before>#!/usr/bin/python

def main():
    say('Pentaho Report Test Framework Development Setup Helper')

    say('Trying to run Java... ')
    if run('java -version'):
        say('OK!')
    else:
        fail('java', 'not found. Must be in PATH. Java is needed to run Maven.')
        say('No java.')

    say('Trying to run Maven... ')
    if run('mvn -version'):
        say('OK!')
    else:
        fail('maven', 'not found. Must be in PATH. Maven is needed to run tests.')
        say('No maven.')

    pdiPath = ""
    if promptYesNo('Should I look for PDI at %s? [Y/n]: ' % get_for_os('pdi')) == 'yes':
        pdiPath = get_for_os('pdi')
    else:
        while pdiPath == "":
            pdiPath = prompt('Ok, where? ')

    panPath = os.path.join(pdiPath, get_for_os('pan_script'))
    if os.path.exists(panPath):
        say('OK!')
    else:
        fail('pdi', '%s not found. PDI is needed to run tests.' % panPath)
        say('No pdi.')

    if 'pdi' not in failed:
        say('Trying to run Pan... ')
        if run('%s -version' % panPath, badExitCode=True):
            say('OK!')
        else:
            fail('pdi', 'Couldn''t run Pan, necessary for tests.')
            say('Didn''t work.')

    if 'pdi' in failed:
        say('PDI wasn''t found, skipped check for Pentaho Reporting Output plugin.')
        fail('pdi', 'Pentaho Reporting Output plugin not found, but is needed to run tests.')
    else:
        say('Looking for Pentaho Reporting Output plugin...')
        if os.path.exists(os.path.join(panPath)):
            say('OK!')
        else:
            fail('pdi', '%s not found.' % panPath)

    if 'pdi' not in failed:
        dbSettingsFile = os.path.join(get_for_os('pdi'), 'simple-jndi', 'jdbc.properties')
        say('Be sure to configure your database connections in %s' % dbSettingsFile)

    say('')
    say('DONE.')
    say('')
    if failed:
        say('THERE WERE ERRORS. You\'ll have to fix the following before you continue:')
        for msg in failmsgs:
            say(msg)
    else:<commit_msg>WIP MIFOSBI-144 - store local settings for test harness<commit_after>#!/usr/bin/python

def main():
    say('Pentaho Report Test Framework Development Setup Helper')

    say('Trying to run Java... ')
    if run('java -version'):
        say('OK!')
    else:
        fail('java', 'not found. Must be in PATH. Java is needed to run Maven.')
        say('No java.')

    say('Trying to run Maven... ')
    if run('mvn -version'):
        say('OK!')
    else:
        fail('maven', 'not found. Must be in PATH. Maven is needed to run tests.')
        say('No maven.')

    pdiPath = ""
    if promptYesNo('Should I look for PDI at %s? [Y/n]: ' % get_for_os('pdi')) == 'yes':
        pdiPath = get_for_os('pdi')
    else:
        while pdiPath == "":
            pdiPath = prompt('Ok, where? ')

    panPath = os.path.join(pdiPath, get_for_os('pan_script'))
    if os.path.exists(panPath):
        say('OK!')
    else:
        fail('pdi', '%s not found. PDI is needed to run tests.' % panPath)
        say('No pdi.')

    if 'pdi' not in failed:
        say('Trying to run Pan... ')
        if run('%s -version' % panPath, badExitCode=True):
            say('OK!')
        else:
            fail('pdi', 'Couldn''t run Pan, necessary for tests.')
            say('Didn''t work.')

    if 'pdi' in failed:
        say('PDI wasn''t found, skipped check for Pentaho Reporting Output plugin.')
        fail('pdi', 'Pentaho Reporting Output plugin not found, but is needed to run tests.')
    else:
        say('Looking for Pentaho Reporting Output plugin...')
        if os.path.exists(os.path.join(panPath)):
            say('OK!')
        else:
            fail('pdi', '%s not found.' % panPath)

    say('Storing local settings...')
    if 'pdi' not in failed:
        userHome = os.getenv('USERPROFILE') or os.getenv('HOME')
        prestoSettings = os.path.join(userHome, '.presto')
        if promptYesNo('%s exists. Overwrite? [Y/n]: ' % prestoSettings) == 'yes':
            prestoSettingsFd = open(prestoSettings, 'w')
            print >> prestoSettingsFd, 'pdiPath=%s' % pdiPath
            prestoSettingsFd.close()
            say('Wrote %s' % prestoSettings)
        else:
            say('Ok, not touching %s.' % prestoSettings)

    if 'pdi' not in failed:
        dbSettingsFile = os.path.join(pdiPath, 'simple-jndi', 'jdbc.properties')
        say('')
        say('Be sure to configure your database connections in %s' % dbSettingsFile)
        say('SourceDB must be a Mifos OLTP database, DestinationDB must be a Mifos BI data warehouse.')
        say('Mysql connection URL must include useUnicode=true&characterEncoding=UTF-8.')

    say('')
    say('DONE.')
    say('')
    if failed:
        say('THERE WERE ERRORS. You\'ll have to fix the following before you continue:')
        for msg in failmsgs:
            say(msg)
    else:
{'fraction_non_alphanumeric': 0.14609263415629464, 'fraction_numerical': 0.0008161599673536013, 'mean_word_length': 2.2593085106382977, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '870411', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1569, 'n_words': 483}