Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit df43c987cf02a3521ac65cf5bd4a4f54cf749177 @klaussilveira committed May 18, 2012
Showing with 20,826 additions and 0 deletions.
  1. +28 −0 .gitignore
  2. +7 −0 .htaccess
  3. +5 −0 .travis.yml
  4. +9 −0 LICENSE.txt
  5. +53 −0 README.md
  6. +6 −0 config.ini
  7. +32 −0 controllers/blobController.php
  8. +79 −0 controllers/commitController.php
  9. +10 −0 controllers/indexController.php
  10. +16 −0 controllers/rssController.php
  11. +20 −0 controllers/statsController.php
  12. +67 −0 controllers/treeController.php
  13. +52 −0 index.php
  14. +206 −0 lib/Application/Utils.php
  15. +22 −0 lib/Application/UtilsServiceProvider.php
  16. +122 −0 lib/Git/Client.php
  17. +35 −0 lib/Git/Commit/Author.php
  18. +148 −0 lib/Git/Commit/Commit.php
  19. +23 −0 lib/Git/GitServiceProvider.php
  20. +67 −0 lib/Git/Model/Blob.php
  21. +60 −0 lib/Git/Model/Diff.php
  22. +48 −0 lib/Git/Model/Line.php
  23. +44 −0 lib/Git/Model/Symlink.php
  24. +172 −0 lib/Git/Model/Tree.php
  25. +465 −0 lib/Git/Repository.php
  26. +29 −0 lib/Git/ScopeAware.php
  27. +18 −0 phpunit.xml.dist
  28. +371 −0 tests/ClientTest.php
  29. +46 −0 vendor/Twig/Autoloader.php
  30. +242 −0 vendor/Twig/Compiler.php
  31. +35 −0 vendor/Twig/CompilerInterface.php
  32. +1,106 −0 vendor/Twig/Environment.php
  33. +199 −0 vendor/Twig/Error.php
  34. +20 −0 vendor/Twig/Error/Loader.php
  35. +21 −0 vendor/Twig/Error/Runtime.php
  36. +21 −0 vendor/Twig/Error/Syntax.php
  37. +488 −0 vendor/Twig/ExpressionParser.php
  38. +93 −0 vendor/Twig/Extension.php
  39. +1,037 −0 vendor/Twig/Extension/Core.php
  40. +64 −0 vendor/Twig/Extension/Debug.php
  41. +106 −0 vendor/Twig/Extension/Escaper.php
  42. +35 −0 vendor/Twig/Extension/Optimizer.php
  43. +112 −0 vendor/Twig/Extension/Sandbox.php
  44. +84 −0 vendor/Twig/ExtensionInterface.php
  45. +75 −0 vendor/Twig/Filter.php
  46. +33 −0 vendor/Twig/Filter/Function.php
  47. +34 −0 vendor/Twig/Filter/Method.php
  48. +37 −0 vendor/Twig/Filter/Node.php
  49. +40 −0 vendor/Twig/FilterInterface.php
  50. +63 −0 vendor/Twig/Function.php
  51. +34 −0 vendor/Twig/Function/Function.php
  52. +35 −0 vendor/Twig/Function/Method.php
  53. +37 −0 vendor/Twig/Function/Node.php
  54. +37 −0 vendor/Twig/FunctionInterface.php
  55. +406 −0 vendor/Twig/Lexer.php
  56. +29 −0 vendor/Twig/LexerInterface.php
  57. +102 −0 vendor/Twig/Loader/Array.php
  58. +100 −0 vendor/Twig/Loader/Chain.php
  59. +152 −0 vendor/Twig/Loader/Filesystem.php
  60. +59 −0 vendor/Twig/Loader/String.php
  61. +53 −0 vendor/Twig/LoaderInterface.php
  62. +38 −0 vendor/Twig/Markup.php
  63. +227 −0 vendor/Twig/Node.php
  64. +40 −0 vendor/Twig/Node/AutoEscape.php
  65. +45 −0 vendor/Twig/Node/Block.php
  66. +38 −0 vendor/Twig/Node/BlockReference.php
  67. +20 −0 vendor/Twig/Node/Body.php
  68. +39 −0 vendor/Twig/Node/Do.php
  69. +39 −0 vendor/Twig/Node/Embed.php
  70. +21 −0 vendor/Twig/Node/Expression.php
  71. +86 −0 vendor/Twig/Node/Expression/Array.php
  72. +28 −0 vendor/Twig/Node/Expression/AssignName.php
  73. +40 −0 vendor/Twig/Node/Expression/Binary.php
  74. +18 −0 vendor/Twig/Node/Expression/Binary/Add.php
  75. +18 −0 vendor/Twig/Node/Expression/Binary/And.php
  76. +18 −0 vendor/Twig/Node/Expression/Binary/BitwiseAnd.php
  77. +18 −0 vendor/Twig/Node/Expression/Binary/BitwiseOr.php
  78. +18 −0 vendor/Twig/Node/Expression/Binary/BitwiseXor.php
  79. +18 −0 vendor/Twig/Node/Expression/Binary/Concat.php
  80. +18 −0 vendor/Twig/Node/Expression/Binary/Div.php
  81. +17 −0 vendor/Twig/Node/Expression/Binary/Equal.php
  82. +29 −0 vendor/Twig/Node/Expression/Binary/FloorDiv.php
  83. +17 −0 vendor/Twig/Node/Expression/Binary/Greater.php
  84. +17 −0 vendor/Twig/Node/Expression/Binary/GreaterEqual.php
  85. +33 −0 vendor/Twig/Node/Expression/Binary/In.php
  86. +17 −0 vendor/Twig/Node/Expression/Binary/Less.php
  87. +17 −0 vendor/Twig/Node/Expression/Binary/LessEqual.php
  88. +18 −0 vendor/Twig/Node/Expression/Binary/Mod.php
  89. +18 −0 vendor/Twig/Node/Expression/Binary/Mul.php
  90. +17 −0 vendor/Twig/Node/Expression/Binary/NotEqual.php
  91. +33 −0 vendor/Twig/Node/Expression/Binary/NotIn.php
  92. +18 −0 vendor/Twig/Node/Expression/Binary/Or.php
  93. +33 −0 vendor/Twig/Node/Expression/Binary/Power.php
  94. +33 −0 vendor/Twig/Node/Expression/Binary/Range.php
  95. +18 −0 vendor/Twig/Node/Expression/Binary/Sub.php
  96. +52 −0 vendor/Twig/Node/Expression/BlockReference.php
  97. +31 −0 vendor/Twig/Node/Expression/Conditional.php
  98. +23 −0 vendor/Twig/Node/Expression/Constant.php
  99. +34 −0 vendor/Twig/Node/Expression/ExtensionReference.php
  100. +61 −0 vendor/Twig/Node/Expression/Filter.php
  101. +44 −0 vendor/Twig/Node/Expression/Filter/Default.php
  102. +66 −0 vendor/Twig/Node/Expression/Function.php
  103. +53 −0 vendor/Twig/Node/Expression/GetAttr.php
  104. +37 −0 vendor/Twig/Node/Expression/MethodCall.php
  105. +76 −0 vendor/Twig/Node/Expression/Name.php
  106. +48 −0 vendor/Twig/Node/Expression/Parent.php
  107. +22 −0 vendor/Twig/Node/Expression/TempName.php
  108. +54 −0 vendor/Twig/Node/Expression/Test.php
  109. +36 −0 vendor/Twig/Node/Expression/Test/Constant.php
  110. +55 −0 vendor/Twig/Node/Expression/Test/Defined.php
  111. +34 −0 vendor/Twig/Node/Expression/Test/Divisibleby.php
  112. +33 −0 vendor/Twig/Node/Expression/Test/Even.php
  113. +32 −0 vendor/Twig/Node/Expression/Test/Null.php
  114. +33 −0 vendor/Twig/Node/Expression/Test/Odd.php
  115. +30 −0 vendor/Twig/Node/Expression/Test/Sameas.php
  116. +30 −0 vendor/Twig/Node/Expression/Unary.php
  117. +18 −0 vendor/Twig/Node/Expression/Unary/Neg.php
  118. +18 −0 vendor/Twig/Node/Expression/Unary/Not.php
  119. +18 −0 vendor/Twig/Node/Expression/Unary/Pos.php
  120. +37 −0 vendor/Twig/Node/Flush.php
  121. +113 −0 vendor/Twig/Node/For.php
  122. +56 −0 vendor/Twig/Node/ForLoop.php
  123. +67 −0 vendor/Twig/Node/If.php
  124. +51 −0 vendor/Twig/Node/Import.php
  125. +100 −0 vendor/Twig/Node/Include.php
  126. +84 −0 vendor/Twig/Node/Macro.php
  127. +372 −0 vendor/Twig/Node/Module.php
  128. +40 −0 vendor/Twig/Node/Print.php
  129. +48 −0 vendor/Twig/Node/Sandbox.php
  130. +61 −0 vendor/Twig/Node/SandboxedModule.php
  131. +60 −0 vendor/Twig/Node/SandboxedPrint.php
  132. +102 −0 vendor/Twig/Node/Set.php
  133. +35 −0 vendor/Twig/Node/SetTemp.php
  134. +41 −0 vendor/Twig/Node/Spaceless.php
  135. +40 −0 vendor/Twig/Node/Text.php
  136. +30 −0 vendor/Twig/NodeInterface.php
  137. +20 −0 vendor/Twig/NodeOutputInterface.php
  138. +89 −0 vendor/Twig/NodeTraverser.php
  139. +164 −0 vendor/Twig/NodeVisitor/Escaper.php
  140. +247 −0 vendor/Twig/NodeVisitor/Optimizer.php
  141. +119 −0 vendor/Twig/NodeVisitor/SafeAnalysis.php
  142. +106 −0 vendor/Twig/NodeVisitor/Sandbox.php
  143. +48 −0 vendor/Twig/NodeVisitorInterface.php
  144. +384 −0 vendor/Twig/Parser.php
  145. +28 −0 vendor/Twig/ParserInterface.php
  146. +20 −0 vendor/Twig/Sandbox/SecurityError.php
  147. +120 −0 vendor/Twig/Sandbox/SecurityPolicy.php
  148. +25 −0 vendor/Twig/Sandbox/SecurityPolicyInterface.php
  149. +450 −0 vendor/Twig/Template.php
  150. +47 −0 vendor/Twig/TemplateInterface.php
  151. +31 −0 vendor/Twig/Test/Function.php
  152. +32 −0 vendor/Twig/Test/Method.php
  153. +35 −0 vendor/Twig/Test/Node.php
  154. +26 −0 vendor/Twig/TestInterface.php
  155. +219 −0 vendor/Twig/Token.php
  156. +34 −0 vendor/Twig/TokenParser.php
  157. +88 −0 vendor/Twig/TokenParser/AutoEscape.php
  158. +83 −0 vendor/Twig/TokenParser/Block.php
  159. +42 −0 vendor/Twig/TokenParser/Do.php
  160. +66 −0 vendor/Twig/TokenParser/Embed.php
  161. +54 −0 vendor/Twig/TokenParser/Extends.php
  162. +61 −0 vendor/Twig/TokenParser/Filter.php
  163. +42 −0 vendor/Twig/TokenParser/Flush.php
  164. +89 −0 vendor/Twig/TokenParser/For.php
  165. +74 −0 vendor/Twig/TokenParser/From.php
  166. +93 −0 vendor/Twig/TokenParser/If.php
  167. +47 −0 vendor/Twig/TokenParser/Import.php
  168. +80 −0 vendor/Twig/TokenParser/Include.php
  169. +69 −0 vendor/Twig/TokenParser/Macro.php
  170. +55 −0 vendor/Twig/TokenParser/Sandbox.php
  171. +84 −0 vendor/Twig/TokenParser/Set.php
  172. +59 −0 vendor/Twig/TokenParser/Spaceless.php
  173. +85 −0 vendor/Twig/TokenParser/Use.php
  174. +113 −0 vendor/Twig/TokenParserBroker.php
  175. +45 −0 vendor/Twig/TokenParserBrokerInterface.php
  176. +42 −0 vendor/Twig/TokenParserInterface.php
  177. +145 −0 vendor/Twig/TokenStream.php
  178. BIN vendor/silex.phar
  179. +37 −0 views/blame.twig
  180. +15 −0 views/branch_menu.twig
  181. +58 −0 views/commit.twig
  182. +46 −0 views/commits.twig
  183. +17 −0 views/error.twig
  184. +43 −0 views/file.twig
  185. +3 −0 views/footer.twig
  186. +25 −0 views/index.twig
  187. +19 −0 views/layout.twig
  188. +5 −0 views/menu.twig
  189. +19 −0 views/navigation.twig
  190. +17 −0 views/rss.twig
  191. +61 −0 views/stats.twig
  192. +57 −0 views/tree.twig
  193. +2 −0 web/Makefile
  194. +788 −0 web/css/style.css
  195. BIN web/img/feed.png
  196. BIN web/img/glyphicons-halflings-white.png
  197. BIN web/img/glyphicons-halflings.png
  198. +1 −0 web/js/bootstrap.js
  199. +1 −0 web/js/codemirror.js
  200. +3 −0 web/js/html5.js
  201. +4 −0 web/js/jquery.js
  202. +12 −0 web/js/main.js
  203. +33 −0 web/less/accordion.less
  204. +58 −0 web/less/alerts.less
  205. +64 −0 web/less/bootstrap.less
  206. +25 −0 web/less/breadcrumbs.less
  207. +191 −0 web/less/button-groups.less
  208. +191 −0 web/less/buttons.less
  209. +121 −0 web/less/carousel.less
  210. +29 −0 web/less/close.less
  211. +57 −0 web/less/code.less
  212. +125 −0 web/less/codemirror.less
  213. +20 −0 web/less/component-animations.less
  214. +154 −0 web/less/dropdowns.less
  215. +144 −0 web/less/files.less
  216. +584 −0 web/less/forms.less
  217. +5 −0 web/less/grid.less
  218. +22 −0 web/less/hero-unit.less
  219. +55 −0 web/less/labels-badges.less
  220. +17 −0 web/less/layouts.less
  221. +631 −0 web/less/mixins.less
  222. +90 −0 web/less/modals.less
  223. +367 −0 web/less/navbar.less
  224. +363 −0 web/less/navs.less
  225. +36 −0 web/less/pager.less
  226. +56 −0 web/less/pagination.less
  227. +49 −0 web/less/popovers.less
  228. +117 −0 web/less/progress-bars.less
  229. +126 −0 web/less/reset.less
  230. +26 −0 web/less/responsive-1200px-min.less
  231. +149 −0 web/less/responsive-767px-max.less
  232. +17 −0 web/less/responsive-768px-979px.less
  233. +146 −0 web/less/responsive-navbar.less
  234. +41 −0 web/less/responsive-utilities.less
  235. +48 −0 web/less/responsive.less
  236. +31 −0 web/less/scaffolding.less
  237. +205 −0 web/less/sprites.less
  238. +210 −0 web/less/tables.less
  239. +47 −0 web/less/thumbnails.less
  240. +35 −0 web/less/tooltip.less
  241. +235 −0 web/less/type.less
  242. +31 −0 web/less/utilities.less
  243. +209 −0 web/less/variables.less
  244. +27 −0 web/less/wells.less
@@ -0,0 +1,28 @@
+cache/
+*.diff
+*.err
+*.orig
+*.log
+*.rej
+*.swo
+*.swp
+*.zip
+*.vi
+*~
+*.sass-cache
+.DS_Store
+._*
+Thumbs.db
+.cache
+.project
+.settings
+.tmproj
+*.esproj
+nbproject
+*.sublime-project
+*.sublime-workspace
+.hg
+.svn
+.CVS
+.idea
+node_modules
@@ -0,0 +1,7 @@
+<IfModule mod_rewrite.c>
+ Options -MultiViews
+
+ RewriteEngine On
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^ index.php [L]
+</IfModule>
@@ -0,0 +1,5 @@
+language: php
+php:
+ - 5.3
+ - 5.4
+script: phpunit
@@ -0,0 +1,9 @@
+Copyright (c) 2012, Klaus Silveira and contributors
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+Neither the name of GitList nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,53 @@
+# GitList: an elegant and modern git repository viewer
+[![Build Status](https://secure.travis-ci.org/klaussilveira/GitList.png)](http://travis-ci.org/klaussilveira/GitList)
+
+GitList is an elegant and modern web interface for interacting with multiple git repositories. It allows you to browse repositories using your favorite browser, viewing files under different revisions, commit history, diffs. It also generates RSS feeds for each repository, allowing you to stay up-to-date with the latest changes anytime, anywhere. GitList was written in PHP, on top of the [Silex](http://silex.sensiolabs.org/) microframework and powered by the Twig template engine. This means that GitList is easy to install and easy to customize. Also, the GitList gorgeous interface was made possible due to [Bootstrap](http://twitter.github.com/bootstrap/).
+
+## Features
+* Multiple repository support
+* Multiple branch support
+* Multiple tag support
+* Commit history, blame, diff
+* RSS feeds
+* Syntax highlighting
+* Repository statistics
+
+## Authors and contributors
+* [Klaus Silveira](http://www.klaussilveira.com) (Creator, developer)
+
+## License
+[New BSD license](http://www.opensource.org/licenses/bsd-license.php)
+
+## Todo
+* improve the current test code coverage
+* test the interface
+* error handling can be greatly improved during parsing
+* submodule support
+* multilanguage support
+
+## Requirements
+In order to run GitList on your server, you'll need:
+
+* git
+* Apache and mod_rewrite enabled
+* PHP 5.3.3
+
+## Installing
+Download the GitList latest package and decompress to your `/var/www/gitlist` folder, or anywhere else you want to place GitList. You can also clone the repository:
+
+```
+git clone https://github.com/klaussilveira/gitlist.git /var/www/gitlist
+```
+
+Now open up the `config.ini` and configure your installation. You'll have to provide where your repositories are located and the base GitList URL (in our case, http://localhost/gitlist). Now, let's create the cache folder and give the correct permissions:
+
+```
+cd /var/www/gitlist
+mkdir cache
+chmod 777 cache
+```
+
+That's it, installation complete!
+
+## Further information
+If you want to know more about customizing GitList, check the [Customization](https://github.com/klaussilveira/gitlist/wiki/Customizing) page on the wiki. Also, if you're having problems with GitList, check the [Troubleshooting](https://github.com/klaussilveira/gitlist/wiki/Customizing) page. Don't forget to report issues and suggest new features! :)
@@ -0,0 +1,6 @@
+[git]
+client = '/usr/bin/git' ; Your git executable path
+repositories = '/home/git/' ; Path to your repositories (with ending slash)
+
+[app]
+baseurl = 'http://localhost/gitlist' ; Base URL of the application (without ending slash)
@@ -0,0 +1,32 @@
+<?php
+
+$app->get('{repo}/blob/{branch}/{file}/', function($repo, $branch, $file) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $blob = $repository->getBlob("$branch:$file");
+ $breadcrumbs = $app['utils']->getBreadcrumbs("$repo/tree/$branch/$file");
+ $fileType = $app['utils']->getFileType($file);
+
+ return $app['twig']->render('file.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'page' => 'files',
+ 'file' => $file,
+ 'fileType' => $fileType,
+ 'blob' => $blob->output(),
+ 'repo' => $repo,
+ 'branch' => $branch,
+ 'breadcrumbs' => $breadcrumbs,
+ 'branches' => $repository->getBranches(),
+ 'tags' => $repository->getTags(),
+ ));
+})->assert('file', '.+')
+ ->assert('repo', '[\w-._]+')
+ ->assert('branch', '[\w-._]+');
+
+$app->get('{repo}/raw/{branch}/{file}', function($repo, $branch, $file) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $blob = $repository->getBlob("$branch:$file")->output();
+
+ return new Symfony\Component\HttpFoundation\Response($blob, 200, array('Content-Type' => 'text/plain'));
+})->assert('file', '.+')
+ ->assert('repo', '[\w-._]+')
+ ->assert('branch', '[\w-._]+');
@@ -0,0 +1,79 @@
+<?php
+
+$app->get('{repo}/commits/{branch}', function($repo, $branch) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $commits = $repository->getCommits();
+
+ foreach ($commits as $commit) {
+ $date = $commit->getDate();
+ $date = $date->format('m/d/Y');
+ $categorized[$date][] = $commit;
+ }
+
+ return $app['twig']->render('commits.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'page' => 'commits',
+ 'repo' => $repo,
+ 'branch' => $branch,
+ 'branches' => $repository->getBranches(),
+ 'tags' => $repository->getTags(),
+ 'commits' => $categorized,
+ ));
+})->assert('repo', '[\w-._]+')
+ ->assert('branch', '[\w-._]+')
+ ->value('branch', 'master');
+
+$app->get('{repo}/commits/{branch}/{file}/', function($repo, $branch, $file) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $commits = $repository->getCommits($file);
+
+ foreach ($commits as $commit) {
+ $date = $commit->getDate();
+ $date = $date->format('m/d/Y');
+ $categorized[$date][] = $commit;
+ }
+
+ return $app['twig']->render('commits.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'page' => 'commits',
+ 'repo' => $repo,
+ 'branch' => $branch,
+ 'branches' => $repository->getBranches(),
+ 'tags' => $repository->getTags(),
+ 'commits' => $categorized,
+ ));
+})->assert('repo', '[\w-._]+')
+ ->assert('file', '.+')
+ ->assert('branch', '[\w-._]+');
+
+$app->get('{repo}/commit/{commit}/', function($repo, $commit) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $commit = $repository->getCommit($commit);
+
+ return $app['twig']->render('commit.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'page' => 'commits',
+ 'branch' => 'master',
+ 'repo' => $repo,
+ 'commit' => $commit,
+ ));
+})->assert('repo', '[\w-._]+')
+ ->assert('commit', '[a-f0-9]+');
+
+$app->get('{repo}/blame/{branch}/{file}/', function($repo, $branch, $file) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $blames = $repository->getBlame($file);
+
+ return $app['twig']->render('blame.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'page' => 'commits',
+ 'file' => $file,
+ 'repo' => $repo,
+ 'branch' => $branch,
+ 'branches' => $repository->getBranches(),
+ 'tags' => $repository->getTags(),
+ 'blames' => $blames,
+ ));
+})->assert('repo', '[\w-._]+')
+ ->assert('file', '.+')
+ ->assert('branch', '[\w-._]+');
@@ -0,0 +1,10 @@
+<?php
+
+$app->get('/', function() use($app) {
+ $repositories = $app['git']->getRepositories($app['git.repos']);
+
+ return $app['twig']->render('index.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'repositories' => $repositories,
+ ));
+});
@@ -0,0 +1,16 @@
+<?php
+
+$app->get('{repo}/{branch}/rss/', function($repo, $branch) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $commits = $repository->getCommits();
+
+ $html = $app['twig']->render('rss.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'repo' => $repo,
+ 'branch' => $branch,
+ 'commits' => $commits,
+ ));
+
+ return new Symfony\Component\HttpFoundation\Response($html, 200, array('Content-Type' => 'application/rss+xml'));
+})->assert('repo', '[\w-._]+')
+ ->assert('branch', '[\w-._]+');
@@ -0,0 +1,20 @@
+<?php
+
+$app->get('{repo}/stats/{branch}', function($repo, $branch) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $stats = $repository->getStatistics($branch);
+ $authors = $repository->getAuthorStatistics();
+
+ return $app['twig']->render('stats.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'page' => 'stats',
+ 'repo' => $repo,
+ 'branch' => $branch,
+ 'branches' => $repository->getBranches(),
+ 'tags' => $repository->getTags(),
+ 'stats' => $stats,
+ 'authors' => $authors,
+ ));
+})->assert('repo', '[\w-._]+')
+ ->assert('branch', '[\w-._]+')
+ ->value('branch', 'master');
@@ -0,0 +1,67 @@
+<?php
+
+$app->get('{repo}/', function($repo) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $tree = $repository->getTree('master');
+ $breadcrumbs = $app['utils']->getBreadcrumbs("$repo/");
+
+ return $app['twig']->render('tree.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'page' => 'files',
+ 'files' => $tree->output(),
+ 'repo' => $repo,
+ 'branch' => 'master',
+ 'path' => '',
+ 'parent' => '',
+ 'breadcrumbs' => $breadcrumbs,
+ 'branches' => $repository->getBranches(),
+ 'tags' => $repository->getTags(),
+ ));
+})->assert('repo', '[\w-._]+');
+
+$app->get('{repo}/tree/{branch}/', function($repo, $branch) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $tree = $repository->getTree($branch);
+ $breadcrumbs = $app['utils']->getBreadcrumbs("$repo/");
+
+ return $app['twig']->render('tree.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'page' => 'files',
+ 'files' => $tree->output(),
+ 'repo' => $repo,
+ 'branch' => $branch,
+ 'path' => '',
+ 'parent' => '',
+ 'breadcrumbs' => $breadcrumbs,
+ 'branches' => $repository->getBranches(),
+ 'tags' => $repository->getTags(),
+ ));
+})->assert('repo', '[\w-._]+')
+ ->assert('branch', '[\w-._]+');
+
+$app->get('{repo}/tree/{branch}/{tree}/', function($repo, $branch, $tree) use($app) {
+ $repository = $app['git']->getRepository($app['git.repos'] . $repo);
+ $files = $repository->getTree("$branch:$tree/");
+ $breadcrumbs = $app['utils']->getBreadcrumbs("$repo/tree/$branch/$tree");
+
+ if (($slash = strrpos($tree, '/')) !== false) {
+ $parent = '/' . substr($tree, 0, $slash);
+ } else {
+ $parent = '/';
+ }
+
+ return $app['twig']->render('tree.twig', array(
+ 'baseurl' => $app['baseurl'],
+ 'page' => 'files',
+ 'files' => $files->output(),
+ 'repo' => $repo,
+ 'branch' => $branch,
+ 'path' => "$tree/",
+ 'parent' => $parent,
+ 'breadcrumbs' => $breadcrumbs,
+ 'branches' => $repository->getBranches(),
+ 'tags' => $repository->getTags(),
+ ));
+})->assert('tree', '.+')
+ ->assert('repo', '[\w-._]+')
+ ->assert('branch', '[\w-._]+');
Oops, something went wrong.

0 comments on commit df43c98

Please sign in to comment.