From: Dan Vanderkam <danvdk@gmail.com> Date: Mon, 12 Aug 2013 03:21:00 +0000 (-0400) Subject: preliminary generate-download.py script X-Git-Tag: v1.0.0~8 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=eb35c2f316f7d878b0ad7433b52cc4583894af07;p=dygraphs.git preliminary generate-download.py script --- diff --git a/docs/download.html b/docs/download.html index 66a7e7f..3f5ccef 100644 --- a/docs/download.html +++ b/docs/download.html @@ -1,11 +1,35 @@ + <!--#include virtual="header.html" --> +<!-- + DO NOT EDIT THIS FILE! + + This file is generated by generate-download.py. +--> + <script src="modernizr.custom.18445.js"></script> -<div class="container" id="main"> - <p>Most users will want the minified JavaScript:</p> - <h3><a download="dygraph-combined.js" href="dygraph-combined.js">dygraph-combined.js</a></h3> - <br/> - <p>For dev (non-minified) JS, see <a href="https://github.com/danvk/dygraphs/blob/master/dygraph-dev.js">dygraph-dev.js</a> on <a href="https://github.com/danvk/dygraphs/">github</a>.</a> +<p>The current version of dygraphs is <b>1.0.0</b>. Most users will want to download minified files for this version:</p> + +<div id="current-release" class="panel"> +<p><a href="1.0.0/dygraph.min.js">dygraph.min.js</a></p> </div> +<p>For dev (non-minified) JS, see <a href="https://github.com/danvk/dygraphs/blob/master/dygraph-dev.js">dygraph-dev.js</a> on <a href="https://github.com/danvk/dygraphs/">github</a>.</a> + +<p>To generate your own minified JS, run:</p> + +<pre>git clone https://github.com/danvk/dygraphs.git +./generate-combined.sh +</pre> + +<p>This will create a dygraph.min.js file in the dygraphs directory.</p> + +<p>You may also download files for previously-released versions:</p> + +<ul> + +</ul> + + <!--#include virtual="footer.html" --> + diff --git a/docs/site.css b/docs/site.css index c9ac643..a0c18c6 100644 --- a/docs/site.css +++ b/docs/site.css @@ -115,3 +115,16 @@ pre{ border-color: black; } +#current-release { + font-size: 18px; + background: #f9f9f9; + /* + padding: 10px 15px; + border: 1px dashed black; +*/ + display: table; + margin-bottom: 50px; +} +#current-release p:last-child { + margin-bottom: 0; +} diff --git a/generate-download.py b/generate-download.py new file mode 100755 index 0000000..3b1a589 --- /dev/null +++ b/generate-download.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +# Generates docs/download.html +# Run: +# ./generate-download.py > docs/download.html + +import json + +releases = json.load(file('releases.json')) + +def file_links(release): + v = release['version'] + return ['<a href="%(v)s/%(f)s">%(f)s</a>' % { + 'f': f, 'v': v} for f in release['files']] + + +# Validation of releases.json +for idx, release in enumerate(releases): + if idx == 0: continue + assert 'version' in release, 'Release missing version: %s' % release + assert 'files' in release, 'Release missing files: %s' % release + assert release['version'] < releases[idx - 1]['version'], ( + 'Releases should be in reverse chronological order in releases.json') + +current_html = '<p>' + ('</p><p>'.join(file_links(releases[0]))) + '</p>' + + +previous_lis = [] +for release in releases[1:]: + previous_lis.append('<li>%(v)s: %(files)s (<a href="%(v)s/">%(v)s docs</a>)' % { + 'v': release['version'], + 'files': ', '.join(file_links(release)) + }) + + +print ''' +<!--#include virtual="header.html" --> + +<!-- + DO NOT EDIT THIS FILE! + + This file is generated by generate-download.py. +--> + +<script src="modernizr.custom.18445.js"></script> +<p>The current version of dygraphs is <b>%(version)s</b>. Most users will want to download minified files for this version:</p> + +<div id="current-release" class="panel"> +%(current_html)s +</div> + +<p>For dev (non-minified) JS, see <a href="https://github.com/danvk/dygraphs/blob/master/dygraph-dev.js">dygraph-dev.js</a> on <a href="https://github.com/danvk/dygraphs/">github</a>.</a> + +<p>To generate your own minified JS, run:</p> + +<pre>git clone https://github.com/danvk/dygraphs.git +./generate-combined.sh +</pre> + +<p>This will create a dygraph.min.js file in the dygraphs directory.</p> + +<p>You may also download files for previously-released versions:</p> + +<ul> +%(previous_lis)s +</ul> + + +<!--#include virtual="footer.html" --> +''' % { + 'version': releases[0]['version'], + 'current_html': current_html, + 'previous_lis': '\n'.join(previous_lis) + } diff --git a/releases.json b/releases.json new file mode 100644 index 0000000..37c18af --- /dev/null +++ b/releases.json @@ -0,0 +1,8 @@ +[ + { + "version": "1.0.0", + "files": [ + "dygraph.min.js" + ] + } +]