git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb.cgi: Customization
@ 2006-08-01 21:19 Luben Tuikov
  2006-08-01 22:15 ` Junio C Hamano
  0 siblings, 1 reply; 22+ messages in thread
From: Luben Tuikov @ 2006-08-01 21:19 UTC (permalink / raw)
  To: git

The file "Gitweb_customization.pm" now holds customizable
variables used by "gitweb.cgi".  It is read by "gitweb.cgi"
from @INC, which includes ".", at compile time.

Copy "Gitweb_customization.pm" to where your "gitweb.cgi" or
its link lives.  The values therein are default values,
please change them as per your setup.  From then on, you
only need to update (copy) "gitweb.cgi" in order to upgrade
it, without editing or patching "gitweb.cgi" itself.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/Gitweb_customization.pm |   43 ++++++++++++++++++++++++++++++++++++++++
 gitweb/gitweb.cgi              |   31 +----------------------------
 2 files changed, 44 insertions(+), 30 deletions(-)

diff --git a/gitweb/Gitweb_customization.pm b/gitweb/Gitweb_customization.pm
new file mode 100644
index 0000000..8bfa19a
--- /dev/null
+++ b/gitweb/Gitweb_customization.pm
@@ -0,0 +1,43 @@
+package    Gitweb_customization;
+require    Exporter;
+
+our @ISA = qw(Exporter);
+our @EXPORT = qw($GIT $projectroot $projects_list $home_text $site_name
+		 $stylesheet $default_blob_plain_mimetype
+		 $default_text_plain_charset $mimetypes_file);
+
+# core git executable to use
+# this can just be "git" if your webserver has a sensible PATH
+our $GIT = "/usr/bin/git";
+
+# absolute fs-path which will be prepended to the project path
+our $projectroot = "/pub/git";
+
+# source of projects list
+# Directory format:
+#our $projects_list = $projectroot;
+# File (shown below) each line in the file is:
+#        [directory.git]<space>[owner.name]
+# (ignore leading whitespace and perl comment char),
+#   where [owner.name] is a sequence of chars with '+' for a space.
+our $projects_list = "index/index.aux";
+
+# html text to include at home page
+our $home_text = "indextext.html";
+
+# name of your site or organization to appear in page titles
+# replace this with something more descriptive for clearer bookmarks
+our $site_name = $ENV{'SERVER_NAME'} || "Untitled";
+
+# URI of default stylesheet
+our $stylesheet = "gitweb.css";
+
+# default blob_plain mimetype and default charset for text/plain blob
+our $default_blob_plain_mimetype = 'text/plain';
+our $default_text_plain_charset  = undef;
+
+# file to use for guessing MIME types before trying /etc/mime.types
+# (relative to the current git repository)
+our $mimetypes_file = undef;
+
+1;
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 9448b72..5251fac 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -15,6 +15,7 @@ use CGI::Carp qw(fatalsToBrowser);
 use Encode;
 use Fcntl ':mode';
 use File::Find qw();
+use Gitweb_customization;
 binmode STDOUT, ':utf8';
 
 our $cgi = new CGI;
@@ -23,14 +24,6 @@ our $my_url = $cgi->url();
 our $my_uri = $cgi->url(-absolute => 1);
 our $rss_link = "";
 
-# core git executable to use
-# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "/usr/bin/git";
-
-# absolute fs-path which will be prepended to the project path
-#our $projectroot = "/pub/scm";
-our $projectroot = "/home/kay/public_html/pub/scm";
-
 # version of the core git binary
 our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
 
@@ -43,28 +36,6 @@ if (! -d $git_temp) {
 # target of the home link on top of all pages
 our $home_link = $my_uri;
 
-# name of your site or organization to appear in page titles
-# replace this with something more descriptive for clearer bookmarks
-our $site_name = $ENV{'SERVER_NAME'} || "Untitled";
-
-# html text to include at home page
-our $home_text = "indextext.html";
-
-# URI of default stylesheet
-our $stylesheet = "gitweb.css";
-
-# source of projects list
-#our $projects_list = $projectroot;
-our $projects_list = "index/index.aux";
-
-# default blob_plain mimetype and default charset for text/plain blob
-our $default_blob_plain_mimetype = 'text/plain';
-our $default_text_plain_charset  = undef;
-
-# file to use for guessing MIME types before trying /etc/mime.types
-# (relative to the current git repository)
-our $mimetypes_file = undef;
-
 # input validation and dispatch
 our $action = $cgi->param('a');
 if (defined $action) {
-- 
1.4.2.rc2.gd2da4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2006-08-03 16:24 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-01 21:19 [PATCH] gitweb.cgi: Customization Luben Tuikov
2006-08-01 22:15 ` Junio C Hamano
2006-08-01 22:53   ` Luben Tuikov
2006-08-01 23:54     ` Junio C Hamano
2006-08-02  2:01       ` Luben Tuikov
2006-08-02  2:13       ` Martin Langhoff
2006-08-02  7:45         ` Junio C Hamano
2006-08-02  7:59           ` Martin Langhoff
2006-08-02 15:53             ` Matthias Lederhofer
2006-08-03  6:58         ` Martin Waitz
2006-08-03 16:24           ` Jeff King
2006-08-02  7:09       ` Matthias Lederhofer
2006-08-02  8:54         ` Matthias Lederhofer
2006-08-02  9:31           ` Martin Langhoff
2006-08-02 12:55             ` Matthias Lederhofer
2006-08-02 16:23       ` Jon Loeliger
2006-08-02 16:53         ` Jeff King
2006-08-02 17:13           ` Matthias Lederhofer
2006-08-02 17:34           ` Jakub Narebski
2006-08-02 17:43           ` Junio C Hamano
2006-08-02 20:30         ` Luben Tuikov
2006-08-02 19:40       ` Matthias Lederhofer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).