Added storing of found repos in cache file.

This commit is contained in:
Wim Rijnders
2012-12-31 14:44:21 +01:00
parent b8f9945b6d
commit 8cb0ce623e
3 changed files with 14 additions and 5 deletions

View File

@@ -39,17 +39,20 @@ class Application extends SilexApplication
));
$repositories = $config->get('git', 'repositories');
/*
echo "doing this\n";
$repositories = $app['git']->getRepositories($repositories);
$config->set('git', 'repositories', $repositories);
*/
$cached_repos = $root . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'repos.json';
$this->register(new GitServiceProvider(), array(
'git.client' => $config->get('git', 'client'),
'git.repos' => $repositories,
'cache.repos' => $cached_repos,
'ini.file' => "config.ini",
'git.hidden' => $config->get('git', 'hidden') ? $config->get('git', 'hidden') : array(),
));
$cached_repos = $root . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'repos.json';
$this->register(new ViewUtilServiceProvider());
$this->register(new RepositoryUtilServiceProvider());
$this->register(new UrlGeneratorServiceProvider());
@@ -61,6 +64,7 @@ class Application extends SilexApplication
return $twig;
}));
// Handle errors
$this->error(function (\Exception $e, $code) use ($app) {
if ($app['debug']) {

View File

@@ -41,4 +41,6 @@ class Client extends BaseClient
return new Repository($path, $this);
}
}

View File

@@ -8,6 +8,7 @@ use Silex\ServiceProviderInterface;
class GitServiceProvider implements ServiceProviderInterface
{
/**
* Register the Git\Client on the Application ServiceProvider
*
@@ -19,6 +20,8 @@ class GitServiceProvider implements ServiceProviderInterface
$app['git'] = function () use ($app) {
$options['path'] = $app['git.client'];
$options['hidden'] = $app['git.hidden'];
$options['ini.file'] = $app['ini.file'];
$options['cache.repos'] = $app['cache.repos'];
return new Client($options);
};