This repository was archived by the owner on May 1, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgithub-pulse.php
More file actions
89 lines (71 loc) · 1.93 KB
/
github-pulse.php
File metadata and controls
89 lines (71 loc) · 1.93 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
declare(strict_types=1);
/**
* Copyright (c) 2017 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://github.com/localheinz/github-pulse
*/
use Github\Client;
use League\Flysystem;
use Localheinz\GitHub\Pulse;
use Symfony\Component\Cache;
use Symfony\Component\Console;
use Symfony\Component\PropertyInfo;
use Symfony\Component\Serializer;
use Symfony\Component\Stopwatch;
$autoloaders = [
__DIR__ . '/../../../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php',
];
foreach ($autoloaders as $autoloader) {
if (\file_exists($autoloader)) {
require $autoloader;
break;
}
}
$client = new Client();
$client->addCache(new Cache\Adapter\FilesystemAdapter(
'',
0,
__DIR__ . '/data/cache'
));
$application = new Console\Application('github-pulse', '0.1.0');
$fileSystem = new Flysystem\Filesystem(new Flysystem\Adapter\Local(__DIR__ . '/data/github'));
$denormalizer = new Serializer\Normalizer\PropertyNormalizer(
null,
new Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter(),
new PropertyInfo\Extractor\PhpDocExtractor()
);
$serializer = new Serializer\Serializer([
$denormalizer,
]);
$denormalizer->setSerializer($serializer);
$organizationRepository = new Pulse\Repository\OrganizationRepository(
$client,
$denormalizer,
$fileSystem
);
$repositoryRepository = new Pulse\Repository\RepositoryRepository(
$client,
$denormalizer,
$fileSystem
);
$pullRequestRepository = new Pulse\Repository\PullRequestRepository(
$client,
$denormalizer,
$fileSystem
);
$application->addCommands([
new Pulse\Console\GenerateCommand(
$client,
$organizationRepository,
$repositoryRepository,
$pullRequestRepository,
new Stopwatch\Stopwatch(),
new DateTimeZone('UTC')
),
]);
$application->run();