Browse Source

Fix phar build and minor bugs.

master
Lio Novelli 1 month ago
parent
commit
2e3f6b4bd8
  1. 14
      README.org
  2. 640
      app/composer.lock
  3. 10
      app/dependencies.php
  4. 2
      app/rprt.php
  5. 2
      app/src/Commands/InvoiceCommand.php
  6. 2
      app/src/Utils/PdfExport/PdfExportService.php
  7. 4
      app/src/Utils/TimeTrackingServices/YoutrackService.php
  8. 18
      box.json

14
README.org

@ -9,10 +9,16 @@
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
File diff suppressed because it is too large
View File

10
app/dependencies.php

@ -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'),

2
app/rprt.php

@ -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);

2
app/src/Commands/InvoiceCommand.php

@ -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;

2
app/src/Utils/PdfExport/PdfExportService.php

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

4
app/src/Utils/TimeTrackingServices/YoutrackService.php

@ -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

@ -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"
}
]
}
Loading…
Cancel
Save