Fix phar build and minor bugs.

master
Lio Novelli 2022-05-18 18:58:43 +02:00
parent ede6dc9c24
commit 2e3f6b4bd8
8 changed files with 560 additions and 132 deletions

View File

@ -10,9 +10,15 @@
This command would send an invoice for last month created from the template
file and last month report from youtrack as an email attachment.
~./rprt.php report -r~
Asks which report to print from the list of your reports and then prints out
a table with that report.
** Install/Getting started
Get ~.phar~ file, run configuration wizzard (planned for version 1.0).
Get ~.phar~ file from r, run configuration wizzard (planned for version 1.0).
Before version 1.0 is released you have to navigate into ~/app~ directory
and call command through ~.rprt.php~ file.
@ -25,6 +31,12 @@
3. You have to allow [[https://support.google.com/accounts/answer/6010255?hl=en][less secure applications]] in your gmail if you are using
that email provider.
*** Building a phar
php box: https://github.com/box-project/box
~./box.phar compile~
** Specs
A simple Console Command that prints out monthly report from youtrack.

640
app/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
use function DI\create;
use function DI\get;
use function DI\factory;
use RprtCli\Commands\InvoiceCommand;
use RprtCli\Commands\ReportCommand;
@ -18,6 +19,7 @@ use RprtCli\Utils\PdfExport\PdfExportInterface;
use RprtCli\Utils\PdfExport\PdfExportService;
use RprtCli\Utils\TimeTrackingServices\YoutrackInterface;
use RprtCli\Utils\TimeTrackingServices\YoutrackService;
use Psr\Container\ContainerInterface;
# use Symfony\Component\Translation\Translator;
#use Symfony\Component\Translation\Loader\PoFileLoader;
@ -32,7 +34,13 @@ return [
'config.path' => '~/.config/rprt-cli/',
'default_locale' => 'en',
'guzzle' => get(Client::class),
'mpdf' => get(Mpdf::class),
// 'mpdf' => get(Mpdf::class),
'mpdf' => factory(function (ContainerInterface $c) {
return new Mpdf(['tempDir' => sys_get_temp_dir()]);
}),
// 'mpdf' => function () {
// return new Mpdf(['tempDir' => sys_get_temp_dir()]);
// },
ConfigurationInterface::class => get(ConfigurationService::class),
ConfigurationService::class => create()->constructor(
get('config.path'),

View File

@ -12,7 +12,7 @@ $builder = new ContainerBuilder();
$builder->addDefinitions(__DIR__ . '/dependencies.php');
$container = $builder->build();
$application = new Application();
$application = new Application('Command Line Tool to process Youtrack Reports', '0.1.0');
$invoiceCommand = $container->get(InvoiceCommand::class);
$application->add($invoiceCommand);

View File

@ -201,7 +201,7 @@ class InvoiceCommand extends Command
}
$output_path = $this->pdfExport->fromDefaultDataToPdf($nice_data);
// Notify the user where the file was generated to.
$output->writeln("The file was generated at ${output_path}.");
$output->writeln("The file was generated at <info>${output_path}</info>.");
}
// return Command::SUCCESS;

View File

@ -88,7 +88,7 @@ class PdfExportService implements PdfExportInterface {
}
$table .= implode('', $rows);
$table .= '</tbody></table>';
var_dump($table);
// var_dump($table);
return $table;
}

View File

@ -118,6 +118,10 @@ class YoutrackService implements YoutrackInterface
$this->downloadReport($report_id);
}
}
catch (\Throwable $t) {
$status = $t->getMessage();
var_dump($status);
}
throw new \Exception("Unable to download report {$report_id}!");
}

18
box.json 100644
View File

@ -0,0 +1,18 @@
{
"main": "rprt.php",
"base-path": "app",
"compression": "GZ",
"output": "../bin/rprt-gz.phar",
"blacklist": ["config", "resources", "tests", "translations"],
"directories": ["src", "vendor"],
"files": [
"dependencies.php"
],
"finder": [
{
"name": "*.php",
"exclude": ["Tests"],
"in": "vendor"
}
]
}