@matheusbsbs / matheus-bagliano / commits / 18d05328f3
Fork 0

gitweb: Move static files into seperate subdirectory

Create a new subdirectory called 'static' in gitweb/, and move all static files required by gitweb.cgi when running, which means styles, images and Javascript code. This should make gitweb more readable and easier to maintain. Update t/gitweb-lib.sh to reflect this change.The install-gitweb now also include moving of static files into 'static' subdirectory in target directory: update Makefile, gitweb's INSTALL, README and Makefile accordingly. Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com> Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored-by: Petr Baudis <pasky@ucw.cz> Acked-by: Jakub Narebski <jnareb@gmail.com> Acked-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pavan Kumar Sunkara committed May 28, 2010 at 11:55 UTC 18d05328f3333e63bfffa65ac887ea16de60918c
9 files changed +50 -47
Makefile
+9 -9
@@ -1578,32 +1578,32 @@ gitweb:
1578 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
1579
1580 ifdef JSMIN
1581 -GITWEB_PROGRAMS += gitweb/gitweb.min.js
1582 -GITWEB_JS = gitweb/gitweb.min.js
1581 +GITWEB_PROGRAMS += gitweb/static/gitweb.min.js
1582 +GITWEB_JS = gitweb/static/gitweb.min.js
1583 else
1584 -GITWEB_JS = gitweb/gitweb.js
1584 +GITWEB_JS = gitweb/static/gitweb.js
1585 endif
1586 ifdef CSSMIN
1587 -GITWEB_PROGRAMS += gitweb/gitweb.min.css
1588 -GITWEB_CSS = gitweb/gitweb.min.css
1587 +GITWEB_PROGRAMS += gitweb/static/gitweb.min.css
1588 +GITWEB_CSS = gitweb/static/gitweb.min.css
1589 else
1590 -GITWEB_CSS = gitweb/gitweb.css
1590 +GITWEB_CSS = gitweb/static/gitweb.css
1591 endif
1592 OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_PROGRAMS)
1593 gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)
1594 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1595
1596 ifdef JSMIN
1597 -gitweb/gitweb.min.js: gitweb/gitweb.js
1597 +gitweb/static/gitweb.min.js: gitweb/static/gitweb.js
1598 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1599 endif # JSMIN
1600 ifdef CSSMIN
1601 -gitweb/gitweb.min.css: gitweb/gitweb.css
1601 +gitweb/static/gitweb.min.css: gitweb/static/gitweb.css
1602 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1603 endif # CSSMIN
1604
1605
1606 -git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js
1606 +git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js
1607 $(QUIET_GEN)$(RM) $@ $@+ && \
1608 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1609 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
gitweb/INSTALL
+9 -10
@@ -2,9 +2,10 @@ GIT web Interface (gitweb) Installation
2 =======================================
3
4 First you have to generate gitweb.cgi from gitweb.perl using
5 -"make gitweb", then copy appropriate files (gitweb.cgi, gitweb.js,
6 -gitweb.css, git-logo.png and git-favicon.png) to their destination.
7 -For example if git was (or is) installed with /usr prefix, you can do
5 +"make gitweb", then "make install-gitweb" appropriate files
6 +(gitweb.cgi, gitweb.js, gitweb.css, git-logo.png and git-favicon.png)
7 +to their destination. For example if git was (or is) installed with
8 +/usr prefix and gitwebdir is /var/www/cgi-bin, you can do
9
10 $ make prefix=/usr gitweb ;# as yourself
11 # make gitwebdir=/var/www/cgi-bin install-gitweb ;# as root
@@ -81,16 +82,14 @@ Build example
82 minifiers, you can do
83
84 make GITWEB_PROJECTROOT="/home/local/scm" \
84 - GITWEB_JS="/gitweb/gitweb.js" \
85 - GITWEB_CSS="/gitweb/gitweb.css" \
86 - GITWEB_LOGO="/gitweb/git-logo.png" \
87 - GITWEB_FAVICON="/gitweb/git-favicon.png" \
85 + GITWEB_JS="gitweb/static/gitweb.js" \
86 + GITWEB_CSS="gitweb/static/gitweb.css" \
87 + GITWEB_LOGO="gitweb/static/git-logo.png" \
88 + GITWEB_FAVICON="gitweb/static/git-favicon.png" \
89 bindir=/usr/local/bin \
90 gitweb
91
91 - cp -fv gitweb/gitweb.{cgi,js,css} \
92 - gitweb/git-{favicon,logo}.png \
93 - /var/www/cgi-bin/gitweb/
92 + make gitwebdir=/var/www/cgi-bin/gitweb install-gitweb
93
94
95 Gitweb config file
gitweb/Makefile
+21 -19
@@ -4,10 +4,10 @@ all::
4 # Define V=1 to have a more verbose compile.
5 #
6 # Define JSMIN to point to JavaScript minifier that functions as
7 -# a filter to have gitweb.js minified.
7 +# a filter to have static/gitweb.js minified.
8 #
9 # Define CSSMIN to point to a CSS minifier in order to generate a minified
10 -# version of gitweb.css
10 +# version of static/gitweb.css
11 #
12
13 prefix ?= $(HOME)
@@ -29,10 +29,10 @@ GITWEB_STRICT_EXPORT =
29 GITWEB_BASE_URL =
30 GITWEB_LIST =
31 GITWEB_HOMETEXT = indextext.html
32 -GITWEB_CSS = gitweb.css
33 -GITWEB_LOGO = git-logo.png
34 -GITWEB_FAVICON = git-favicon.png
35 -GITWEB_JS = gitweb.js
32 +GITWEB_CSS = static/gitweb.css
33 +GITWEB_LOGO = static/git-logo.png
34 +GITWEB_FAVICON = static/git-favicon.png
35 +GITWEB_JS = static/gitweb.js
36 GITWEB_SITE_HEADER =
37 GITWEB_SITE_FOOTER =
38
@@ -54,6 +54,7 @@ PERL_PATH ?= /usr/bin/perl
54 # Shell quote;
55 bindir_SQ = $(subst ','\'',$(bindir))#'
56 gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#'
57 +gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#'
58 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#'
59 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#'
60 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
@@ -88,26 +89,26 @@ all:: gitweb.cgi
89 GITWEB_PROGRAMS = gitweb.cgi
90
91 ifdef JSMIN
91 -GITWEB_FILES += gitweb.min.js
92 -GITWEB_JS = gitweb.min.js
93 -all:: gitweb.min.js
94 -gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS
92 +GITWEB_FILES += static/gitweb.min.js
93 +GITWEB_JS = static/gitweb.min.js
94 +all:: static/gitweb.min.js
95 +static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS
96 $(QUIET_GEN)$(JSMIN) <$< >$@
97 else
97 -GITWEB_FILES += gitweb.js
98 +GITWEB_FILES += static/gitweb.js
99 endif
100
101 ifdef CSSMIN
101 -GITWEB_FILES += gitweb.min.css
102 -GITWEB_CSS = gitweb.min.css
103 -all:: gitweb.min.css
104 -gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS
102 +GITWEB_FILES += static/gitweb.min.css
103 +GITWEB_CSS = static/gitweb.min.css
104 +all:: static/gitweb.min.css
105 +static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS
106 $(QUIET_GEN)$(CSSMIN) <$ >$@
107 else
107 -GITWEB_FILES += gitweb.css
108 +GITWEB_FILES += static/gitweb.css
109 endif
110
110 -GITWEB_FILES += git-logo.png git-favicon.png
111 +GITWEB_FILES += static/git-logo.png static/git-favicon.png
112
113 GITWEB_REPLACE = \
114 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
@@ -147,12 +148,13 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
148 install: all
149 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'
150 $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
150 - $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
151 + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
152 + $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
153
154 ### Cleaning rules
155
156 clean:
155 - $(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS
157 + $(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS
158
159 .PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE
160
gitweb/README
+8 -6
@@ -80,24 +80,26 @@ You can specify the following configuration variables when building GIT:
80 Points to the location where you put gitweb.css on your web server
81 (or to be more generic, the URI of gitweb stylesheet). Relative to the
82 base URI of gitweb. Note that you can setup multiple stylesheets from
83 - the gitweb config file. [Default: gitweb.css (or gitweb.min.css if the
84 - CSSMIN variable is defined / CSS minifier is used)]
83 + the gitweb config file. [Default: static/gitweb.css (or
84 + static/gitweb.min.css if the CSSMIN variable is defined / CSS minifier
85 + is used)]
86 * GITWEB_LOGO
87 Points to the location where you put git-logo.png on your web server
88 (or to be more generic URI of logo, 72x27 size, displayed in top right
89 corner of each gitweb page, and used as logo for Atom feed). Relative
89 - to base URI of gitweb. [Default: git-logo.png]
90 + to base URI of gitweb. [Default: static/git-logo.png]
91 * GITWEB_FAVICON
92 Points to the location where you put git-favicon.png on your web server
93 (or to be more generic URI of favicon, assumed to be image/png type;
94 web browsers that support favicons (website icons) may display them
95 in the browser's URL bar and next to site name in bookmarks). Relative
95 - to base URI of gitweb. [Default: git-favicon.png]
96 + to base URI of gitweb. [Default: static/git-favicon.png]
97 * GITWEB_JS
98 Points to the localtion where you put gitweb.js on your web server
99 (or to be more generic URI of JavaScript code used by gitweb).
99 - Relative to base URI of gitweb. [Default: gitweb.js (or gitweb.min.js
100 - if JSMIN build variable is defined / JavaScript minifier is used)]
100 + Relative to base URI of gitweb. [Default: static/gitweb.js (or
101 + static/gitweb.min.js if JSMIN build variable is defined / JavaScript
102 + minifier is used)]
103 * GITWEB_CONFIG
104 This Perl file will be loaded using 'do' and can be used to override any
105 of the options above as well as some other options -- see the "Runtime
gitweb/static/git-favicon.png renamed
gitweb/static/git-logo.png renamed
gitweb/static/gitweb.css renamed
gitweb/static/gitweb.js renamed
t/gitweb-lib.sh
+3 -3
@@ -19,9 +19,9 @@ our \$site_name = '[localhost]';
19 our \$site_header = '';
20 our \$site_footer = '';
21 our \$home_text = 'indextext.html';
22 -our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/gitweb.css');
23 -our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/git-logo.png';
24 -our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/git-favicon.png';
22 +our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/static/gitweb.css');
23 +our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/static/git-logo.png';
24 +our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/static/git-favicon.png';
25 our \$projects_list = '';
26 our \$export_ok = '';
27 our \$strict_export = '';