Skip to content

Commit

Permalink
Renamed the package to 68publishers/tracy-git-version and root name…
Browse files Browse the repository at this point in the history
…space to `SixtyEightPublishers\TracyGitVersion`
  • Loading branch information
tg666 committed Jan 9, 2022
1 parent 7844339 commit 5431c3b
Show file tree
Hide file tree
Showing 75 changed files with 405 additions and 405 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<h1 align="center">Tracy Git version panel</h1>
<h1 align="center">Tracy Git version</h1>

Simple and extensible panel for [Tracy](https://github.com/nette/tracy) that shows information from Git.

Expand All @@ -17,10 +17,10 @@ Simple and extensible panel for [Tracy](https://github.com/nette/tracy) that sho

## Installation

The best way to install `68publishers/tracy-git-version-panel` is using Composer:
The best way to install `68publishers/tracy-git-version` is using Composer:

```bash
$ composer require 68publishers/tracy-git-version-panel
$ composer require 68publishers/tracy-git-version
```

## Basic integration
Expand All @@ -33,7 +33,7 @@ The simplest way how to register the panel into Tracy is by creating a default i
<?php

use Tracy\Debugger;
use SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\GitVersionPanel;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\GitVersionPanel;

Debugger::getBar()->addPanel(GitVersionPanel::createDefault());
```
Expand All @@ -44,7 +44,7 @@ Basic integration into Nette is really simple. Just register an extension.

```neon
extensions:
68publishers.tracy_git_version_panel: SixtyEightPublishers\TracyGitVersionPanel\Bridge\Nette\DI\TracyGitVersionPanelExtension
68publishers.tracy_git_version: SixtyEightPublishers\TracyGitVersion\Bridge\Nette\DI\TracyGitVersionExtension
```

And everything works 😉
Expand All @@ -62,12 +62,12 @@ You must create repositories and the panel manually but there is not much work t
<?php

use Tracy\Debugger;
use SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\GitVersionPanel;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\LocalGitRepository;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\ExportedGitRepository;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\ResolvableGitRepository;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\RuntimeCachedGitRepository;
use SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\Block\CurrentStateBlock;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\GitVersionPanel;
use SixtyEightPublishers\TracyGitVersion\Repository\LocalGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\ExportedGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\ResolvableGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\RuntimeCachedGitRepository;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\Block\CurrentStateBlock;

# create a repository that reads from the .git directory:
$localGitRepository = LocalGitRepository::createDefault();
Expand All @@ -91,14 +91,14 @@ The setup for Nette is more simple. Just add another extension into your neon co

```neon
extensions:
68publishers.tracy_git_version_panel: SixtyEightPublishers\TracyGitVersionPanel\Bridge\Nette\DI\TracyGitVersionPanelExtension
68publishers.tracy_git_version_panel.export: SixtyEightPublishers\TracyGitVersionPanel\Bridge\Nette\DI\TracyGitVersionPanelExportExtension
68publishers.tracy_git_version: SixtyEightPublishers\TracyGitVersion\Bridge\Nette\DI\TracyGitVersionExtension
68publishers.tracy_git_version.export: SixtyEightPublishers\TracyGitVersion\Bridge\Nette\DI\TracyGitVersionExportExtension
```

The default name for the exported file is `%tempDir%/git-version/repository.json` but you can change it.

```neon
68publishers.tracy_git_version_panel.export:
68publishers.tracy_git_version.export:
export_filename: %tempDir%/my/custom/path.json
```

Expand All @@ -108,7 +108,7 @@ The export file should be created by executing a script that is located in the c
The script is independent of the application so you must provide the filename of the exported file as an option.

```bash
$ vendor/bin/tracy-git-version-panel export-repository --output-file <your_temp>/git-version/repository.json -vv
$ vendor/bin/tracy-git-version export-repository --output-file <your_temp>/git-version/repository.json -vv
```

## Advanced guide
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "68publishers/tracy-git-version-panel",
"name": "68publishers/tracy-git-version",
"description": "Git version panel for Tracy.",
"keywords": ["68publishers", "tracy", "git", "git version", "nette"],
"license": "MIT",
Expand Down Expand Up @@ -33,19 +33,19 @@
},
"autoload": {
"psr-4": {
"SixtyEightPublishers\\TracyGitVersionPanel\\": "src/"
"SixtyEightPublishers\\TracyGitVersion\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"SixtyEightPublishers\\TracyGitVersionPanel\\Tests\\": "tests/"
"SixtyEightPublishers\\TracyGitVersion\\Tests\\": "tests/"
}
},
"config": {
"sort-packages": true
},
"bin": [
"tracy-git-version-panel"
"tracy-git-version"
],
"scripts": {
"php-cs-fixer": [
Expand Down
74 changes: 37 additions & 37 deletions docs/advanced-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Git repository service and extending

All information from Git is provided through a service of type `SixtyEightPublishers\TracyGitVersionPanel\Repository\GitRepositoryInterface`.
All information from Git is provided through a service of type `SixtyEightPublishers\TracyGitVersion\Repository\GitRepositoryInterface`.
If you are using the Nette integration the service is accessible in the application's DI Container.

Following repository implementations are implemented:
Expand All @@ -29,7 +29,7 @@ The package comes with the following commands

### Custom commands and handlers

Commands must implements an interface `SixtyEightPublishers\TracyGitVersionPanel\Repository\GitCommandInterface` and handlers must implements an interface `SixtyEightPublishers\TracyGitVersionPanel\Repository\GitCommandHandlerInterface`.
Commands must implements an interface `SixtyEightPublishers\TracyGitVersion\Repository\GitCommandInterface` and handlers must implements an interface `SixtyEightPublishers\TracyGitVersion\Repository\GitCommandHandlerInterface`.

Also, there are these two interfaces for handlers:

Expand All @@ -41,9 +41,9 @@ Let's show an example. Suppose we want to create a command to find out the git h
```php
<?php

namespace App\GitRepositoryPanel\Command;
namespace App\TracyGitVersion\Command;

use SixtyEightPublishers\TracyGitVersionPanel\Repository\GitCommandInterface;
use SixtyEightPublishers\TracyGitVersion\Repository\GitCommandInterface;

final class ListHistoryCommand implements GitCommandInterface
{
Expand Down Expand Up @@ -71,10 +71,10 @@ Now we need a handler for the command that will read history from the git direct
```php
<?php

namespace App\GitRepositoryPanel\LocalDirectory;
namespace App\TracyGitVersion\LocalDirectory;

use App\GitRepositoryPanel\Command\ListHistoryCommand;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\LocalDirectory\CommandHandler\AbstractLocalDirectoryCommandHandler;
use App\TracyGitVersion\Command\ListHistoryCommand;
use SixtyEightPublishers\TracyGitVersion\Repository\LocalDirectory\CommandHandler\AbstractLocalDirectoryCommandHandler;

final class ListHistoryCommandHandler extends AbstractLocalDirectoryCommandHandler
{
Expand All @@ -97,10 +97,10 @@ final class ListHistoryCommandHandler extends AbstractLocalDirectoryCommandHandl
```php
<?php

namespace App\GitRepositoryPanel\Export;
namespace App\TracyGitVersion\Export;

use App\GitRepositoryPanel\Command\ListHistoryCommand;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\Export\CommandHandler\AbstractExportedCommandHandler;
use App\TracyGitVersion\Command\ListHistoryCommand;
use SixtyEightPublishers\TracyGitVersion\Repository\Export\CommandHandler\AbstractExportedCommandHandler;

final class ListHistoryCommandHandler extends AbstractExportedCommandHandler
{
Expand All @@ -126,11 +126,11 @@ If you are using standalone Tracy you must register custom handlers for commands
```php
<?php

use App\GitRepositoryPanel\Export;
use App\GitRepositoryPanel\LocalDirectory;
use App\GitRepositoryPanel\Command\ListHistoryCommand;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\LocalGitRepository;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\ExportedGitRepository;
use App\TracyGitVersion\Export;
use App\TracyGitVersion\LocalDirectory;
use App\TracyGitVersion\Command\ListHistoryCommand;
use SixtyEightPublishers\TracyGitVersion\Repository\LocalGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\ExportedGitRepository;

# create a repository that reads from the .git directory:
$localGitRepository = LocalGitRepository::createDefault();
Expand All @@ -146,19 +146,19 @@ $exportedGitRepository->addHandler(ListHistoryCommand::class, new Export\ListHis
When you are using Nette integration then you should register the handlers in the configuration:

```neon
68publishers.tracy_git_version_panel:
68publishers.tracy_git_version:
command_handlers:
App\GitRepositoryPanel\Command\ListHistoryCommand: App\GitRepositoryPanel\LocalDirectory\ListHistoryCommandHandler
App\TracyGitVersion\Command\ListHistoryCommand: App\TracyGitVersion\LocalDirectory\ListHistoryCommandHandler
68publishers.tracy_git_version_panel.export:
68publishers.tracy_git_version.export:
command_handlers:
App\GitRepositoryPanel\Command\ListHistoryCommand: App\GitRepositoryPanel\Export\ListHistoryCommandHandler
App\TracyGitVersion\Command\ListHistoryCommand: App\TracyGitVersion\Export\ListHistoryCommandHandler
```

## Extending the panel

By default, the panel contains the most useful information like the current branch, commit hash, and latest tag. But you are able to add any information you want.
The whole panel is made up of blocks which are classes that implement an interface `SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\Block\BlockInterface`.
The whole panel is made up of blocks which are classes that implement an interface `SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\Block\BlockInterface`.

### Extending with a simple table

Expand All @@ -167,8 +167,8 @@ If you want to add some additional data that are not provided from Git you can u
```php
<?php

use SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\GitVersionPanel;
use SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\Block\SimpleTableBlock;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\GitVersionPanel;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\Block\SimpleTableBlock;

$panel = GitVersionPanel::createDefault()
->addBlock(new SimpleTableBlock([
Expand All @@ -179,10 +179,10 @@ $panel = GitVersionPanel::createDefault()
Respectively

```neon
68publishers.tracy_git_version_panel:
68publishers.tracy_git_version:
panel:
blocks:
- SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\Block\SimpleTableBlock([
- SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\Block\SimpleTableBlock([
Version: %build_version%
], Build)
```
Expand All @@ -198,9 +198,9 @@ If you have declared some [custom commands](#custom-commands-and-handlers) and y
```php
<?php

use SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\Block\BlockInterface;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\GitRepositoryInterface;
use SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\Helpers;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\Block\BlockInterface;
use SixtyEightPublishers\TracyGitVersion\Repository\GitRepositoryInterface;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\Helpers;

final class HistoryBlock implements BlockInterface
{
Expand All @@ -226,12 +226,12 @@ If you are using the `ExportedGitRepository` and you have custom [repository com
```php
<?php

namespace App\GitRepositoryPanel\Exporter;
namespace App\TracyGitVersion\Exporter;

use SixtyEightPublishers\TracyGitVersionPanel\Export\ExporterInterface;
use SixtyEightPublishers\TracyGitVersionPanel\Exception\BadMethodCallException;
use SixtyEightPublishers\TracyGitVersionPanel\Export\Config;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\GitRepositoryInterface;
use SixtyEightPublishers\TracyGitVersion\Export\ExporterInterface;
use SixtyEightPublishers\TracyGitVersion\Exception\BadMethodCallException;
use SixtyEightPublishers\TracyGitVersion\Export\Config;
use SixtyEightPublishers\TracyGitVersion\Repository\GitRepositoryInterface;

class HistoryExporter implements ExporterInterface
{
Expand Down Expand Up @@ -259,11 +259,11 @@ The configuration file might look something like this:
```php
<?php

use App\GitRepositoryPanel\Exporter\HistoryExporter;
use App\GitRepositoryPanel\Command\ListHistoryCommand;
use App\GitRepositoryPanel\LocalDirectory\ListHistoryCommandHandler;
use App\TracyGitVersion\Exporter\HistoryExporter;
use App\TracyGitVersion\Command\ListHistoryCommand;
use App\TracyGitVersion\LocalDirectory\ListHistoryCommandHandler;

use SixtyEightPublishers\TracyGitVersionPanel\Export\Config;
use SixtyEightPublishers\TracyGitVersion\Export\Config;

return Config::createDefault()
->setOutputFile(__DIR__ . '/temp/git-version/repository.json') # you can define the filename here so the option `--output-file` can be omitted
Expand All @@ -278,7 +278,7 @@ return Config::createDefault()
Now execute the following command that regenerates the export file:

```bash
$ vendor/bin/tracy-git-version-panel export-repository --config git-version-config.php -vv
$ vendor/bin/tracy-git-version export-repository --config git-version-config.php -vv
```

As you can see the option `--output-file` is not needed because we already defined the filename in the config.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

declare(strict_types=1);

namespace SixtyEightPublishers\TracyGitVersionPanel\Bridge\Nette\DI;
namespace SixtyEightPublishers\TracyGitVersion\Bridge\Nette\DI;

use RuntimeException;
use Nette\Schema\Expect;
use Nette\Schema\Schema;
use Nette\DI\CompilerExtension;
use Nette\DI\Definitions\Statement;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\ExportedGitRepository;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\Command\GetHeadCommand;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\GitRepositoryInterface;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\Command\GetLatestTagCommand;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\Export\CommandHandler\GetHeadCommandHandler;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\Export\CommandHandler\GetLatestTagCommandHandler;
use SixtyEightPublishers\TracyGitVersion\Repository\ExportedGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\Command\GetHeadCommand;
use SixtyEightPublishers\TracyGitVersion\Repository\GitRepositoryInterface;
use SixtyEightPublishers\TracyGitVersion\Repository\Command\GetLatestTagCommand;
use SixtyEightPublishers\TracyGitVersion\Repository\Export\CommandHandler\GetHeadCommandHandler;
use SixtyEightPublishers\TracyGitVersion\Repository\Export\CommandHandler\GetLatestTagCommandHandler;

final class TracyGitVersionPanelExportExtension extends CompilerExtension
final class TracyGitVersionExportExtension extends CompilerExtension
{
/**
* {@inheritDoc}
Expand Down Expand Up @@ -47,11 +47,11 @@ public function getConfigSchema(): Schema
*/
public function loadConfiguration(): void
{
if (0 >= count($this->compiler->getExtensions(TracyGitVersionPanelExtension::class))) {
if (0 >= count($this->compiler->getExtensions(TracyGitVersionExtension::class))) {
throw new RuntimeException(sprintf(
'The extension %s can be used only with %s.',
static::class,
TracyGitVersionPanelExtension::class
TracyGitVersionExtension::class
));
}

Expand All @@ -65,6 +65,6 @@ public function loadConfiguration(): void
'handlers' => $this->config->command_handlers,
'source' => $this->config->source_name,
])
->addTag(TracyGitVersionPanelExtension::TAG_GIT_REPOSITORY, 50);
->addTag(TracyGitVersionExtension::TAG_GIT_REPOSITORY, 50);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

declare(strict_types=1);

namespace SixtyEightPublishers\TracyGitVersionPanel\Bridge\Nette\DI;
namespace SixtyEightPublishers\TracyGitVersion\Bridge\Nette\DI;

use Tracy\Bar;
use Nette\Schema\Expect;
use Nette\Schema\Schema;
use Nette\DI\CompilerExtension;
use Nette\DI\Definitions\Statement;
use Nette\DI\Definitions\ServiceDefinition;
use SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\GitVersionPanel;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\LocalGitRepository;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\Command\GetHeadCommand;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\GitRepositoryInterface;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\ResolvableGitRepository;
use SixtyEightPublishers\TracyGitVersionPanel\Bridge\Tracy\Block\CurrentStateBlock;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\RuntimeCachedGitRepository;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\Command\GetLatestTagCommand;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\LocalDirectory\GitDirectory;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\LocalDirectory\CommandHandler\GetHeadCommandHandler;
use SixtyEightPublishers\TracyGitVersionPanel\Repository\LocalDirectory\CommandHandler\GetLatestTagCommandHandler;

final class TracyGitVersionPanelExtension extends CompilerExtension
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\GitVersionPanel;
use SixtyEightPublishers\TracyGitVersion\Repository\LocalGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\Command\GetHeadCommand;
use SixtyEightPublishers\TracyGitVersion\Repository\GitRepositoryInterface;
use SixtyEightPublishers\TracyGitVersion\Repository\ResolvableGitRepository;
use SixtyEightPublishers\TracyGitVersion\Bridge\Tracy\Block\CurrentStateBlock;
use SixtyEightPublishers\TracyGitVersion\Repository\RuntimeCachedGitRepository;
use SixtyEightPublishers\TracyGitVersion\Repository\Command\GetLatestTagCommand;
use SixtyEightPublishers\TracyGitVersion\Repository\LocalDirectory\GitDirectory;
use SixtyEightPublishers\TracyGitVersion\Repository\LocalDirectory\CommandHandler\GetHeadCommandHandler;
use SixtyEightPublishers\TracyGitVersion\Repository\LocalDirectory\CommandHandler\GetLatestTagCommandHandler;

final class TracyGitVersionExtension extends CompilerExtension
{
public const TAG_GIT_REPOSITORY = '68publishers.tracy_git_version_panel.tag.git_repository';

Expand Down
Loading

0 comments on commit 5431c3b

Please sign in to comment.