imp(index.html): download links to tar.gz files

That way, we save bandwidth and preserve the executable bit of the
respective program.

Closes #107
[skip ci]
This commit is contained in:
Sebastian Thiel
2015-05-10 18:51:08 +02:00
parent 6bca4b75d9
commit e92f440d9b
3 changed files with 14 additions and 8 deletions

View File

@@ -11,6 +11,9 @@ base_dir=${5:?Is the root path of the download directory, e.g. /var/www/download
dest_dir=${base_dir}/google.rs/${program_type}/${version}/${os_name}
mkdir -p ${dest_dir} || exit $?
cd ${dest_dir} && tar -xzvf ${tar_file} || exit $?
for file in *; do
program_tar_file=${file}.tar.gz
tar -czf ${program_tar_file} $file && rm $file && echo "Created ${program_tar_file}"
done
echo Extracted programs from $tar_file to ${dest_dir}

View File

@@ -1,7 +1,7 @@
<%
import os
import yaml
from util import (gen_crate_dir, api_index, crates_io_url, program_name)
from util import (gen_crate_dir, api_index, crates_io_url, program_name, program_download_url)
title = 'Google Service Documentation for Rust'
@@ -55,24 +55,24 @@ DO NOT EDIT !
<%
has_any_index = False
type_names = list()
for api_name, ad in tc.iteritems():
for program_type, ad in tc.iteritems():
if api_index(DOC_ROOT, an, v, ad.make):
has_any_index = True
type_names.append(api_name)
type_names.append(program_type)
# end for each type
%>\
% if not has_any_index:
<% continue %>\
% endif
<span class="text">${an} ${v} (
% for api_name in type_names:
<% ad = tc[api_name] %>
% for program_type in type_names:
<% ad = tc[program_type] %>
<a class="mod" href="${api_index(DOC_ROOT, an, v, ad.make)}" title="${ad.make.id.upper()} docs for the ${an} ${v}">${ad.make.id.upper()}</a>
% if api_name == 'api':
% if program_type == 'api':
<a href="${crates_io_url(an, v)}"><img src="${html_index.asset_urls.crates_img}" title="This API on crates.io" height="16" width="16"/></a>
% else:
% for os_name in ('ubuntu', 'osx'):
<a href="${html_index.download_base_url + '/google.rs/%s/%s/%s/%s' % (api_name, ad.cargo.build_version, os_name, program_name(an, v))}"><img src="${html_index.asset_urls.get('%s_img' % os_name)}" title="Download the pre-compiled 64bit program for ${os_name}" height="16" width="16"/></a>
<a href="${program_download_url(html_index.download_base_url, program_type, ad.cargo.build_version, os_name, an, v)}"><img src="${html_index.asset_urls.get('%s_img' % os_name)}" title="Download the pre-compiled 64bit program for ${os_name}" height="16" width="16"/></a>
% endfor ## each os
% endif
% if not loop.last:

View File

@@ -835,6 +835,9 @@ def gen_crate_dir(name, version, ti):
def crates_io_url(name, version):
return "https://crates.io/crates/%s" % library_to_crate_name(library_name(name, version))
def program_download_url(base_url, program_type, program_version, os_name, name, version):
return base_url + '/google.rs/%s/%s/%s/%s.tar.gz' % (program_type, program_version, os_name, program_name(name, version))
def program_name(name, version):
return library_name(name, version).replace('_', '-')