{"thread":{"id":"23898","subject":"[PATCHv6 GSoC] gitweb: Move static files into seperate subdirectory","startedAt":"2010-05-25T09:24:28Z","lastAt":"2010-05-25T09:24:28Z","messageCount":1,"participants":["Pavan Kumar Sunkara"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"142268","messageId":"1274779468-13975-1-git-send-email-pavan.sss1991@gmail.com","threadId":"23898","inReplyTo":null,"subject":"[PATCHv6 GSoC] gitweb: Move static files into seperate subdirectory","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-05-25T09:24:28Z","receivedAt":"2010-05-25T09:24:28Z","isPatch":false,"sender":{"key":"pavan.sss1991@gmail.com","avatar":"https://avatars.githubusercontent.com/u/174703?v=4"},"body":"Create a new subdirectory called 'static' in gitweb/, and move\nall static files required by gitweb.cgi when running, which means\nstyles, images and Javascript code. This should make gitweb more\nreadable and easier to maintain.\n\nUpdate t/gitweb-lib.sh to reflect this change.The install-gitweb\nnow also include moving of static files into 'static' subdirectory\nin target directory: update Makefile, gitweb's INSTALL, README and\nMakefile accordingly.\n\nSigned-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>\n---\n\nThere is a bug in git which doesn't show pure 100% rename of\nbinary files in patches. This led the previous patch to move\nonly the js and css files into static dir leaving the image files\nin the main gitweb/ directory.\n\nNow I manually added the lines in the diff to move the image files too.\n\n Makefile                            |   22 +++++++++---------\n gitweb/INSTALL                      |   19 +++++++--------\n gitweb/Makefile                     |   40 ++++++++++++++++++----------------\n gitweb/README                       |   14 +++++++-----\n gitweb/{ => static}/git-favicon.png |  Bin 115 -> 115 bytes\n gitweb/{ => static}/git-logo.png    |  Bin 207 -> 207 bytes\n gitweb/{ => static}/gitweb.css      |    0\n gitweb/{ => static}/gitweb.js       |    0\n t/gitweb-lib.sh                     |    6 ++--\n 9 files changed, 52 insertions(+), 49 deletions(-)\n rename gitweb/{ => static}/git-favicon.png (100%)\n rename gitweb/{ => static}/git-logo.png (100%)\n rename gitweb/{ => static}/gitweb.css (100%)\n rename gitweb/{ => static}/gitweb.js (100%)\n\ndiff --git a/Makefile b/Makefile\nindex 6eb6289..de7f680 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1561,32 +1561,32 @@ gitweb:\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all\n \n ifdef JSMIN\n-GITWEB_PROGRAMS += gitweb/gitweb.min.js\n-GITWEB_JS = gitweb/gitweb.min.js\n+GITWEB_PROGRAMS += gitweb/static/gitweb.min.js\n+GITWEB_JS = gitweb/static/gitweb.min.js\n else\n-GITWEB_JS = gitweb/gitweb.js\n+GITWEB_JS = gitweb/static/gitweb.js\n endif\n ifdef CSSMIN\n-GITWEB_PROGRAMS += gitweb/gitweb.min.css\n-GITWEB_CSS = gitweb/gitweb.min.css\n+GITWEB_PROGRAMS += gitweb/static/gitweb.min.css\n+GITWEB_CSS = gitweb/static/gitweb.min.css\n else\n-GITWEB_CSS = gitweb/gitweb.css\n+GITWEB_CSS = gitweb/static/gitweb.css\n endif\n OTHER_PROGRAMS +=  gitweb/gitweb.cgi  $(GITWEB_PROGRAMS)\n gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n \n ifdef JSMIN\n-gitweb/gitweb.min.js: gitweb/gitweb.js\n+gitweb/static/gitweb.min.js: gitweb/static/gitweb.js\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n endif # JSMIN\n ifdef CSSMIN\n-gitweb/gitweb.min.css: gitweb/gitweb.css\n+gitweb/static/gitweb.min.css: gitweb/static/gitweb.css\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n endif # CSSMIN\n \n \n-git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js\n+git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n \tsed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n \t    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \\\ndiff --git a/gitweb/INSTALL b/gitweb/INSTALL\nindex d484d76..8230531 100644\n--- a/gitweb/INSTALL\n+++ b/gitweb/INSTALL\n@@ -2,9 +2,10 @@ GIT web Interface (gitweb) Installation\n =======================================\n \n First you have to generate gitweb.cgi from gitweb.perl using\n-\"make gitweb\", then copy appropriate files (gitweb.cgi, gitweb.js,\n-gitweb.css, git-logo.png and git-favicon.png) to their destination.\n-For example if git was (or is) installed with /usr prefix, you can do\n+\"make gitweb\", then \"make install-gitweb\" appropriate files\n+(gitweb.cgi, gitweb.js, gitweb.css, git-logo.png and git-favicon.png)\n+to their destination. For example if git was (or is) installed with\n+/usr prefix and gitwebdir is /var/www/cgi-bin, you can do\n \n \t$ make prefix=/usr gitweb                            ;# as yourself\n \t# make gitwebdir=/var/www/cgi-bin install-gitweb     ;# as root\n@@ -81,16 +82,14 @@ Build example\n   minifiers, you can do\n \n \tmake GITWEB_PROJECTROOT=\"/home/local/scm\" \\\n-\t     GITWEB_JS=\"/gitweb/gitweb.js\" \\\n-\t     GITWEB_CSS=\"/gitweb/gitweb.css\" \\\n-\t     GITWEB_LOGO=\"/gitweb/git-logo.png\" \\\n-\t     GITWEB_FAVICON=\"/gitweb/git-favicon.png\" \\\n+\t     GITWEB_JS=\"gitweb/static/gitweb.js\" \\\n+\t     GITWEB_CSS=\"gitweb/static/gitweb.css\" \\\n+\t     GITWEB_LOGO=\"gitweb/static/git-logo.png\" \\\n+\t     GITWEB_FAVICON=\"gitweb/static/git-favicon.png\" \\\n \t     bindir=/usr/local/bin \\\n \t     gitweb\n \n-\tcp -fv gitweb/gitweb.{cgi,js,css} \\\n-\t       gitweb/git-{favicon,logo}.png \\\n-\t     /var/www/cgi-bin/gitweb/\n+\tmake gitwebdir=/var/www/cgi-bin/gitweb install-gitweb\n \n \n Gitweb config file\ndiff --git a/gitweb/Makefile b/gitweb/Makefile\nindex 935d2d2..d2584fe 100644\n--- a/gitweb/Makefile\n+++ b/gitweb/Makefile\n@@ -4,10 +4,10 @@ all::\n # Define V=1 to have a more verbose compile.\n #\n # Define JSMIN to point to JavaScript minifier that functions as\n-# a filter to have gitweb.js minified.\n+# a filter to have static/gitweb.js minified.\n #\n # Define CSSMIN to point to a CSS minifier in order to generate a minified\n-# version of gitweb.css\n+# version of static/gitweb.css\n #\n \n prefix ?= $(HOME)\n@@ -29,10 +29,10 @@ GITWEB_STRICT_EXPORT =\n GITWEB_BASE_URL =\n GITWEB_LIST =\n GITWEB_HOMETEXT = indextext.html\n-GITWEB_CSS = gitweb.css\n-GITWEB_LOGO = git-logo.png\n-GITWEB_FAVICON = git-favicon.png\n-GITWEB_JS = gitweb.js\n+GITWEB_CSS = static/gitweb.css\n+GITWEB_LOGO = static/git-logo.png\n+GITWEB_FAVICON = static/git-favicon.png\n+GITWEB_JS = static/gitweb.js\n GITWEB_SITE_HEADER =\n GITWEB_SITE_FOOTER =\n \n@@ -54,6 +54,7 @@ PERL_PATH  ?= /usr/bin/perl\n # Shell quote;\n bindir_SQ = $(subst ','\\'',$(bindir))#'\n gitwebdir_SQ = $(subst ','\\'',$(gitwebdir))#'\n+gitwebstaticdir_SQ = $(subst ','\\'',$(gitwebdir)/static)#'\n SHELL_PATH_SQ = $(subst ','\\'',$(SHELL_PATH))#'\n PERL_PATH_SQ  = $(subst ','\\'',$(PERL_PATH))#'\n DESTDIR_SQ    = $(subst ','\\'',$(DESTDIR))#'\n@@ -88,26 +89,26 @@ all:: gitweb.cgi\n GITWEB_PROGRAMS = gitweb.cgi\n \n ifdef JSMIN\n-GITWEB_FILES += gitweb.min.js\n-GITWEB_JS = gitweb.min.js\n-all:: gitweb.min.js\n-gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS\n+GITWEB_FILES += static/gitweb.min.js\n+GITWEB_JS = static/gitweb.min.js\n+all:: static/gitweb.min.js\n+static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS\n \t$(QUIET_GEN)$(JSMIN) <$< >$@\n else\n-GITWEB_FILES += gitweb.js\n+GITWEB_FILES += static/gitweb.js\n endif\n \n ifdef CSSMIN\n-GITWEB_FILES += gitweb.min.css\n-GITWEB_CSS = gitweb.min.css\n-all:: gitweb.min.css\n-gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS\n+GITWEB_FILES += static/gitweb.min.css\n+GITWEB_CSS = static/gitweb.min.css\n+all:: static/gitweb.min.css\n+static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS\n \t$(QUIET_GEN)$(CSSMIN) <$ >$@\n else\n-GITWEB_FILES += gitweb.css\n+GITWEB_FILES += static/gitweb.css\n endif\n \n-GITWEB_FILES += git-logo.png git-favicon.png\n+GITWEB_FILES += static/git-logo.png static/git-favicon.png\n \n GITWEB_REPLACE = \\\n \t-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n@@ -147,12 +148,13 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS\n install: all\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n \t$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n-\t$(INSTALL) -m 644 $(GITWEB_FILES)    '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'\n+\t$(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'\n \n ### Cleaning rules\n \n clean:\n-\t$(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS\n+\t$(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS\n \n .PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE\n \ndiff --git a/gitweb/README b/gitweb/README\nindex 71742b3..0e19be8 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -80,24 +80,26 @@ You can specify the following configuration variables when building GIT:\n    Points to the location where you put gitweb.css on your web server\n    (or to be more generic, the URI of gitweb stylesheet).  Relative to the\n    base URI of gitweb.  Note that you can setup multiple stylesheets from\n-   the gitweb config file.  [Default: gitweb.css (or gitweb.min.css if the\n-   CSSMIN variable is defined / CSS minifier is used)]\n+   the gitweb config file.  [Default: static/gitweb.css (or\n+   static/gitweb.min.css if the CSSMIN variable is defined / CSS minifier\n+   is used)]\n  * GITWEB_LOGO\n    Points to the location where you put git-logo.png on your web server\n    (or to be more generic URI of logo, 72x27 size, displayed in top right\n    corner of each gitweb page, and used as logo for Atom feed).  Relative\n-   to base URI of gitweb.  [Default: git-logo.png]\n+   to base URI of gitweb.  [Default: static/git-logo.png]\n  * GITWEB_FAVICON\n    Points to the location where you put git-favicon.png on your web server\n    (or to be more generic URI of favicon, assumed to be image/png type;\n    web browsers that support favicons (website icons) may display them\n    in the browser's URL bar and next to site name in bookmarks).  Relative\n-   to base URI of gitweb.  [Default: git-favicon.png]\n+   to base URI of gitweb.  [Default: static/git-favicon.png]\n  * GITWEB_JS\n    Points to the localtion where you put gitweb.js on your web server\n    (or to be more generic URI of JavaScript code used by gitweb).\n-   Relative to base URI of gitweb.  [Default: gitweb.js (or gitweb.min.js\n-   if JSMIN build variable is defined / JavaScript minifier is used)]\n+   Relative to base URI of gitweb.  [Default: static/gitweb.js (or\n+   static/gitweb.min.js if JSMIN build variable is defined / JavaScript\n+   minifier is used)]\n  * GITWEB_CONFIG\n    This Perl file will be loaded using 'do' and can be used to override any\n    of the options above as well as some other options -- see the \"Runtime\ndiff --git a/gitweb/gitweb.css b/gitweb/static/gitweb.css\nsimilarity index 100%\nrename from gitweb/gitweb.css\nrename to gitweb/static/gitweb.css\ndiff --git a/gitweb/gitweb.js b/gitweb/static/gitweb.js\nsimilarity index 100%\nrename from gitweb/gitweb.js\nrename to gitweb/static/gitweb.js\ndiff --git a/gitweb/git-logo.png b/gitweb/static/git-logo.png\nsimilarity index 100%\nrename from gitweb/git-logo.png\nrename to gitweb/static/git-logo.png\ndiff --git a/gitweb/git-favicon.png b/gitweb/static/git-favicon.png\nsimilarity index 100%\nrename from gitweb/git-favicon.png\nrename to gitweb/static/git-favicon.png\ndiff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh\nindex 5a734b1..b70b891 100644\n--- a/t/gitweb-lib.sh\n+++ b/t/gitweb-lib.sh\n@@ -19,9 +19,9 @@ our \\$site_name = '[localhost]';\n our \\$site_header = '';\n our \\$site_footer = '';\n our \\$home_text = 'indextext.html';\n-our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/gitweb.css');\n-our \\$logo = 'file:///$TEST_DIRECTORY/../gitweb/git-logo.png';\n-our \\$favicon = 'file:///$TEST_DIRECTORY/../gitweb/git-favicon.png';\n+our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/static/gitweb.css');\n+our \\$logo = 'file:///$TEST_DIRECTORY/../gitweb/static/git-logo.png';\n+our \\$favicon = 'file:///$TEST_DIRECTORY/../gitweb/static/git-favicon.png';\n our \\$projects_list = '';\n our \\$export_ok = '';\n our \\$strict_export = '';\n-- \n1.7.1.18.g74211d.dirty\n"}]}