protected static function generateIfRequired() { $fs = new Filesystem(); if (!isset(static::$values) || !isset(static::$records)) { static::$values = json_decode($fs->get(Path::join(__DIR__, 'data/values.json')), true)[0]; static::$records = json_decode($fs->get(Path::join(__DIR__, 'data/records.json')), true); } }
protected function copyDefaultConfigurationFiles(Application $app) { $fs = new Filesystem(); $files = Finder::create()->files()->name('*.php')->in(Path::join(__DIR__, '..', '..', 'app', 'config'))->files(); foreach ($files as $file) { $dest = Path::join($app->configPath(), $file->getRelativePathname()); $fs->copy($file->getPathname(), $dest); } }
/** * loadMessages * * @param array $extraLocales * @param string $langsPath * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function loadMessages(array $extraLocales = [], $langsPath = 'resources/lang') { $this->messages = []; $langs = array_merge([config('app.locale')], $extraLocales, ['en']); foreach ($langs as $lang) { $path = Path::join($langsPath, $lang, 'validation.php'); $path = base_path($path); if ($this->getFiles()->exists($path)) { $this->messages = array_replace_recursive($this->messages, $this->getFiles()->getRequire($path)); } } }
public function render($str, array $vars = []) { $__tmp_stub_file = Str::random() . uniqid(time(), false); !$this->fs->exists($this->cachePath) && $this->fs->makeDirectory($this->cachePath, 0755, true); $__tmp_stub_path = Path::join($this->cachePath, $__tmp_stub_file); $this->fs->put($__tmp_stub_path, $this->compiler->compileString($str)); $__env = $this->getViewFactory(); if (is_array($vars) && 0 !== count($vars)) { extract($vars); } ob_start(); include $__tmp_stub_path; $var = ob_get_contents(); ob_end_clean(); $this->fs->delete($__tmp_stub_path); return $var; }
public static function bootAsMaster($appPath = null, $basePath = null, $name = null, $version = null) { $app = static::boot($appPath, $basePath, $name, $version); $app->useDatabasePath(Path::join(__DIR__, '..', 'database')); $app->singleton(C\Console\Kernel::class, static::$consoleKernel); $app->singleton(C\Http\Kernel::class, static::$httpKernel); $app->singleton(C\Debug\ExceptionHandler::class, static::$exceptionHandler); $kernel = $app->make(C\Console\Kernel::class); foreach (static::$bootingCallbacks as $callback) { $app->call($callback, ['kernel' => $kernel]); } $status = $kernel->handle($input = new \Symfony\Component\Console\Input\ArgvInput(), new \Symfony\Component\Console\Output\ConsoleOutput()); foreach (static::$bootedCallbacks as $callback) { $app->call($callback, ['kernel' => $kernel]); } $kernel->terminate($input, $status); exit($status); }
protected function remove($name) { $tmpDir = storage_path('blade-extensions'); $path = Path::join($tmpDir, $name); $this->files->delete($path); return $this; }
public function getBranchesToSync() { $allowedBranches = $this->setting('sync.constraints.branches'); if (count($allowedBranches) === 0) { return []; } $this->fire('git.syncer.branches.start', [$allowedBranches]); $branchesToSync = []; $remote = $this->client($this->setting('remote')); $repo = $this->setting('repository'); $owner = $this->setting('owner'); $branches = $remote->getBranches($repo, $owner); foreach ($branches as $branch => $sha) { if (!in_array('*', $allowedBranches, true) and !in_array($branch, $allowedBranches, true)) { continue; } $cacheKey = md5($this->project->getName() . $branch); $cached = $this->cache->get($cacheKey, false); $destinationPath = Path::join($this->project->getPath(), $branch); if ($cached !== $sha || $cached === false || !$this->files->exists($destinationPath)) { $branchesToSync[] = $branch; } } $this->fire('git.syncer.branches.finish', [$branchesToSync]); return $branchesToSync; }
public function storagePath() { return $this->storagePath ?: Path::join($this->appPath(), 'storage'); }
/** * Returns the menu for this project * * @return \Codex\Core\Menus\Menu */ public function getSidebarMenu() { $path = Path::join($this->getPath(), $this->getRef(), 'menu.yml'); $yaml = $this->files->get($path); $array = Yaml::parse($yaml); $this->codex->getMenus()->forget('sidebar'); $menu = $this->setupSidebarMenu($array['menu']); $this->runHook('project:documents-menu', [$this, $menu]); return $menu; }