Skip to content

Commit

Permalink
adding readme
Browse files Browse the repository at this point in the history
  • Loading branch information
diegogit03 committed Jan 18, 2024
1 parent ddbb963 commit 949f79b
Show file tree
Hide file tree
Showing 6 changed files with 647 additions and 80 deletions.
13 changes: 12 additions & 1 deletion app/Livewire/RepositoryDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Models\Repository;
use CzProject\GitPhp\Git;
use CzProject\GitPhp\GitRepository;
use Illuminate\Support\Facades\Process;
use Livewire\Component;

class RepositoryDetails extends Component
Expand All @@ -24,6 +25,8 @@ public function render()
$tree = $repo->execute('ls-tree', "--format='%(objectmode) %(objecttype) %(objectname) %(path)", 'HEAD');
$objects = [];

$readmeMarkdown = implode(PHP_EOL, $repo->execute('show', 'HEAD:readme.md'));

foreach ($tree as $object) {
$data = explode(' ', $object);

Expand All @@ -50,6 +53,14 @@ public function render()
$folders = array_filter($objects, fn ($object) => $object['type'] === 'tree');
$files = array_filter($objects, fn ($object) => $object['type'] === 'blob');

return view('livewire.repository-details', compact(['branches', 'tags', 'objects', 'commits', 'folders', 'files']))->extends('layouts.app');
return view('livewire.repository-details', compact([
'branches',
'tags',
'objects',
'commits',
'folders',
'files',
'readmeMarkdown',
]))->extends('layouts.app');
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8",
"livewire/livewire": "^3.3",
"monolog/monolog": "^3.5"
"monolog/monolog": "^3.5",
"sinnbeck/markdom": "^2.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
Expand Down
Loading

0 comments on commit 949f79b

Please sign in to comment.