2015-05-05 22:04:04 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use GitWrapper\GitWrapper;
|
2015-11-23 13:19:13 +01:00
|
|
|
use Gist\Service\Gist;
|
2015-05-06 14:11:00 +02:00
|
|
|
|
2017-04-24 01:11:39 +02:00
|
|
|
$dataPath = $app['settings']['data']['path'];
|
|
|
|
|
|
|
|
if ($dataPath[0] !== '/') {
|
2017-04-24 20:56:53 +02:00
|
|
|
$app['gist_path'] = $app['root_path'].'/'.$dataPath;
|
2017-04-24 01:11:39 +02:00
|
|
|
} else {
|
|
|
|
$app['gist_path'] = $dataPath;
|
|
|
|
}
|
2015-05-05 22:04:04 +02:00
|
|
|
|
2015-11-23 11:53:24 +01:00
|
|
|
$app['git_wrapper'] = $app->share(function ($app) {
|
2017-04-24 01:11:39 +02:00
|
|
|
return new GitWrapper($app['settings']['git']['path']);
|
2015-11-23 11:53:24 +01:00
|
|
|
});
|
2015-05-06 22:24:42 +02:00
|
|
|
|
2015-11-23 11:53:24 +01:00
|
|
|
$app['git_working_copy'] = $app->share(function ($app) {
|
2015-05-06 22:24:42 +02:00
|
|
|
return $app['git_wrapper']->init($app['gist_path']);
|
2015-11-23 11:53:24 +01:00
|
|
|
});
|
2015-05-06 14:11:00 +02:00
|
|
|
|
2015-11-23 11:53:24 +01:00
|
|
|
$app['gist'] = $app->share(function ($app) {
|
2015-11-23 13:19:13 +01:00
|
|
|
return new Gist($app['gist_path'], $app['git_wrapper'], $app['git_working_copy'], $app['geshi']);
|
2015-11-23 11:53:24 +01:00
|
|
|
});
|