Browse Source

RepositoryGit/Dir: include format of category (json/yaml)

master
parent
commit
79053f304a
  1. 2
      src/RepositoryDir.php
  2. 2
      src/RepositoryGit.php

2
src/RepositoryDir.php

@ -33,6 +33,7 @@ class RepositoryDir extends RepositoryBase {
while ($f = readdir($d)) {
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';
if (!$this->isCategory($d1)) {
continue;
@ -43,6 +44,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';
if (!$this->isCategory($d1)) {
continue;

2
src/RepositoryGit.php

@ -71,6 +71,7 @@ class RepositoryGit extends RepositoryBase {
}
$d1 = json_decode(shell_exec("cd " . escapeShellArg($this->path) . "; git show {$this->branchEsc}:" . escapeShellArg($f)), true);
$d1['format'] = 'json';
if (!$this->isCategory($d1)) {
continue;
@ -81,6 +82,7 @@ class RepositoryGit extends RepositoryBase {
if (preg_match("/^([0-9a-zA-Z_\-]+)\.yaml$/", $r, $m)) {
$d1 = yaml_parse(shell_exec("cd " . escapeShellArg($this->path) . "; git show {$this->branchEsc}:" . escapeShellArg($f)));
$d1['format'] = 'yaml';
if (!$this->isCategory($d1)) {
continue;

Loading…
Cancel
Save