mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 11:10:57 +01:00
Multiple root dir's recursion. Works fine, using them per repo needs to be figured out.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.*)$ /index.php [L,NC]
|
||||
RewriteRule ^(.*)$ index.php [L,NC]
|
||||
</IfModule>
|
||||
<Files config.ini>
|
||||
order allow,deny
|
||||
|
||||
17
boot.php
17
boot.php
@@ -4,7 +4,22 @@ if (!isset($config)) {
|
||||
die("No configuration object provided.");
|
||||
}
|
||||
|
||||
$config->set('git', 'repositories', rtrim($config->get('git', 'repositories'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
|
||||
$repositories = $config->get('git', 'repositories');
|
||||
|
||||
if ( !is_array( $repositories ) ) {
|
||||
# Convert the single item to an array - this is the internal handling
|
||||
$repositories = array( $repositories );
|
||||
}
|
||||
|
||||
$tmp_arr = array();
|
||||
foreach( $repositories as $repo ) {
|
||||
$tmp = rtrim($repo, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
|
||||
$tmp_arr []= $tmp;
|
||||
}
|
||||
$repositories = $tmp_arr;
|
||||
|
||||
$config->set('git', 'repositories', $repositories);
|
||||
|
||||
|
||||
// Startup and configure Silex application
|
||||
$app = new GitList\Application($config, __DIR__);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
echo "<pre>";
|
||||
|
||||
/**
|
||||
* GitList 0.3
|
||||
* https://github.com/klaussilveira/gitlist
|
||||
@@ -16,4 +18,7 @@ require 'vendor/autoload.php';
|
||||
$config = GitList\Config::fromFile('config.ini');
|
||||
|
||||
$app = require 'boot.php';
|
||||
|
||||
echo "</pre>";
|
||||
|
||||
$app->run();
|
||||
|
||||
@@ -49,8 +49,11 @@ class Config
|
||||
|
||||
protected function validateOptions()
|
||||
{
|
||||
if (!$this->get('git', 'repositories') || !is_dir($this->get('git', 'repositories'))) {
|
||||
die("Please, edit the config file and provide your repositories directory");
|
||||
foreach ( $this->get('git', 'repositories') as $dir ) {
|
||||
echo $dir;
|
||||
if (!$dir || !is_dir($dir)) {
|
||||
die("Please, edit the config file and provide your repositories directory");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class MainController implements ControllerProviderInterface
|
||||
$route = $app['controllers_factory'];
|
||||
|
||||
$route->get('/', function() use ($app) {
|
||||
/*
|
||||
$repositories = array_map(
|
||||
function ($repo) use ($app) {
|
||||
$repo['relativePath'] = $app['util.routing']->getRelativePath($repo['path']);
|
||||
@@ -20,6 +21,9 @@ class MainController implements ControllerProviderInterface
|
||||
},
|
||||
$app['git']->getRepositories($app['git.repos'])
|
||||
);
|
||||
*/
|
||||
|
||||
$repositories = $app['git']->getRepositories($app['git.repos']);
|
||||
|
||||
return $app['twig']->render('index.twig', array(
|
||||
'repositories' => $repositories,
|
||||
@@ -27,6 +31,7 @@ class MainController implements ControllerProviderInterface
|
||||
})->bind('homepage');
|
||||
|
||||
$route->get('{repo}/stats/{branch}', function($repo, $branch) use ($app) {
|
||||
#$repository = $app['git']->getRepository($app['git.repos'][$repo]);
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$stats = $repository->getStatistics($branch);
|
||||
$authors = $repository->getAuthorStatistics();
|
||||
|
||||
@@ -20,8 +20,11 @@ class Routing
|
||||
if ($regex === null) {
|
||||
$app = $this->app;
|
||||
$quotedPaths = array_map(
|
||||
#function ($repo) use ($app) {
|
||||
# return preg_quote($app['util.routing']->getRelativePath($repo['path']), '#');
|
||||
#},
|
||||
function ($repo) use ($app) {
|
||||
return preg_quote($app['util.routing']->getRelativePath($repo['path']), '#');
|
||||
return $repo['path'];
|
||||
},
|
||||
$this->app['git']->getRepositories($this->app['git.repos'])
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user