public function __construct() { $file = new \Illuminate\Filesystem\Filesystem(); $this->fs = $file; $this->concatStub = $file->get(__DIR__ . '/stubs/concat.stub'); $this->resultConcatStub = $file->get(__DIR__ . '/stubs/resultConcat.stub'); }
/** * Build views in order to parse php files * * @param Array $viewPaths * @param String $domain * * @return Boolean status */ public function compileViews(array $viewPaths, $domain) { // Check the output directory $targetDir = $this->storagePath . DIRECTORY_SEPARATOR . $this->storageContainer; if (!file_exists($targetDir)) { $this->createDirectory($targetDir); } // Domain separation $domainDir = $targetDir . DIRECTORY_SEPARATOR . $domain; $this->clearDirectory($domainDir); $this->createDirectory($domainDir); foreach ($viewPaths as $path) { $path = $this->basePath . DIRECTORY_SEPARATOR . $path; $fs = new \Illuminate\Filesystem\Filesystem($path); $files = $fs->allFiles(realpath($path)); $compiler = new \Illuminate\View\Compilers\BladeCompiler($fs, $domainDir); foreach ($files as $file) { $filePath = $file->getRealPath(); $compiler->setPath($filePath); $contents = $compiler->compileString($fs->get($filePath)); $compiledPath = $compiler->getCompiledPath($compiler->getPath()); $fs->put($compiledPath . '.php', $contents); } } return true; }
<?php $filesystem = new \Illuminate\Filesystem\Filesystem(); $sharedConfig = json_decode($filesystem->get(base_path('node/config.json')), true); return ['config' => base_path(env('SATIS_CONFIG', 'resources' . DIRECTORY_SEPARATOR . 'satis.json')), 'composer_home' => base_path(env('COMPOSER_HOME', 'storage' . DIRECTORY_SEPARATOR . 'composer')), 'composer_cache' => base_path(env('COMPOSER_HOME', 'storage' . DIRECTORY_SEPARATOR . 'composer/cache')), 'memory_limit' => '2G', 'build_verbosity' => 'vvv', 'private_repository' => 'private', 'public_repository' => 'public', 'proxy' => ['http' => env('SATIS_HTTP_PROXY', null), 'https' => env('SATIS_HTTPS_PROXY', null)], 'default_repository_type' => 'vcs', 'repository_types' => ['vcs', 'pear', 'composer', 'artifact', 'path'], 'build_directory' => base_path('public'), 'public_mirror' => storage_path('app' . DIRECTORY_SEPARATOR . 'public.json'), 'private_mirror' => storage_path('app' . DIRECTORY_SEPARATOR . 'private.json'), 'lock' => base_path($sharedConfig['lock_file']), 'node' => $sharedConfig, 'sync_timeout' => 120, 'webpack_dev_server' => env('WEBPACK_DEV_SERVER', 'http://localhost:9001')];
<?php require_once __DIR__ . '/vendor/autoload.php'; $file = new Illuminate\Filesystem\Filesystem(); $parser = new Rtablada\LiterateRoutes\Parser(); $fileParser = new Rtablada\LiterateRoutes\FileParser($file, $parser); $expected = $file->get(__DIR__ . '/tests/files/route-full.php.test'); $fileParser->buildForDirectory(__DIR__ . '/tests'); $actual = $file->get(__DIR__ . '/tests/files/route-full.php'); if ($expected == $actual) { echo "File built correctly."; } else { echo "File build fail."; } $file->delete(__DIR__ . '/tests/files/route-full.php');