mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +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
|
RewriteEngine On
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteRule ^(.*)$ /index.php [L,NC]
|
RewriteRule ^(.*)$ index.php [L,NC]
|
||||||
</IfModule>
|
</IfModule>
|
||||||
<Files config.ini>
|
<Files config.ini>
|
||||||
order allow,deny
|
order allow,deny
|
||||||
|
|||||||
17
boot.php
17
boot.php
@@ -4,7 +4,22 @@ if (!isset($config)) {
|
|||||||
die("No configuration object provided.");
|
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
|
// Startup and configure Silex application
|
||||||
$app = new GitList\Application($config, __DIR__);
|
$app = new GitList\Application($config, __DIR__);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GitList 0.3
|
* GitList 0.3
|
||||||
* https://github.com/klaussilveira/gitlist
|
* https://github.com/klaussilveira/gitlist
|
||||||
@@ -16,4 +18,7 @@ require 'vendor/autoload.php';
|
|||||||
$config = GitList\Config::fromFile('config.ini');
|
$config = GitList\Config::fromFile('config.ini');
|
||||||
|
|
||||||
$app = require 'boot.php';
|
$app = require 'boot.php';
|
||||||
|
|
||||||
|
echo "</pre>";
|
||||||
|
|
||||||
$app->run();
|
$app->run();
|
||||||
|
|||||||
@@ -49,8 +49,11 @@ class Config
|
|||||||
|
|
||||||
protected function validateOptions()
|
protected function validateOptions()
|
||||||
{
|
{
|
||||||
if (!$this->get('git', 'repositories') || !is_dir($this->get('git', 'repositories'))) {
|
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");
|
die("Please, edit the config file and provide your repositories directory");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class MainController implements ControllerProviderInterface
|
|||||||
$route = $app['controllers_factory'];
|
$route = $app['controllers_factory'];
|
||||||
|
|
||||||
$route->get('/', function() use ($app) {
|
$route->get('/', function() use ($app) {
|
||||||
|
/*
|
||||||
$repositories = array_map(
|
$repositories = array_map(
|
||||||
function ($repo) use ($app) {
|
function ($repo) use ($app) {
|
||||||
$repo['relativePath'] = $app['util.routing']->getRelativePath($repo['path']);
|
$repo['relativePath'] = $app['util.routing']->getRelativePath($repo['path']);
|
||||||
@@ -20,6 +21,9 @@ class MainController implements ControllerProviderInterface
|
|||||||
},
|
},
|
||||||
$app['git']->getRepositories($app['git.repos'])
|
$app['git']->getRepositories($app['git.repos'])
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
$repositories = $app['git']->getRepositories($app['git.repos']);
|
||||||
|
|
||||||
return $app['twig']->render('index.twig', array(
|
return $app['twig']->render('index.twig', array(
|
||||||
'repositories' => $repositories,
|
'repositories' => $repositories,
|
||||||
@@ -27,6 +31,7 @@ class MainController implements ControllerProviderInterface
|
|||||||
})->bind('homepage');
|
})->bind('homepage');
|
||||||
|
|
||||||
$route->get('{repo}/stats/{branch}', function($repo, $branch) use ($app) {
|
$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);
|
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||||
$stats = $repository->getStatistics($branch);
|
$stats = $repository->getStatistics($branch);
|
||||||
$authors = $repository->getAuthorStatistics();
|
$authors = $repository->getAuthorStatistics();
|
||||||
|
|||||||
@@ -20,8 +20,11 @@ class Routing
|
|||||||
if ($regex === null) {
|
if ($regex === null) {
|
||||||
$app = $this->app;
|
$app = $this->app;
|
||||||
$quotedPaths = array_map(
|
$quotedPaths = array_map(
|
||||||
|
#function ($repo) use ($app) {
|
||||||
|
# return preg_quote($app['util.routing']->getRelativePath($repo['path']), '#');
|
||||||
|
#},
|
||||||
function ($repo) use ($app) {
|
function ($repo) use ($app) {
|
||||||
return preg_quote($app['util.routing']->getRelativePath($repo['path']), '#');
|
return $repo['path'];
|
||||||
},
|
},
|
||||||
$this->app['git']->getRepositories($this->app['git.repos'])
|
$this->app['git']->getRepositories($this->app['git.repos'])
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user