View source with raw comments or as raw
    1/*  Part of ClioPatria
    2
    3    Author:        Jan Wielemaker
    4    E-mail:        J.Wielemaker@vu.nl
    5    WWW:           http://www.swi-prolog.org
    6    Copyright (c)  2010-2011 University of Amsterdam
    7		             CWI, Asterdam
    8		             VU University Amsterdam
    9    All rights reserved.
   10
   11    Redistribution and use in source and binary forms, with or without
   12    modification, are permitted provided that the following conditions
   13    are met:
   14
   15    1. Redistributions of source code must retain the above copyright
   16       notice, this list of conditions and the following disclaimer.
   17
   18    2. Redistributions in binary form must reproduce the above copyright
   19       notice, this list of conditions and the following disclaimer in
   20       the documentation and/or other materials provided with the
   21       distribution.
   22
   23    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   24    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   25    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   26    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   27    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   28    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   29    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   30    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   31    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   32    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   33    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   34    POSSIBILITY OF SUCH DAMAGE.
   35*/
   36
   37:- module(cpa_version_help,
   38	  [
   39	  ]).   40:- use_module(library(http/html_write)).   41:- use_module(library(http/http_dispatch)).   42:- use_module(library(version)).   43:- use_module(library(occurs)).   44:- use_module(library(sgml)).   45:- use_module(library(lists)).   46:- use_module(components(basics)).

Provide detailed version information

*/

   51:- http_handler(root(help/versions), version_info, []).
 version_info(+Request)
HTTP handler that provides detailed information on the loaded (and registered) GIT modules.
   58version_info(_Request) :-
   59	reply_html_page(cliopatria(default),
   60			[ title('Version details') ],
   61			[ h4('GIT modules'),
   62			  \git_modules,
   63			  h4('Server implementation language'),
   64			  p(\prolog_version),
   65			  div(class(textbox), \about_git_versions)
   66			]).
 git_modules//
Component that creates a table of registered GIT modules.
See also
- register_git_module/2
   74git_modules -->
   75	{ findall(C-V, git_module_property(C, version(V)), Pairs) },
   76	html(table(class(block),
   77		   [ tr([ th('GIT module'), th('Version'), th('Directory') ]),
   78		     \git_modules(Pairs)
   79		   ])).
   80
   81git_modules([]) --> [].
   82git_modules([H|T]) -->
   83	git_module(H),
   84	git_modules(T).
   85
   86git_module(Name-Version) -->
   87	{ git_module_property(Name, directory(Dir)) -> true },
   88	html(tr([td(\home_link(Name)), td(Version), td(Dir)])).
   89
   90home_link(Component) -->
   91	{ git_module_property(Component, home_url(Home)) }, !,
   92	html(a(href(Home), Component)).
   93home_link(Component) -->
   94	html(Component).
 prolog_version//
Component that emits the current version of SWI-Prolog
  101prolog_version -->
  102	{ current_prolog_flag(version_data, swi(Major, Minor, Patch, _)),
  103	  atomic_list_concat([Major, Minor, Patch], '.', Version)
  104	},
  105	html([ a(href('http://www.swi-prolog.org'), 'SWI-Prolog'), ' ',
  106	       'version ', b(Version)
  107	     ]),
  108	(   { current_prolog_flag(version_git, GitVersion),
  109	      GitVersion \== Version
  110	    }
  111	->  html([' (GIT version ', b(GitVersion), ')'])
  112	;   []
  113	).
 about_git_versions//
Component that emits the both of the file html('git-versions.html'), explaining the background behind git stamped versions.
  122about_git_versions -->
  123	insert_html_file(html('git-versions.html'))