This repository has been archived by the owner on Sep 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
phron
executable file
·57 lines (50 loc) · 1.49 KB
/
phron
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env php
<?php
if (file_exists(__DIR__.'/../../autoload.php'))
{
require __DIR__.'/../../autoload.php';
}
else
{
require __DIR__.'/vendor/autoload.php';
}
use Crontab\Crontab;
use Crontab\CrontabFileHandler;
use Cron\FieldFactory;
use Phron\Processor\Entries;
use Phron\Processor\JobBuilder;
use Symfony\Component\Console\Application;
use Phron\Command\AddCommand;
use Phron\Command\ShowCommand;
use Phron\Command\DeleteCommand;
use Phron\Command\ExplainCommand;
use Phron\Command\DumpCommand;
/*--------------------
| Spawn objects
| -------------------
*/
$crontab = new Crontab;
$crontabFileHandler = new CrontabFileHandler;
$jobBuilder = new JobBuilder;
$fieldFactory = new FieldFactory;
$entries = new Entries($crontab, $crontabFileHandler);
$addCommand = new AddCommand($entries, $jobBuilder, $fieldFactory);
$showCommand = new ShowCommand($entries, $jobBuilder, $fieldFactory);
$deleteCommand = new DeleteCommand($entries, $jobBuilder, $fieldFactory);
$explainCommand = new ExplainCommand($entries, $jobBuilder, $fieldFactory);
$dumpCommand = new DumpCommand($entries, $jobBuilder, $fieldFactory);
/*--------------------
| Add them to the app
| -------------------
*/
$app = new Application('Phron', '0.1');
$app->add($addCommand);
$app->add($showCommand);
$app->add($deleteCommand);
$app->add($explainCommand);
$app->add($dumpCommand);
/*--------------------
| Start the app
| -------------------
*/
$app->run();