<?php
/********************************************************************************
 * (c)1337 aheadware.com - All rights reserved
 ********************************************************************************/
include_once 'build_inc.php';

function task_buildNativeClient() {
    global $local_temp_dir,
           $local_source_dir;


    $clientDir = $local_source_dir . '/apps/teambuddy/public/client';

    // Setup destintation
    windowsRemoveDir( $local_temp_dir . '/native-client-build' );
    localMkdir( $local_temp_dir . '/native-client-build' );

    // Copy folders
    localRCopy( $clientDir . '/css', $local_temp_dir . '/native-client-build/css' );
    localRCopy( $clientDir . '/fonts', $local_temp_dir . '/native-client-build/fonts' );
    localRCopy( $clientDir . '/img', $local_temp_dir . '/native-client-build/img' );
    localRCopy( $clientDir . '/js', $local_temp_dir . '/native-client-build/js' );

    // Compile index.html
    ob_start();
    include_once $clientDir . '/index.php';
    $index = ob_get_clean();
    $fh = fopen( $local_temp_dir . '/native-client-build/index.html', 'w' );
    fputs( $fh, $index );
    fclose( $fh );

    localZipFolder( $local_temp_dir . '/native-client-build', $local_temp_dir . '/tb-native-client.zip' );
}

task_buildNativeClient();