From: Dan Vanderkam 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 @@ + + + -
-

Most users will want the minified JavaScript:

-

dygraph-combined.js

-
-

For dev (non-minified) JS, see dygraph-dev.js on github. +

The current version of dygraphs is 1.0.0. Most users will want to download minified files for this version:

+ + +

For dev (non-minified) JS, see dygraph-dev.js on github. + +

To generate your own minified JS, run:

+ +
git clone https://github.com/danvk/dygraphs.git
+./generate-combined.sh
+
+ +

This will create a dygraph.min.js file in the dygraphs directory.

+ +

You may also download files for previously-released versions:

+ + + + + 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 ['%(f)s' % { + '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 = '

' + ('

'.join(file_links(releases[0]))) + '

' + + +previous_lis = [] +for release in releases[1:]: + previous_lis.append('
  • %(v)s: %(files)s (%(v)s docs)' % { + 'v': release['version'], + 'files': ', '.join(file_links(release)) + }) + + +print ''' + + + + + +

    The current version of dygraphs is %(version)s. Most users will want to download minified files for this version:

    + +
    +%(current_html)s +
    + +

    For dev (non-minified) JS, see dygraph-dev.js on github. + +

    To generate your own minified JS, run:

    + +
    git clone https://github.com/danvk/dygraphs.git
    +./generate-combined.sh
    +
    + +

    This will create a dygraph.min.js file in the dygraphs directory.

    + +

    You may also download files for previously-released versions:

    + +
      +%(previous_lis)s +
    + + + +''' % { + '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" + ] + } +]