mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
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:
@@ -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}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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('_', '-')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user