Browse Source

Repository*: add a 'fileName' property

master
parent
commit
c74858af68
  1. 2
      src/RepositoryDir.php
  2. 2
      src/RepositoryGit.php

2
src/RepositoryDir.php

@ -34,6 +34,7 @@ class RepositoryDir extends RepositoryBase {
if (preg_match("/^([0-9a-zA-Z_\-]+)\.json$/", $f, $m) && $f !== 'package.json') {
$d1 = json_decode(file_get_contents("{$this->path}/{$f}"), true);
$d1['format'] = 'json';
$d1['fileName'] = $f;
if (!$this->isCategory($d1)) {
continue;
@ -45,6 +46,7 @@ class RepositoryDir extends RepositoryBase {
if (preg_match("/^([0-9a-zA-Z_\-]+)\.yaml$/", $f, $m)) {
$d1 = yaml_parse(file_get_contents("{$this->path}/{$f}"));
$d1['format'] = 'yaml';
$d1['fileName'] = $f;
if (!$this->isCategory($d1)) {
continue;

2
src/RepositoryGit.php

@ -72,6 +72,7 @@ class RepositoryGit extends RepositoryBase {
$d1 = json_decode(shell_exec("cd " . escapeShellArg($this->path) . "; git show {$this->branchEsc}:" . escapeShellArg($f)), true);
$d1['format'] = 'json';
$d1['fileName'] = $f;
if (!$this->isCategory($d1)) {
continue;
@ -86,6 +87,7 @@ class RepositoryGit extends RepositoryBase {
$d1 = yaml_parse(shell_exec("cd " . escapeShellArg($this->path) . "; git show {$this->branchEsc}:" . escapeShellArg($f)));
$d1['format'] = 'yaml';
$d1['fileName'] = $f;
if (!$this->isCategory($d1)) {
continue;

Loading…
Cancel
Save