-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaper
37 lines (28 loc) · 1.13 KB
/
paper
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
#!/usr/bin/env php
<?php
use Paphper\Config;
use Paphper\FileContentResolver;
use Paphper\FileTypeResolvers\HtmlResolver;
use Paphper\PageResolvers\FilesystemPageResolver;
use React\EventLoop\Factory;
use React\Filesystem\Filesystem;
use Symfony\Component\Console\Application;
use Paphper\Commands\Watch;
use Paphper\Commands\Build;
require_once 'vendor/autoload.php';
$loop = Factory::create();
$filesystem = Filesystem::create($loop);
$app = new Application();
//resolve config
$configData = include __DIR__ . '/config.php';
$config = new Config($configData);
//resolve the class that creates content from the file
$fileContentResolver = new FileContentResolver();
//this class resolves the class that can generate content
//based on the content in the file with extension .html
$htmlResolver = new HtmlResolver($config, $filesystem);
$fileContentResolver->add('html', $htmlResolver);
$pageResolvers = new FilesystemPageResolver($config, $filesystem);
$app->add(new Watch($config, $pageResolvers, $fileContentResolver, $filesystem, $loop));
$app->add(new Build($config, $pageResolvers, $fileContentResolver, $filesystem, $loop));
$app->run();