Commit b4cc50ab authored by Houtan Bastani's avatar Houtan Bastani

rework download page

parent 07a5f032
...@@ -3,10 +3,10 @@ _site ...@@ -3,10 +3,10 @@ _site
.jekyll-metadata .jekyll-metadata
# Snapshots # Snapshots
assets/snapshot/* _includes/snapshot/*
# Releases # Releases
assets/release/* _includes/release/*
# Logo # Logo
assets/images/logo/*.aux assets/images/logo/*.aux
......
...@@ -21,30 +21,14 @@ ...@@ -21,30 +21,14 @@
</p> </p>
<p>Executable installer:</p> <p>Executable installer:</p>
<div class="download_table"> <div class="download_table">
{% assign snapshot_files = (site.static_files | where: "snapshot", "windows-exe" | sort: 'modified_time') | reverse %} {% include snapshot/download-snapshot-windows.html %}
{% for snapshot in snapshot_files %} </div>
{% if snapshot.extname == ".exe" %}
<div class="download_row" onclick="document.location = 'https://www.dynare.org/snapshot/windows/{{ snapshot.name }}'" onkeypress="document.location = 'https://www.dynare.org/snapshot/windows/{{ snapshot.name }}'">
<div class="download_cell_left"><i class="fas fa-file-download"></i>&nbsp;{{ snapshot.modified_time | date: "%Y %b %d %R" }}</div>
<div class="download_cell_right"><a href="#">{{ snapshot.name }}</a></div>
</div>
{% endif %}
{% endfor %}
</div>
<br /> <br />
<p>Zip archive:</p> <p>Zip archive:</p>
<div class="download_table"> <div class="download_table">
{% assign snapshot_files = (site.static_files | where: "snapshot", "windows-zip" | sort: 'modified_time') | reverse %} {% include snapshot/download-snapshot-windows-zip.html %}
{% for snapshot in snapshot_files %} </div>
{% if snapshot.extname == ".zip" %}
<div class="download_row" onclick="document.location = 'https://www.dynare.org/snapshot/windows-zip/{{ snapshot.name }}'" onkeypress="document.location = 'https://www.dynare.org/snapshot-zip/windows/{{ snapshot.name }}'">
<div class="download_cell_left"><i class="fas fa-file-download"></i>&nbsp;{{ snapshot.modified_time | date: "%Y %b %d %R" }}</div>
<div class="download_cell_right"><a href="#">{{ snapshot.name }}</a></div>
</div>
{% endif %}
{% endfor %}
</div>
</section> </section>
<section class="dynare_section" id="snapshot_content2"> <section class="dynare_section" id="snapshot_content2">
...@@ -58,15 +42,7 @@ ...@@ -58,15 +42,7 @@
"Open" from the menu that pops up. "Open" from the menu that pops up.
</p> </p>
<div class="download_table"> <div class="download_table">
{% assign snapshot_files = (site.static_files | where: "snapshot", "macosx" | sort: 'modified_time') | reverse %} {% include snapshot/download-snapshot-macosx.html %}
{% for snapshot in snapshot_files %}
{% if snapshot.extname == ".zip" %}
<div class="download_row" onclick="document.location = 'https://www.dynare.org/snapshot/macosx/{{ snapshot.name }}'" onkeypress="document.location = 'https://www.dynare.org/snapshot/macosx/{{ snapshot.name }}'">
<div class="download_cell_left"><i class="fas fa-file-download"></i>&nbsp;{{ snapshot.modified_time | date: "%Y %b %d %R" }}</div>
<div class="download_cell_right"><a href="#">{{ snapshot.name }}</a></div>
</div>
{% endif %}
{% endfor %}
</div> </div>
</section> </section>
...@@ -84,15 +60,7 @@ ...@@ -84,15 +60,7 @@
<section class="dynare_section" id="snapshot_content4"> <section class="dynare_section" id="snapshot_content4">
<p>Source code, not needed by most users.</p> <p>Source code, not needed by most users.</p>
<div class="download_table"> <div class="download_table">
{% assign snapshot_files = (site.static_files | where: "snapshot", "source" | sort: 'modified_time') | reverse %} {% include snapshot/download-snapshot-source.html %}
{% for snapshot in snapshot_files %}
{% if snapshot.extname == ".xz" %}
<div class="download_row" onclick="document.location = 'https://www.dynare.org/snapshot/source/{{ snapshot.name }}'" onkeypress="document.location = 'https://www.dynare.org/snapshot/source/{{ snapshot.name }}'">
<div class="download_cell_left"><i class="fas fa-file-download"></i>&nbsp;{{ snapshot.modified_time | date: "%Y %b %d %R" }}</div>
<div class="download_cell_right"><a href="#">{{ snapshot.name }}</a></div>
</div>
{% endif %}
{% endfor %}
</div> </div>
</section> </section>
</div> </div>
......
...@@ -22,19 +22,11 @@ ...@@ -22,19 +22,11 @@
<p>Both an executable installer and a zip archive are available.</p> <p>Both an executable installer and a zip archive are available.</p>
<p class="stable"> <p class="stable">
<i class="fas fa-file-download"></i> <i class="fas fa-file-download"></i>
{% assign release = site.static_files | where: "release", "windows-exe" | first %} {% include release/download-release-windows.html %}
{% assign version = release.name | split: '-' %}
{% assign version = version[1] %}
<a href="https://www.dynare.org/release/windows/{{ release.name }}">Dynare {{ version }} ({{ release.extname }})</a>
<a href="https://www.dynare.org/release/windows/{{ release.name }}.sig">[signature]</a>
</p> </p>
<p class="stable"> <p class="stable">
<i class="fas fa-file-download"></i> <i class="fas fa-file-download"></i>
{% assign release = site.static_files | where: "release", "windows-zip" | first %} {% include release/download-release-windows-zip.html %}
{% assign version = release.name | split: '-' %}
{% assign version = version[1] %}
<a href="https://www.dynare.org/release/windows-zip/{{ release.name }}">Dynare {{ version }} ({{ release.extname }})</a>
<a href="https://www.dynare.org/release/windows-zip/{{ release.name }}.sig">[signature]</a>
</p> </p>
</section> </section>
...@@ -50,11 +42,7 @@ ...@@ -50,11 +42,7 @@
</p> </p>
<p class="stable"> <p class="stable">
<i class="fas fa-file-download"></i> <i class="fas fa-file-download"></i>
{% assign release = site.static_files | where: "release", "macosx" | first %} {% include release/download-release-macosx.html %}
{% assign version = release.name | split: '-' %}
{% assign version = version[1] | split: release.extname | first %}
<a href="https://www.dynare.org/release/macosx/{{ release.name }}">Dynare {{ version }} ({{ release.extname }})</a>
<a href="https://www.dynare.org/release/macosx/{{ release.name }}.sig">[signature]</a>
</p> </p>
</section> </section>
...@@ -86,11 +74,7 @@ ...@@ -86,11 +74,7 @@
</p> </p>
<p class="stable"> <p class="stable">
<i class="fas fa-file-download"></i> <i class="fas fa-file-download"></i>
{% assign release = site.static_files | where: "release", "source" | first %} {% include release/download-release-source.html %}
{% assign version = release.name | split: '-' %}
{% assign version = version[1] | split: '.tar.' | first %}
<a href="https://www.dynare.org/release/source/{{ release.name }}">Dynare {{ version }} (.tar{{ release.extname }})</a>
<a href="https://www.dynare.org/release/source/{{ release.name }}.sig">[signature]</a>
</p> </p>
</section> </section>
</div> </div>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
set -e set -e
cd assets cd _includes
for branch in release snapshot for branch in release snapshot
do do
...@@ -18,21 +18,48 @@ do ...@@ -18,21 +18,48 @@ do
for dir in "${arr[@]}" for dir in "${arr[@]}"
do do
mkdir -p "$dir" if [[ "$OSTYPE" == "darwin"* ]]; then
readarray -t filenames < <(jq .[].filename "$dir.json") filenames=(`jq .[].filename $dir.json`)
readarray -t timestamps < <(jq .[].date "$dir.json") timestamps=(`jq .[].date $dir.json`)
else
readarray -t filenames < <(jq .[].filename "$dir.json")
readarray -t timestamps < <(jq .[].date "$dir.json")
fi
n=$(jq length "$dir.json") n=$(jq length "$dir.json")
cd "$dir" includeFilename="download-$branch-$dir.html"
echo "" > $includeFilename
for ((i = 0; i < n; i++)) for ((i = 0; i < n; i++))
do do
filename="${filenames[i]%\"}" filename="${filenames[i]%\"}"
filename="${filename#\"}" filename="${filename#\"}"
timestamp="${timestamps[i]%\"}" if [ "$branch" = "release" ]; then
timestamp="${timestamp#\"}" IFS='-' read -ra split <<< "$filename"
echo "$filename $timestamp" if [ "$dir" = "windows" ] || [ "$dir" = "windows-zip" ]; then
touch -amt "$timestamp" "$filename" version="${split[1]}"
ext=${filename##*.}
elif [ "$dir" = "macosx" ]; then
version=${split[1]%.*}
ext=${filename##*.}
else
ext=`echo ${split[1]} | rev | cut -d. -f2 -f1 | rev`
version=`echo ${split[1]} | cut -d. -f1 -f2 -f3`
fi
echo "<a href=\"https://www.dynare.org/$branch/$dir/$filename\">Dynare $version ($ext)</a>" >> $includeFilename
echo "<a href=\"https://www.dynare.org/$branch/$dir/$filename.sig\">[signature]</a>" >> $includeFilename
else
timestamp="${timestamps[i]%\"}"
timestamp="${timestamp#\"}"
if [[ "$OSTYPE" == "darwin"* ]]; then
datestr=`date -r $timestamp`
else
datestr=`date -d @$timestamp`
fi
echo "<div class=\"download_row\" onclick=\"document.location = 'https://www.dynare.org/$branch/$dir/$filename'\" onkeypress=\"document.location = 'https://www.dynare.org/$branch/$dir/$filename'\">" >> $includeFilename
echo " <div class=\"download_cell_left\"><i class=\"fas fa-file-download\"></i>&nbsp;$datestr</div>" >> $includeFilename
echo " <div class=\"download_cell_right\"><a href=\"#\">$filename</a></div>" >> $includeFilename
echo "</div>" >> $includeFilename
fi
done done
cd ..
done done
rm -- *.json rm -- *.json
cd .. cd ..
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment