Skip to content

Commit 91246b1

Browse files
committed
merged pk-webservice as a subtree to pk-webservice
2 parents 5ff59e4 + a30dd9f commit 91246b1

File tree

11 files changed

+358
-0
lines changed

11 files changed

+358
-0
lines changed

pk-webservice/.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
*~
2+
.*~
3+
\#*\#
4+
.\#*\#
5+
6+
.DS_Store
7+
._.DS_Store
8+
.project
9+
.settings
10+
.directory
11+
12+
*.kdevelop.*
13+
*.kdevelop
14+
*.kdevses
15+
*.kdev4
16+
/Doxyfile
17+
/tags
18+
19+
nohup.out
20+
*.log
21+
.idea
22+
*.iml
23+
24+
*.kate_swp
25+
tmp/*
26+
*.kate_swps

pk-webservice/bin/apigen

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#! /bin/bash
2+
3+
set -e
4+
5+
ROOT="${BASH_SOURCE[0]}";
6+
if([ -h "${ROOT}" ]) then
7+
while([ -h "${ROOT}" ]) do ROOT=`readlink "${ROOT}"`; done
8+
fi
9+
ROOT=$(cd `dirname "${ROOT}"` && cd .. && pwd) # Up one level
10+
11+
SUBPROJECT="${1}"
12+
13+
if [ -z "${SUBPROJECT}" ]; then
14+
echo "Usage: ${0} <subproject> <command>" >&2
15+
exit 1
16+
fi
17+
shift
18+
19+
NAME="apigen"
20+
21+
MODULE="${NAME}.run"
22+
ROCK="pk-tools.${NAME}"
23+
24+
# WARNING: copy-paste carefully! Enables absolute paths!
25+
PRIVATE_MODULES_PATH="$(luarocks show --rock-dir ${ROCK})/src/lua/?.lua;${ROOT}/?.lua;?.lua"
26+
27+
BASE_CONFIG="${ROOT}/project-config/apigen/${SUBPROJECT}.lua"
28+
29+
pk-call-lua-module \
30+
"${PRIVATE_MODULES_PATH}" \
31+
"${MODULE}" \
32+
"run" \
33+
"--root=${ROOT}/" \
34+
--base-config=${BASE_CONFIG} \
35+
"$@"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
--------------------------------------------------------------------------------
2+
-- billing-lib.lua: apigen configuration
3+
--------------------------------------------------------------------------------
4+
-- Note that PROJECT_PATH is defined in the environment
5+
--------------------------------------------------------------------------------
6+
7+
local file = function(name) return { filename = name } end
8+
9+
local luarocks_show_rock_dir =
10+
import "lua-aplicado/shell/luarocks.lua"
11+
{
12+
"luarocks_show_rock_dir"
13+
}
14+
15+
local NAME = "pk-webservice"
16+
17+
local EXPORTS_LIST_NAME = PROJECT_PATH
18+
.. "generated/" .. NAME .. "/code/exports/client_api.lua";
19+
20+
common.PROJECT_PATH = PROJECT_PATH
21+
22+
common.www.application.url = "http://pk-webservice-api/"
23+
common.www.application.api_schema_dir = PROJECT_PATH .. "schema/client_api/"
24+
common.www.application.have_unity_client = false
25+
-- common.www.application.session_checker_file_name = false
26+
27+
common.www.application.db_tables_filename = "pk-webservice/db/tables.lua"
28+
common.www.application.webservice_request_filename = "pk-webservice/webservice/request.lua"
29+
30+
common.www.application.code.exports =
31+
{
32+
file ("lua-nucleo/code/exports.lua");
33+
file ("lua-aplicado/code/exports.lua");
34+
file ("pk-core/code/exports.lua");
35+
file ("pk-engine/code/exports.lua");
36+
-- TODO: FIXME: real client_api exportlist here
37+
-- file (EXPORTS_LIST_NAME);
38+
}
39+
40+
common.www.application.code.requires =
41+
{
42+
file ("pk-engine/code/requires.lua");
43+
}
44+
45+
common.www.application.code.globals =
46+
{
47+
file ("lua-nucleo/code/foreign-globals/luajit2.lua");
48+
file ("lua-nucleo/code/foreign-globals/lua5_1.lua");
49+
file ("lua-nucleo/code/globals.lua");
50+
}
51+
52+
common.www.application.generated =
53+
{
54+
file_root = PROJECT_PATH .. "/generated/";
55+
56+
api_version_filename = "client_api_version.lua";
57+
handlers_index_filename = "handlers.lua";
58+
data_formats_filename = "formats.lua";
59+
handlers_dir_name = "handlers";
60+
61+
exports_dir_name = "lib";
62+
exports_list_name = EXPORTS_LIST_NAME;
63+
64+
context_extensions_dir_name = "pk-webservice/ext";
65+
context_extensions_list_name = "pk-webservice/extensions.lua";
66+
67+
doc_md_filename = PROJECT_PATH .. "doc/client_api.md";
68+
doc_pdf_filename = PROJECT_PATH .. "doc/client_api.pdf";
69+
doc_latex_template_filename =
70+
luarocks_show_rock_dir("pk-tools.apigen.doc.template")
71+
.. "/" .. "src/doc/template/latex.template";
72+
73+
base_url_prefix = "/";
74+
75+
--
76+
77+
unity_api_filename = "/dev/null";
78+
test_dir_name = "/dev/null";
79+
}
80+
81+
apigen =
82+
{
83+
action =
84+
{
85+
name = "help";
86+
param =
87+
{
88+
-- No parameters
89+
};
90+
};
91+
}

pk-webservice/schema/client_api/.keepme

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
api:version "pk-webservice.client_api.2010-12-19-1"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
\documentclass[a4paper]{article}
2+
\usepackage[russian]{babel}
3+
\usepackage{makeidx}
4+
\makeindex
5+
\usepackage[vcentering]{geometry}
6+
\geometry{top=3cm}
7+
\geometry{bottom=4cm}
8+
\geometry{left=3cm}
9+
\geometry{right=3cm}
10+
\usepackage{fancyhdr}
11+
\pagestyle{fancy}
12+
\usepackage{underscore}
13+
\usepackage{amsmath}
14+
\usepackage{multicol}
15+
\usepackage{color}
16+
\definecolor{LightGray}{rgb}{0.9,0.9,0.9}
17+
\makeatletter
18+
\renewcommand{\tableofcontents}{%
19+
\section*{\contentsname
20+
\@mkboth{%
21+
\MakeUppercase\contentsname}{}}%
22+
\@starttoc{toc}%
23+
}
24+
\renewenvironment{theindex}
25+
{\if@twocolumn
26+
\@restonecolfalse
27+
\else
28+
\@restonecoltrue
29+
\fi
30+
\twocolumn[\section{\indexname}]%
31+
\@mkboth{%
32+
\MakeUppercase\indexname}{}%
33+
\parindent\z@
34+
\parskip\z@ \@plus .3\p@\relax
35+
\columnseprule \z@
36+
\columnsep 35\p@
37+
\let\item\@idxitem}
38+
{\if@restonecol\onecolumn\else\clearpage\fi}
39+
\makeatother
40+
$if(xetex)$
41+
\usepackage{ifxetex}
42+
\ifxetex
43+
\usepackage{fontspec,xltxtra,xunicode}
44+
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
45+
\else
46+
\usepackage[mathletters]{ucs}
47+
\usepackage[utf8x]{inputenc}
48+
\fi
49+
$else$
50+
\usepackage[mathletters]{ucs}
51+
\usepackage[utf8x]{inputenc}
52+
$endif$
53+
$if(lhs)$
54+
\usepackage{listings}
55+
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
56+
$endif$
57+
$if(verbatim-in-note)$
58+
\usepackage{fancyvrb}
59+
$endif$
60+
$if(fancy-enums)$
61+
% Redefine labelwidth for lists; otherwise, the enumerate package will cause
62+
% markers to extend beyond the left margin.
63+
\makeatletter\AtBeginDocument{%
64+
\renewcommand{\@listi}
65+
{\setlength{\labelwidth}{4em}}
66+
}\makeatother
67+
\usepackage{enumerate}
68+
$endif$
69+
$if(tables)$
70+
\usepackage{array}
71+
% This is needed because raggedright in table elements redefines \\:
72+
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
73+
\let\PBS=\PreserveBackslash
74+
$endif$
75+
$if(strikeout)$
76+
\usepackage[normalem]{ulem}
77+
$endif$
78+
$if(subscript)$
79+
\newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
80+
$endif$
81+
$if(url)$
82+
\usepackage{url}
83+
$endif$
84+
$if(graphics)$
85+
\usepackage{graphicx}
86+
$endif$
87+
\usepackage[breaklinks=true,unicode=true]{hyperref}
88+
\setlength{\parindent}{0pt}
89+
\setlength{\parskip}{6pt plus 2pt minus 1pt}
90+
$if(numbersections)$
91+
$else$
92+
\setcounter{secnumdepth}{0}
93+
$endif$
94+
$if(verbatim-in-note)$
95+
\VerbatimFootnotes % allows verbatim text in footnotes
96+
$endif$
97+
\setcounter{tocdepth}{5}
98+
$for(header-includes)$
99+
$header-includes$
100+
$endfor$
101+
102+
$if(title)$
103+
\title{$title$}
104+
$endif$
105+
$if(author)$
106+
\author{$for(author)$$author$$sep$\\$endfor$}
107+
$endif$
108+
$if(date)$
109+
\date{$date$}
110+
$endif$
111+
112+
\begin{document}
113+
$if(title)$
114+
\maketitle
115+
$endif$
116+
117+
$for(include-before)$
118+
$include-before$
119+
120+
$endfor$
121+
$if(toc)$
122+
$endif$
123+
$body$
124+
$for(include-after)$
125+
126+
$include-after$
127+
$endfor$
128+
129+
\end{document}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- TODO: generalize
2+
api:extend_context "pk-webservice.geoip.city" (function()
3+
4+
require 'geoip.city' -- TODO: Hack. This should be handled by apigen.
5+
6+
--------------------------------------------------------------------------------
7+
8+
local geodb = assert(
9+
geoip.city.open(
10+
-- TODO: Do not hardcode paths!
11+
luarocks_show_rock_dir('pk-webservice.geoip.city.data')
12+
.. "/data/geoip/GeoLiteCity.dat"
13+
)
14+
)
15+
16+
return
17+
{
18+
factory = invariant(geodb); -- a singleton
19+
}
20+
21+
--------------------------------------------------------------------------------
22+
23+
end);

pk-webservice/schema/verbatim/.keepme

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--------------------------------------------------------------------------------
2+
-- generated exports map for schema/
3+
--------------------------------------------------------------------------------
4+
-- WARNING! Do not change manually.
5+
-- Generated by list-exports.lua
6+
--------------------------------------------------------------------------------
7+
8+
return
9+
{
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--------------------------------------------------------------------------------
2+
-- pk-engine.lua: pk-engine exports profile
3+
--------------------------------------------------------------------------------
4+
5+
local tset = import 'lua-nucleo/table-utils.lua' { 'tset' }
6+
7+
--------------------------------------------------------------------------------
8+
9+
local PROFILE = { }
10+
11+
--------------------------------------------------------------------------------
12+
13+
declare 'copcall' -- TODO: Uberhack! :(
14+
require 'copas' -- TODO: Uberhack! :(
15+
declare 'wsapi' -- TODO: Uberhack! :(
16+
17+
PROFILE.skip = setmetatable(tset
18+
{
19+
"schema/client_api/client_api_version.lua";
20+
"schema/client_api/geoip_city/ext.lua"
21+
}, {
22+
__index = function(t, k)
23+
-- Excluding files outside of pk-engine/ and inside pk-engine/code
24+
-- and inside pk-engine/test
25+
26+
local v = k:match("^schema/verbatim/code/")
27+
or (k:sub(1, #"schema/test/") == "schema/test/")
28+
29+
t[k] = v
30+
return v
31+
end;
32+
})
33+
34+
--------------------------------------------------------------------------------
35+
36+
return PROFILE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--------------------------------------------------------------------------------
2+
-- tables.lua: fake DB tables data
3+
--------------------------------------------------------------------------------
4+
5+
local TABLES = { } -- No tables for this project (yet)
6+
7+
return TABLES

0 commit comments

Comments
 (0)