Skip to content
This repository was archived by the owner on Apr 12, 2020. It is now read-only.
/ browser Public archive

Commit 40cbc5b

Browse files
author
alexandresalome
committed
moving toward git-bundle
1 parent 7990e51 commit 40cbc5b

21 files changed

+54
-1807
lines changed

src/Gitonomy/Browser/Application.php

+24-15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
namespace Gitonomy\Browser;
44

5+
use Gitonomy\Browser\Controller\MainController;
6+
use Gitonomy\Browser\EventListener\RepositoryListener;
7+
use Gitonomy\Browser\Git\Repository;
8+
use Gitonomy\Browser\Routing\GitUrlGenerator;
9+
use Gitonomy\Browser\Utils\RepositoriesFinder;
10+
use Gitonomy\Bundle\GitBundle\Twig\GitExtension;
511
use Silex\Application as BaseApplication;
612
use Silex\Provider\FormServiceProvider;
713
use Silex\Provider\ServiceControllerServiceProvider;
@@ -11,13 +17,6 @@
1117
use Silex\Provider\WebProfilerServiceProvider;
1218
use SilexAssetic\AsseticServiceProvider;
1319

14-
use Gitonomy\Browser\Controller\MainController;
15-
use Gitonomy\Browser\EventListener\RepositoryListener;
16-
use Gitonomy\Browser\Git\Repository;
17-
use Gitonomy\Browser\Routing\GitUrlGenerator;
18-
use Gitonomy\Browser\Twig\GitExtension;
19-
use Gitonomy\Browser\Utils\RepositoriesFinder;
20-
2120
class Application extends BaseApplication
2221
{
2322
/**
@@ -69,13 +68,20 @@ public function __construct($configFile, array $extraParam = array())
6968
$this['assetic.asset_manager'] = $this->share(
7069
$this->extend('assetic.asset_manager', function($am, $app) {
7170
$am->set('styles', new \Assetic\Asset\AssetCache(
72-
new \Assetic\Asset\GlobAsset(
73-
array(
74-
__DIR__.'/../../../vendor/twitter/bootstrap/less/bootstrap.less',
75-
__DIR__.'/Resources/less/*.less',
71+
new \Assetic\Asset\AssetCollection(array(
72+
new \Assetic\Asset\GlobAsset(
73+
array(
74+
__DIR__.'/../../../vendor/twitter/bootstrap/less/bootstrap.less',
75+
__DIR__.'/Resources/less/*.less',
76+
),
77+
array($app['assetic.filter_manager']->get('less'))
7678
),
77-
array($app['assetic.filter_manager']->get('less'))
78-
),
79+
new \Assetic\Asset\GlobAsset(
80+
array(
81+
__DIR__.'/../../../vendor/gitonomy/git-bundle/Gitonomy/Bundle/GitBundle/Resources/public/css/*.css',
82+
)
83+
)
84+
)),
7985
new \Assetic\Cache\FilesystemCache(__DIR__.'/../../../cache/assetic')
8086
));
8187
$am->get('styles')->setTargetPath('css/styles.css');
@@ -86,12 +92,13 @@ public function __construct($configFile, array $extraParam = array())
8692
__DIR__.'/../../../web/vendor/jquery-1.9.0.min.js',
8793
__DIR__.'/../../../vendor/twitter/bootstrap/js/bootstrap-tooltip.js', // Should be loaded before other tw bootstrap assets
8894
__DIR__.'/../../../vendor/twitter/bootstrap/js/*.js',
95+
__DIR__.'/../../../vendor/gitonomy/git-bundle/Gitonomy/Bundle/GitBundle/Resources/public/js/*.js',
8996
__DIR__.'/Resources/js/*.js',
9097
)
9198
),
9299
new \Assetic\Cache\FilesystemCache(__DIR__.'/../../../cache/assetic')
93100
));
94-
$am->get('scripts')->setTargetPath('js/script.js');
101+
$am->get('scripts')->setTargetPath('js/scripts.js');
95102
return $am;
96103
})
97104
);
@@ -106,7 +113,9 @@ public function __construct($configFile, array $extraParam = array())
106113

107114
// Gitonomy\Browser Service Provider
108115
$urlGenerator = new GitUrlGenerator($this['url_generator'], $this['repositories']);
109-
$this['twig']->addExtension(new GitExtension($urlGenerator, array('git/default_theme.html.twig')));
116+
$this['twig']->addExtension(new GitExtension($urlGenerator, array('@GitonomyGitBundle/default_theme.html.twig')));
117+
118+
$this['twig.loader.filesystem']->addPath(__DIR__.'/../../../vendor/gitonomy/git-bundle/Gitonomy/Bundle/GitBundle/Resources/views', 'GitonomyGitBundle');
110119

111120
// Register the Repository Listener
112121
$this['dispatcher']->addSubscriber(new RepositoryListener($this['request_context'], $this['twig'], $this['repositories']));

src/Gitonomy/Browser/Controller/MainController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ public function logAjaxAction(Request $request, $repository)
6767

6868
public function treeAction($repository, $revision, $path)
6969
{
70+
$revision = $repository->getRevision($revision);
7071
try {
71-
$commit = $repository->getRevision($revision)->getResolved();
72+
$commit = $revision->getCommit();
7273
$tree = $commit->getTree();
7374
} catch (ReferenceNotFoundException $e) {
7475
throw new NotFoundHttpException(sprintf('The revision "%s" is not valid', $revision), $e);
@@ -83,7 +84,6 @@ public function treeAction($repository, $revision, $path)
8384
$template = $element instanceof Blob ? 'browse_blob.html.twig' : 'browse_tree.html.twig';
8485

8586
return $this->twig->render($template, array(
86-
'commit' => $commit,
8787
'element' => $element,
8888
'path' => $path,
8989
'revision' => $revision,

0 commit comments

Comments
 (0)