beber pushed a commit to branch master.

commit 182641f11ef9d3f6d4e8c227ec68fab3dad2128b
Author: Bertrand Jacquin <[email protected]>
Date:   Tue Aug 13 23:16:03 2013 +0200

    Initial import
---
 .gitignore                      |   9 +++++
 .htaccess                       |  53 ++++++++++++++++++++++++++
 README                          |  18 +++++++++
 cgitrc                          |  58 ++++++++++++++++++++++++++++
 filters/about-filter            |   1 +
 filters/highlight               |  81 ++++++++++++++++++++++++++++++++++++++++
 filters/source-filter           |   1 +
 filters/templates/rst2html.tmpl |   4 ++
 logo.png                        | Bin 0 -> 19506 bytes
 repos.txt                       |   1 +
 10 files changed, 226 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b4bb394
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+# Cache directory
+cache
+
+# Shipped from www-apps/cgit
+cgit.cgi
+cgit.css
+
+# Shipped from dev-vcs/git
+git-http-backend.cgi
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..b44ada4
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,53 @@
+# Force no Indexes in all cases
+# Force ExecCGI
+# FollowSymlinks for RewriteEngine
+Options -Indexes ExecCGI FollowSymlinks
+
+AddHandler cgi-script .cgi
+# No index.html or other things
+DirectoryIndex cgit.cgi
+
+# Config is locally hosted, not depending on root filesystem
+SetEnv CGIT_CONFIG ./cgitrc
+
+# git-html-backend config
+# GIT_HTTP_EXPORT_ALL is not defined, gitolite create git-daemon-export-ok
+SetEnv GIT_PROJECT_ROOT /srv/gitolite/repositories
+
+RewriteEngine On
+
+# Disable HTTPS
+RewriteCond %{ENV:HTTPS} On
+RewriteRule ^(.*)        http://%{SERVER_NAME}/$1 [R=301,L]
+
+# Stop here if cgit is handling the request
+RewriteCond %{REQUEST_URI} ^/cgit\.cgi
+RewriteRule (.*) - [L]
+
+# Stop here if git-http-backend is handling the request
+RewriteCond %{REQUEST_URI} ^/git-http-backend\.cgi
+RewriteRule (.*) - [L]
+
+# Disable git-http-backend write access
+RewriteCond %{REQUEST_URI} ^(.*)\.git/git-receive-pack
+RewriteRule (.*) - [F,L]
+
+# Access to git files at the same URL than cgit, filter them
+RewriteCond %{REQUEST_URI} ^(.*)\.git/HEAD$                               [OR]
+RewriteCond %{REQUEST_URI} ^(.*)\.git/info/refs$                          [OR]
+RewriteCond %{REQUEST_URI} ^(.*)\.git/objects/info/[^/]+                  [OR]
+RewriteCond %{REQUEST_URI} ^(.*)\.git/objects/[0-9a-f]{2}/[0-9a-f]{38}$   [OR]
+RewriteCond %{REQUEST_URI} ^(.*)\.git/pack/pack-[0-9a-f]{40}\.(pack|idx)$ [OR]
+RewriteCond %{REQUEST_URI} ^(.*)\.git/git-upload-pack$
+RewriteRule (.*) /git-http-backend.cgi/$1 [L,QSA]
+
+# Refuse to serve to users the config file
+RewriteCond %{REQUEST_URI} ^/cgitrc$
+RewriteRule (.*) - [F,L]
+
+# Serve local file
+RewriteCond %{REQUEST_FILENAME} -f
+RewriteRule .* - [L]
+
+# Access cgit from /
+RewriteRule ^([^/]+)(/?(.*)) /cgit.cgi/$1$2 [L,QSA,NS]
diff --git a/README b/README
new file mode 100644
index 0000000..f0ac8a7
--- /dev/null
+++ b/README
@@ -0,0 +1,18 @@
+** What is needed ?
+
+www-apps/cgit
+app-text/highlight    # For general formatting/highlighting
+dev-python/markdown   # For .md/about formatting
+dev-python/docutils   # For .rst/about formatting
+
+** How to make this work ?
+
+# cgit core
+ln -s /usr/share/webapps/cgit/*/hostroot/cgi-bin/cgit.cgi cgit.cgi
+ln -s /usr/share/webapps/cgit/*/htdocs/cgit.css           cgit.css
+
+# git http-backend
+ln -s /usr/libexec/git-core/git-http-backend              git-http-backend
+
+# Beautify
+chmod +x filters/highlight
diff --git a/cgitrc b/cgitrc
new file mode 100644
index 0000000..5be175d
--- /dev/null
+++ b/cgitrc
@@ -0,0 +1,58 @@
+root-title=Enlightened git repositories
+
+# From http://enlightenment.org/p/index/d/logo.png
+logo=/logo.png
+# from http://enlightenment.org/favicon.png
+favicon=/favicon.ico
+css=/cgit.css
+
+robots=all
+
+clone-prefix=git://git.enlightenment.org http://git.enlightenment.org 
git+ssh://[email protected]
+
+virtual-root=/
+
+enable-index-links=0
+enable-index-owner=1
+# See merges in log
+enable-commit-graph=1
+enable-log-filecount=1
+enable-log-linecount=1
+enable-tree-linenumbers=1
+enable-subject-links=1
+enable-remote-branches=1
+
+about-filter=filters/about-filter
+source-filter=filters/source-filter
+
+max-repo-count=500
+max-commit-count=50
+
+max-stats=year
+
+noplainemail=0
+
+# Really slow
+#snapshots=tar.gz tar.bz2
+
+readme=master:README
+readme=master:README.md
+readme=master:doc/index.rst
+
+mimetype-file=/etc/mime.types
+
+cache-root=./cache
+cache-size=10000
+cache-dynamic-ttl=1
+cache-repo-ttl=1
+cache-root-ttl=1
+cache-scanrc-ttl=5
+cache-static-ttl=1
+
+enable-git-config=1
+
+# We have a no dumb HTTP clone handled by git-daemon-http
+enable-http-clone=0
+
+project-list=/srv/gitolite/projects.list
+scan-path=/srv/gitolite/repositories/
diff --git a/filters/about-filter b/filters/about-filter
new file mode 120000
index 0000000..11f2be1
--- /dev/null
+++ b/filters/about-filter
@@ -0,0 +1 @@
+highlight
\ No newline at end of file
diff --git a/filters/highlight b/filters/highlight
new file mode 100755
index 0000000..332a08b
--- /dev/null
+++ b/filters/highlight
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# This script can be used to implement syntax highlighting in the cgit
+# tree-view by refering to this file with the source-filter or repo.source-
+# filter options in cgitrc.
+#
+# This script requires a shell supporting the ${var##pattern} syntax.
+# It is supported by at least dash and bash, however busybox environments
+# might have to use an external call to sed instead.
+#
+# Note: the highlight command (http://www.andre-simon.de/) uses css for syntax
+# highlighting, so you'll probably want something like the following included
+# in your css file (generated by highlight 2.4.8 and adapted for cgit):
+#
+# table.blob .num  { color:#2928ff; }
+# table.blob .esc  { color:#ff00ff; }
+# table.blob .str  { color:#ff0000; }
+# table.blob .dstr { color:#818100; }
+# table.blob .slc  { color:#838183; font-style:italic; }
+# table.blob .com  { color:#838183; font-style:italic; }
+# table.blob .dir  { color:#008200; }
+# table.blob .sym  { color:#000000; }
+# table.blob .kwa  { color:#000000; font-weight:bold; }
+# table.blob .kwb  { color:#830000; }
+# table.blob .kwc  { color:#000000; font-weight:bold; }
+# table.blob .kwd  { color:#010181; }
+#
+# The following environment variables can be used to retrieve the configuration
+# of the repository for which this script is called:
+# CGIT_REPO_URL        ( = repo.url       setting )
+# CGIT_REPO_NAME       ( = repo.name      setting )
+# CGIT_REPO_PATH       ( = repo.path      setting )
+# CGIT_REPO_OWNER      ( = repo.owner     setting )
+# CGIT_REPO_DEFBRANCH  ( = repo.defbranch setting )
+# CGIT_REPO_SECTION    ( = section        setting )
+# CGIT_REPO_CLONE_URL  ( = repo.clone-url setting )
+
+BASENAME="$1"
+EXTENSION="txt"
+
+[[ "${BASENAME}" != "${BASENAME##*.}" ]] \
+  && EXTENSION="${BASENAME##*.}"
+
+# Static mapping
+case "${BASENAME}" in
+  "Makefile"*) EXTENSION="mk" ;;
+esac
+
+if [[ "${0##*/}" == "about-filter" ]] ; then
+  case "${EXTENSION}" in
+    md)
+      # dev-python/markdown
+      export LC_ALL=en_US.UTF-8
+      exec markdown_py -q \
+        --safe escape \
+       2> /dev/null
+      ;;
+    rst)
+      # dev-python/docutils
+      exec rst2html.py -q \
+        --halt=5 \
+        --no-generator \
+        --pep-references --rfc-references \
+        --template "${0%/*}/templates/rst2html.tmpl" \
+        2> /dev/null
+      ;;
+    *)
+      # Make other source code handled by highlight with no formatting
+      HL_opt="--enclose-pre"
+      ;;
+  esac
+fi
+
+# app-text/highlight
+exec highlight -q \
+  --force --fragment \
+  --include-style \
+  --out-format xhtml \
+  --syntax "${EXTENSION}" \
+  ${HL_opt} \
+  2> /dev/null
diff --git a/filters/source-filter b/filters/source-filter
new file mode 120000
index 0000000..11f2be1
--- /dev/null
+++ b/filters/source-filter
@@ -0,0 +1 @@
+highlight
\ No newline at end of file
diff --git a/filters/templates/rst2html.tmpl b/filters/templates/rst2html.tmpl
new file mode 100644
index 0000000..43cde42
--- /dev/null
+++ b/filters/templates/rst2html.tmpl
@@ -0,0 +1,4 @@
+%(stylesheet)s
+%(body_pre_docinfo)s
+%(docinfo)s
+%(body)s
diff --git a/logo.png b/logo.png
new file mode 100644
index 0000000..e1cba40
Binary files /dev/null and b/logo.png differ
diff --git a/repos.txt b/repos.txt
new file mode 120000
index 0000000..3b913f9
--- /dev/null
+++ b/repos.txt
@@ -0,0 +1 @@
+/srv/gitolite/projects.list
\ No newline at end of file

-- 

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk

Reply via email to