public function testGenerate() { Console::init(); Config::init(__DIR__ . "/../../../../../.."); Dispatcher::init(); $generator = new Generator(); $generator->generate(['foo' => 'baz']); echo ''; }
/** * Common init sequence */ protected static function init() { // start the timer Timer::start(); // initialize the console to print out any issues Console::init(); // initialize the config for the pluginDir $baseDir = __DIR__ . "/../../../../../"; Config::init($baseDir, false); Dispatcher::init(); }
public function testIsUpdate() { Config::init(__DIR__ . "/../../../../../../", false); $sd = Config::getOption("patternSourceDir"); $fileName = $sd . "/00-atoms/_unused/banner.twig"; $patternStore = ['bla' => ['pathName' => "00-atoms/_unused/banner", 'ext' => 'twig']]; FileChangeList::init(Config::getOption("publicDir") . DIRECTORY_SEPARATOR . "fileChangeList.csv"); $this->assertTrue(touch($fileName, time() + 100)); FileChangeList::write(); touch($fileName, time()); clearstatcache(); FileChangeList::init(Config::getOption("publicDir") . DIRECTORY_SEPARATOR . "fileChangeList.csv"); $condition = FileChangeList::hasChanged($fileName); $this->assertTrue($condition); }
/** * Common init sequence */ protected static function init() { // start the timer Timer::start(); // initialize the console to print out any issues Console::init(); // initialize the config for the pluginDir $baseDir = __DIR__ . "/../../../../../"; Config::init($baseDir, false); // make sure the source dir is set-up $sourceDir = Config::getOption("sourceDir"); if (!is_dir($sourceDir)) { FileUtil::makeDir($sourceDir); } // make sure the public dir is set-up $publicDir = Config::getOption("publicDir"); if (!is_dir($publicDir)) { FileUtil::makeDir($publicDir); } Dispatcher::init(); }
/*! * Router for the PHP Server * * Copyright (c) 2014 Dave Olsen * Licensed under the MIT license * */ use PatternLab\Config; // set-up the project base directory $baseDir = __DIR__ . "/../../"; // auto-load classes if (file_exists($baseDir . "vendor/autoload.php")) { require $baseDir . "vendor/autoload.php"; } else { print "it doesn't appear that pattern lab has been set-up yet...\n"; print "please install pattern lab's dependencies by typing: php core/bin/composer.phar install...\n"; exit; } // load the options and be quiet about it Config::init($baseDir, false); if ($_SERVER["SCRIPT_NAME"] == "" || $_SERVER["SCRIPT_NAME"] == "/") { require "index.html"; } else { if (file_exists(Config::getOption("publicDir") . $_SERVER["SCRIPT_NAME"])) { return false; } else { header("HTTP/1.0 404 Not Found"); print "file doesn't exist."; } }