mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-19 18:00:47 +01:00
feat(mako): LICENSE + README.md
Readme is very initial, but the architecture is set to evolve it to something no less than beatiful.
This commit is contained in:
14
Makefile
14
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: json-to-xml clean help api-deps rebuild-apis
|
||||
.PHONY: json-to-xml clean help api-deps rebuild-apis license
|
||||
.SUFFIXES:
|
||||
|
||||
include Makefile.helpers
|
||||
@@ -7,14 +7,14 @@ VENV := virtualenv
|
||||
VENV_DIR := .pyenv
|
||||
PYTHON := $(VENV_DIR)/bin/python
|
||||
PIP := $(VENV_DIR)/bin/pip
|
||||
MAKO_RENDER := ./etc/bin/mako-render
|
||||
MAKO_RENDER := etc/bin/mako-render
|
||||
TPL := $(PYTHON) $(MAKO_RENDER)
|
||||
|
||||
MAKO_SRC = src/mako
|
||||
API_DEPS_TPL = $(MAKO_SRC)/deps.mako
|
||||
API_DEPS = .api.deps
|
||||
API_SHARED_INFO = ./etc/api/shared.yaml
|
||||
API_JSON_FILES = $(shell find ./etc -type f -name '*-api.json')
|
||||
API_SHARED_INFO = etc/api/shared.yaml
|
||||
API_JSON_FILES = $(shell find etc -type f -name '*-api.json')
|
||||
MAKO_LIB_DIR = $(MAKO_SRC)/lib
|
||||
MAKO_LIB_FILES = $(shell find $(MAKO_LIB_DIR) -type f -name '*.mako' -or -name '*.py')
|
||||
|
||||
@@ -26,6 +26,7 @@ help:
|
||||
$(info api-deps - generate a file to tell make what API file dependencies will be)
|
||||
$(info rebuild-apis - clear out all generated apis, and regenerate them)
|
||||
$(info help-api - show all api targets to build individually)
|
||||
$(info license - regenerate the main license file)
|
||||
|
||||
$(PYTHON):
|
||||
virtualenv $(VENV_DIR)
|
||||
@@ -40,6 +41,11 @@ api-deps: $(API_DEPS)
|
||||
|
||||
include $(API_DEPS)
|
||||
|
||||
LICENSE.md: $(MAKO_SRC)/LICENSE.md.mako $(API_SHARED_INFO)
|
||||
$(TPL) -io $<=$@ --data-files $(API_SHARED_INFO)
|
||||
|
||||
license: LICENSE.md
|
||||
|
||||
rebuild-apis: clean-apis apis
|
||||
|
||||
clean: clean-apis
|
||||
|
||||
@@ -16,6 +16,7 @@ api:
|
||||
templates:
|
||||
# all output directories are relative to the one set for the respective API
|
||||
- source: README.md
|
||||
- source: LICENSE.md
|
||||
- source: cargo.toml
|
||||
# output_dir: optional - not there if unset
|
||||
cargo:
|
||||
@@ -23,7 +24,14 @@ cargo:
|
||||
repo_base_url: https://github.com/Byron/google-apis-rs
|
||||
doc_base_url: http://byron.github.io/google-apis-rs
|
||||
authors:
|
||||
# don't forget to possibly add them to copyright authors
|
||||
- Sebastian Thiel <byronimo@gmail>
|
||||
keywords: [google, protocol, web, api]
|
||||
# All APIs should live in the same repository
|
||||
repository_url: https://github.com/Byron/google-apis-rs
|
||||
|
||||
copyright:
|
||||
# should at some point be 2015-2016 ...
|
||||
years: '2015'
|
||||
authors:
|
||||
- 'Sebastian Thiel'
|
||||
|
||||
@@ -308,13 +308,14 @@ def cmdline(argv=None):
|
||||
try:
|
||||
result = template.render(**data_converted)
|
||||
if output_file:
|
||||
if not os.path.isdir(dirname(output_file)):
|
||||
os.makedirs(dirname(output_file))
|
||||
dir = dirname(output_file)
|
||||
if dir and not os.path.isdir(dir):
|
||||
os.makedirs(dir)
|
||||
fh = open(output_file, "wb")
|
||||
fh.write(result)
|
||||
fh.write(result.encode('utf-8'))
|
||||
fh.close()
|
||||
else:
|
||||
print(result)
|
||||
print(result.encode('utf-8'))
|
||||
except:
|
||||
_exit()
|
||||
# end for each input file
|
||||
|
||||
26
src/mako/LICENSE.md.mako
Normal file
26
src/mako/LICENSE.md.mako
Normal file
@@ -0,0 +1,26 @@
|
||||
## -*- coding: utf-8 -*-
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright © `${copyright.years}` ${', '.join("`%s`" % a for a in copyright.authors)}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the “Software”), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
5
src/mako/README.md.mako
Normal file
5
src/mako/README.md.mako
Normal file
@@ -0,0 +1,5 @@
|
||||
<%! import util %>\
|
||||
<%namespace name="lib" file="lib/lib.mako"/>\
|
||||
The `${util.library_name(name, version)}` library allows access to all features of *${canonicalName}*.
|
||||
|
||||
<%lib:docs />
|
||||
@@ -1,15 +1,13 @@
|
||||
# DO NOT EDIT !
|
||||
# This file was generated automatically by '${self.uri}'
|
||||
# DO NOT EDIT !
|
||||
## ${util.to_api_version('v3')}
|
||||
## here <%util:to_api_version v="v3"/>
|
||||
|
||||
<%api_info=[]%>\
|
||||
% for a in api.list:
|
||||
<%
|
||||
import util
|
||||
version = util.to_api_version(a.version)
|
||||
gen_root = directories.output + '/' + a.name + version
|
||||
api_name = a.name + version
|
||||
gen_root = directories.output + '/' + a.name + util.to_api_version(a.version)
|
||||
api_name = util.library_name(a.name, a.version)
|
||||
api_clean = api_name + '-clean'
|
||||
# source, destination of individual output files
|
||||
sds = [(directories.mako_src + '/' + i.source + '.mako', gen_root + i.get('output_dir', '') + '/' + i.source)
|
||||
|
||||
3
src/mako/lib/lib.mako
Normal file
3
src/mako/lib/lib.mako
Normal file
@@ -0,0 +1,3 @@
|
||||
<%def name="docs()">\
|
||||
TODO: Library level fully fledged documentation, incuding **summary** and **usage**.
|
||||
</%def>
|
||||
@@ -11,3 +11,7 @@ def rdc(s):
|
||||
def to_api_version(v):
|
||||
assert len(v) >= 2 and v[0] == 'v'
|
||||
return v[1:]
|
||||
|
||||
# build a full library name (non-canonical)
|
||||
def library_name(name, version):
|
||||
return name + to_api_version(version)
|
||||
|
||||
Reference in New Issue
Block a user