Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
Conflicts:
	src/GitList/Git/Repository.php
  • Loading branch information
lukx committed May 12, 2013
2 parents 6813667 5ed2111 commit 59fe876
Show file tree
Hide file tree
Showing 24 changed files with 341 additions and 151 deletions.
4 changes: 3 additions & 1 deletion boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,9 @@
die("No configuration object provided.");
}

$config->set('git', 'repositories', rtrim($config->get('git', 'repositories'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
if (!is_writable(__DIR__ . DIRECTORY_SEPARATOR . 'cache')) {
die(sprintf('The "%s" folder must be writable for GitList to run.', __DIR__ . DIRECTORY_SEPARATOR . 'cache'));
}

// Startup and configure Silex application
$app = new GitList\Application($config, __DIR__);
Expand Down
23 changes: 18 additions & 5 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="gitlist" default="build">
<target name="build" depends="prepare,lint,phploc,pdepend,phpmd,phpcpd,phpunit" />
<target name="build-package" depends="prepare-package,lint,phploc,package" />
<target name="build" depends="prepare,lint,phploc,pdepend,phpmd,phpcpd,phpunit,phpcs" />
<target name="build-package" depends="prepare-package,package" />

<target name="clean" description="Clean build artifacts">
<delete dir="${basedir}/build"/>
Expand All @@ -10,15 10,18 @@
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
<copy file="config.ini-example" tofile="config.ini"/>
<exec executable="composer" failonerror="true">
<arg value="install" />
<arg value="--dev" />
</exec>
</target>

<target name="prepare-package" depends="clean" description="Prepare for build">
<target name="prepare-package" description="Prepare for build">
<delete dir="${basedir}/vendor"/>
<exec executable="composer" failonerror="true">
<arg value="install" />
<arg value="--optimize-autoloader" />
</exec>
</target>

Expand Down Expand Up @@ -75,15 78,25 @@
<exec executable="phpunit" failonerror="true"/>
</target>

<target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="phpcs" output="/dev/null">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg value="--standard=PSR2" />
<arg path="${basedir}/src" />
</exec>
</target>

<target name="package" description="Package the application for distribution">
<copy todir="${basedir}/build/gitlist/">
<fileset dir="${basedir}" excludes="build/**, tests/**, pkg_builder/**, phpunit.xml.dist, cache.properties, .gitignore, .travis.yml, build.xml, composer.json, composer.lock, config.ini" />
<fileset dir="${basedir}" excludes="cache/**, build/**, tests/**, pkg_builder/**, phpunit.xml.dist, cache.properties, .gitignore, .travis.yml, build.xml, composer.json, composer.lock, config.ini" />
</copy>

<tar destfile="${basedir}/build/gitlist.tar.gz"
<tar destfile="${basedir}/build/gitlist-master.tar.gz"
basedir="${basedir}/build/"
compression="gzip"
longfile="gnu"
excludes="gitlist-master.tar.gz, **/logs/**, **/pdepend/**"
/>
</target>
</project>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
"twig/twig": "1.12.*",
"symfony/twig-bridge": "2.2.*",
"symfony/filesystem": "2.2.*",
"klaussilveira/gitter": "0.1.3"
"klaussilveira/gitter": "dev-master"
},
"require-dev": {
"symfony/browser-kit": "2.2.*",
Expand Down
55 changes: 28 additions & 27 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions config.ini-example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 3,19 @@ client = '/usr/bin/git' ; Your git executable path
repositories = '/var/www/projects/' ; Path to your repositories
default_branch = 'master' ; Default branch when HEAD is detached


;Windows Users
;client = '"C:\Program Files (x86)\Git\bin\git.exe"' ; Your git executable path
;repositories = 'C:\Path\to\Repos\' ; Path to your repositories


; If you want to specify multiple paths, use the array syntax instead:
;
;repositories[] = '/var/www/projects/'
;repositories[] = '/var/www/subdir/more_projects/'
;repositories[] = '/home/user/even_more_projects/'


; You can hide repositories from GitList, just copy this for each repository you want to hide
; hidden[] = '/var/www/projects/BetaTest'

Expand Down
4 changes: 3 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 10,7 @@
date_default_timezone_set('UTC');
}

if(php_sapi_name() == 'cli-server' && file_exists(substr($_SERVER['REQUEST_URI'], 1))) {
if (php_sapi_name() == 'cli-server' && file_exists(substr($_SERVER['REQUEST_URI'], 1))) {
return false;
}

Expand All @@ -20,4 20,6 @@
$config = GitList\Config::fromFile('config.ini');

$app = require 'boot.php';

$app->run();

50 changes: 42 additions & 8 deletions src/GitList/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 15,8 @@
*/
class Application extends SilexApplication
{
protected $path;

/**
* Constructor initialize services.
*
Expand All @@ -24,25 26,35 @@ class Application extends SilexApplication
public function __construct(Config $config, $root = null)
{
parent::__construct();

$app = $this;
$root = realpath($root);
$this->path = realpath($root);

$this['debug'] = $config->get('app', 'debug');
$this['filetypes'] = $config->getSection('filetypes');
$this['cache.archives'] = $root . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'archives';
$this['cache.archives'] = $this->getCachePath() . 'archives';

// Register services
$this->register(new TwigServiceProvider(), array(
'twig.path' => $root . DIRECTORY_SEPARATOR . 'views',
'twig.options' => array('cache' => $root . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'views'),
'twig.path' => $this->getViewPath(),
'twig.options' => array('cache' => $this->getCachePath() . 'views'),
));

$repositories = $config->get('git', 'repositories');
$repositoryCache = $config->get('app', 'cached_repos');
if (false === $repositoryCache || empty($repositoryCache)) {
$repositoryCache = $this->getCachePath() . 'repos.json';
}

$this->register(new GitServiceProvider(), array(
'git.client' => $config->get('git', 'client'),
'git.repos' => $config->get('git', 'repositories'),
'git.hidden' => $config->get('git', 'hidden') ? $config->get('git', 'hidden') : array(),
'git.client' => $config->get('git', 'client'),
'git.repos' => $repositories,
'cache.repos' => $repositoryCache,
'ini.file' => "config.ini",
'git.hidden' => $config->get('git', 'hidden') ?
$config->get('git', 'hidden') : array(),
'git.default_branch' => $config->get('git', 'default_branch') ? $config->get('git', 'default_branch') : 'master',
));

$this->register(new ViewUtilServiceProvider());
$this->register(new RepositoryUtilServiceProvider());
$this->register(new UrlGeneratorServiceProvider());
Expand All @@ -66,4 78,26 @@ public function __construct(Config $config, $root = null)
));
});
}

public function getPath()
{
return $this->path . DIRECTORY_SEPARATOR;
}

public function setPath($path)
{
$this->path = $path;
return $this;
}

public function getCachePath()
{
return $this->path . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR;
}

public function getViewPath()
{
return $this->path . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR;
}
}

Loading

0 comments on commit 59fe876

Please sign in to comment.