commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5265 - trunk/www/utils


From: jcater
Subject: r5265 - trunk/www/utils
Date: Mon, 8 Mar 2004 11:36:47 -0600 (CST)

Author: jcater
Date: 2004-03-08 11:36:46 -0600 (Mon, 08 Mar 2004)
New Revision: 5265

Added:
   trunk/www/utils/create-website
Log:
Added missing file

Added: trunk/www/utils/create-website
===================================================================
--- trunk/www/utils/create-website      2004-03-08 17:12:58 UTC (rev 5264)
+++ trunk/www/utils/create-website      2004-03-08 17:36:46 UTC (rev 5265)
@@ -0,0 +1,233 @@
+#!/usr/bin/python
+
+############################################################
+# This should contain a list of all tools to publish
+ALL_TOOLS = [ 'forms','reports','appserver','navigator',
+              'designer','integrator', 'common' ]
+############################################################
+
+import sys, os, string
+
+from helpers.files import SVN_BASE, addToolLinks
+from helpers.tools import Tool
+
+
+def run():
+  ######
+  if not '--update' in sys.argv:
+    print """
+  WARNING: This script is meant to be run on ash.gnuenteprise.org.
+          If you are a developer running this from svn, you are likely
+          running the wrong script.
+
+  If you really do want to run this script, run:
+    %s --update [--dest <path>]
+
+  Be warned! It will try to update your /var/www/ unless you run
+  it with the --dest option.
+  """ % (sys.argv[0])
+
+    sys.exit(1)
+  ######
+
+  global DEST
+  try:
+    DEST=sys.argv[sys.argv.index('--dest')+1]
+  except ValueError:
+    DEST = "/var/www"
+
+  print "Writing to %s" % DEST
+
+  #
+  # Create the destination directories if they don't exist
+  os.system("mkdir -p %s" % DEST)
+
+  #
+  # Copy the static files into place, removing any .svn cruft
+  os.system('cp -R %s/www/web/* %s/ >/dev/null 2>&1' % (SVN_BASE, DEST))
+  os.system('find %s/ -name ".svn*" -exec rm -rf "{}" \\; >/dev/null 2>&1' % 
(DEST))
+
+  # Create the _module_menu.php for the tools/ section
+  #
+  moduleMenuHtml = """<h3><a href="<?php print "$BASEDIR"; 
?>/tools/">Developer Tools</a></h3>\n<ul>\n"""
+
+  # This will hold tools/index.php
+  toolHomePageHtml = ""
+
+  #
+  # Load all the tools and their information
+  #
+  tools = {}
+  toolUrlHints = {}
+  for tool in ALL_TOOLS:
+    tools[tool] = mod = Tool(tool)
+    name = mod.name
+    package = mod.package
+
+    os.system("mkdir -p %s/tools/%s" % (DEST, tool))
+    os.system("mkdir -p %s/tools/%s/docs" % (DEST, tool))
+    os.system("mkdir -p %s/tools/%s" % (DEST, tool))
+
+    toolUrlHints[name] = tool
+    if name != package.replace('-',' '):
+      toolUrlHints[package.replace('-',' ')] = tool
+
+
+
+  #
+  # Create docs for each tool
+  #
+  for tool in ALL_TOOLS:
+    mod = tools[tool]
+    name = mod.name
+    package = mod.package
+
+    dfmt = '%B %d, %Y'
+    currentRelease = mod.releases.getCurrentRelease()
+    if currentRelease:
+      currentReleaseDate = mod.releases.getReleaseDate(currentRelease, dfmt)
+
+    # Handle each release:
+    for release in mod.releases.releaseOrder:
+      os.system("mkdir -p %s/tools/%s/%s" % (DEST, tool, release))
+      html = '<h1>%s %s</h1>' % (package, release) + \
+                '<p><a href="..">%s</a> %s was released on %s.</p>\n\n' % 
(name, release, mod.releases.getReleaseDate(release,dfmt))
+
+      if release != currentRelease:
+        html += '<p class="warn"><b>Please note:</b> This is an old version of 
<i>%s</i>. The latest version is <a href="../%s/">%s</a>, released on 
%s.</p>\n\n' % (name, currentRelease, currentRelease, currentReleaseDate)
+
+      html +=  '<h2>Downloads</h2>\n' + \
+                """<p>%s version %s can be downloaded in source form from:</p>
+                      <ul><li><a 
href="http://www.gnuenterprise.org/downloads/releases/%s-%s.tar.gz";>%s-%s.tar.gz</a></li>
+                      <li><a 
href="http://www.gnuenterprise.org/downloads/releases/%s-%s.zip";>%s-%s.zip</a></li></ul>"""
 % (
+                              name, release,
+                              package, release,
+                              package, release,
+                              package, release,
+                              package, release) + \
+                '<h2>Changes</h2>\n<p>The following improvements appeared in 
this release:</p>\n' + \
+                mod.releases.asHTML(release) + \
+                '<!-- <p>To see a complete change list for all releases, click 
<a href="../docs/changes.php">here.</p> -->'
+
+      phpWrapper('tools/%s/%s/index.php' % (tool, release), html)
+
+    #
+    # Add tool to module menu
+    #
+    moduleMenuHtml += """<li><a href="<?php print "$BASEDIR"; ?>/tools/%s/" 
>%s</a></li>\n""" % (tool, name.replace('GNUe ',''))
+
+    #
+    # Add tool to tool/ homepage
+    #
+    descr = mod.readme.firstParaAsHTML('INTRODUCTION')
+    descr = descr.replace(name,'<a href="%s/">%s</a>' % (tool, name))
+    toolHomePageHtml += ('<h2><a href="%s/">' % tool) + name.replace('GNUe 
','') + '</a></h2>\n' + descr
+
+    #
+    # Create tool's homepage
+    #
+    img = os.path.join(DEST,'tools',tool,'product.png')
+    if os.path.isfile(img):
+      html = """<img style="  float: right; margin: 6px 6px 10px 10px; border: 
1px solid #666;" alt="" src="product.png"/>\n"""
+    else:
+      html = ""
+
+    html += "<h1>%s</h1>\n" % (name)
+
+    html += 
addToolLinks(mod.readme.asHTML('Introduction'),toolUrlHints,'..',tool)
+    html += '<h2>Documentation</h2>\n'
+    #TODO
+    html += '<ul><li><a href="docs/faq.php">Frequently Asked 
Questions</a></li></ul>\n'
+
+    html +=  '<h2>Release History</h2>\n'
+
+    if mod.releases.releaseOrder:
+      html += '<ul>\n'
+      for ver in mod.releases.releaseOrder[:6]:
+        html += """<li>Version <a href="%s/">%s</a> released on %s</li>\n""" % 
(
+                 ver, ver, mod.releases.getReleaseDate(ver, "%B %d, %Y"))
+    else:
+      html += '<p>This tool has no official releases.</p>'
+
+    # Create the historical release index if needed
+    if len(mod.releases.releaseOrder) > 6:
+      html += """<li><a href="old_releases.php">Older releases...</a></li>\n"""
+
+      html2 = '<h1>%s Release History</h1>\n' % name
+      html2 += "<p>This page lists all releases for this tool. Note that some 
older source files may not be available for download.</p><ul>\n"
+      for ver2 in mod.releases.releaseOrder:
+        html2 += """<li>Version <a href="%s/">%s</a> released on %s</li>\n""" 
% (
+                 ver2, ver2, mod.releases.getReleaseDate(ver2, "%B %d, %Y"))
+      phpWrapper('tools/%s/old_releases.php' % tool, html2 + "</ul>")
+
+    if mod.releases.releaseOrder:
+      html += '</ul>\n'
+
+    phpWrapper('tools/%s/index.php' % tool, html + "</ul>")
+
+    ##
+    # Write out tool's FAQ
+    #
+
+    html = '<h1><a href="../..">%s</a> FAQ</h1>\n' % name
+    if tool != "common":
+      html += """<p>If your question isn't answered here, you may wish to 
refer to GNUe Common's <a href="../../common/docs/faq.php">FAQ</a> or the main 
project <a href="../../../docs/faq.php">FAQ</a></p>"""
+
+    if not mod.faq.sectionOrder:
+      html  += "<p>There are no entries in this faq.</p>"
+    else:
+      for section in mod.faq.sectionOrder:
+        html += "<h2>%s</h2>" % section
+        html += mod.faq.asHTML(section)
+
+    phpWrapper('tools/%s/docs/faq.php' % tool, html)
+
+  ##
+  # Write out tools/_module_menu.php
+  #
+  staticFile('tools/_module_menu.php', moduleMenuHtml)
+
+  ##
+  # Write out tool/ home page
+  #
+  phpWrapper('tools/index.php', """
+    <h1>GNUe's Developer Tools</h1>
+
+      <p>GNUe Tools form the backbone of the GNUe project. These
+       platform-independent, fully data-aware applications give you easy, yet
+       powerful, access to your business data. GNUe works with most popular
+       databases, such as the free PostgreSQL, MySQL, Firebird, and SQLite
+       databases, as well as the commercial Oracle, DB2, Sybase,etc,
+       databases.</p>
+       """ + toolHomePageHtml  )
+
+######################################################################
+#
+#
+def phpWrapper(file, html):
+  out = open(os.path.join(DEST, file),'w')
+  path = file.split('/')
+
+  out.write("""\
+<?php $BASEDIR="%s";
+      $MODULE="%s";
+      include ("$BASEDIR/shared/_header.php"); ?>
+
+<div id="body">
+""" % (string.join([".."]*(len(path)-1),'/'), path[0]))
+
+  out.write(html)
+  out.write("""
+</div>
+
+<?php include "$BASEDIR/shared/_footer.php"; ?>
+""")
+  out.close()
+
+def staticFile(file, html):
+  out = open(os.path.join(DEST, file),'w')
+  out.write(html)
+  out.close()
+
+if __name__ == '__main__':
+  run()
\ No newline at end of file


Property changes on: trunk/www/utils/create-website
___________________________________________________________________
Name: svn:executable
   + *





reply via email to

[Prev in Thread] Current Thread [Next in Thread]