Provi.php

<?php

namespace Tlf;

/**
 * Used to view & route a single git project. Multiple viewers can be used in conjunction.
 */
class Provi {

    /**
     * The directory to show
     */
    protected $srcDir;

    /**
     * @param $gitBare true to treat current dir as git --bare. `false` to treat current dir as a single git branch
     */
    protected $gitBare = false;

    public function __construct($dir, $gitBare=false){
        $this->srcDir = $dir;
        $this->gitBare = $gitBare;
    }


    static public function deliver(){
        $dirToView = $_SERVER['DOCUMENT_ROOT'];
        $url = $_SERVER['REQUEST_URI'];
        $lia = new \Liaison();

        $lia->addResourceFile(\Tlf\Js\Autowire::filePath());
        $dir = dirname(__DIR__.'/..',2);

        $viewerApp = new \Lia\Package($lia,$dir,['baseUrl'=>'/','projects'=>[$dirToView]]);

        $lia->set('lia:cache.dir', $viewerApp->dir('cache'));
        if (true){
            $lia->set('lia:cache.enable', false);
        }
        if (true){
            $lia->set('lia:resource.recompileJsAfter', 0);
            $lia->set('lia:resource.recompileCssAfter', 0);
            $lia->set('lia:resource.useCache', true);
            $lia->set('lia:resource.forceRecompile', true);
        } else {
            // $liaison->set('lia:resource.useCache', true);
        }

        $lia->deliver();
    }
}