-
Notifications
You must be signed in to change notification settings - Fork 14
/
webinos.sh
176 lines (150 loc) · 11.2 KB
/
webinos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/bash
if [ $# -eq 2 ] # good arguments
then
echo "Using " $1 " as repository for API stuff " $2 " as the spec destination"
SPECHOME=$2
REPOS=$1
else
echo "This script requires 2 arguments: The location of the repository and the destination directory for the spec (both full paths). The first argument should point to a folder with three folders: static (where static html files are stored), widl (where WebIDL sources are stored) and resources (where additional resources such as wildproc, dtd, xsl... are stored). If the operation completes successfully the spec will be generated in the apis folder created on the specified destination folder."
exit
fi
# API Files that do not come from widls (edited manually)
#STATICFILES='geolocation.html webinos-apis.js webinos-apis.css'
STATICFILES=$(ls "$REPOS/static/")
# Device API widls
#WIDLFILES='foo.widl'
WIDLFILES=$(ls -I "*~" $REPOS/widl/)
# For widlproc processing
XSL=widlprocxmltohtml.xsl
XMLSOURCES=widlprocxmlsources.xml
DTD=widlprocxml.dtd
# get the right tools for unix of windows cygnus
$(widlproc 2> /dev/null)
[ $? != 127 ] && WIDLPROC=widlproc || WIDLPROC=$REPOS/resources/linux/widlproc
[ -n "$OS" ] && [ "$OS" = "Windows_NT" ] && WIDLPROC=$REPOS/resources/win32/widlproc.exe
[ "$(uname)" = "Darwin" ] && WIDLPROC=$REPOS/resources/macos/widlproc
$(ls /opt/bitnami/common/lib/libxslt.so > /dev/null 2>&1)
[ $? = 0 ] && XSLTLIB=/opt/bitnami/common/lib
XSLPROC=xsltproc
[ -n "$OS" ] && [ "$OS" = "Windows_NT" ] && XSLPROC=$REPOS/resources/win32/xsltproc.exe
#[ $? != 127 ] && WIDLPROC=widlproc.exe || WIDLPROC=$REPOS/resources/win32/widlproc.exe
# TODO: Here we should include an update to check the latest repository version is available
# Clean Directories used for the generation of the specs
rm -rf "$SPECHOME/apis"
mkdir "$SPECHOME/apis"
# Copy static content
for i in $STATICFILES
do
cp "$REPOS/static/$i" "$SPECHOME/apis/"
done
# Generating dynamic content
# those files are required to be in the destination folder for HTML generation
cp "$REPOS/resources/$DTD" "$SPECHOME/apis/"
cp "$REPOS/resources/$XSL" "$SPECHOME/apis/"
# is done in three steps in order to build the cross-references
for i in $WIDLFILES
do
"$WIDLPROC" "$REPOS/widl/$i" > "$SPECHOME/apis/$(basename "$i" .widl).widlprocxml"
if [ $? != 0 ]
then
echo Error: could not process $i
WIDLFILES=${WIDLFILES//$i} # remove widl with error from further process
rm "$SPECHOME/apis/$(basename "$i" .widl).widlprocxml"
fi
done
cat > "$SPECHOME/apis/$XMLSOURCES" <<DELIM
<?xml version="1.0" encoding="utf-8"?>
<widlprocxml>
DELIM
for i in $WIDLFILES
do
cp "$REPOS/widl/$i" "$SPECHOME/apis/"
echo "<file>$(basename "$i" .widl).widlprocxml</file>" >> "$SPECHOME/apis/$XMLSOURCES"
done
echo "</widlprocxml>" >> "$SPECHOME/apis/$XMLSOURCES"
unset GIT_DIR
for i in $WIDLFILES
do
DATE=$(cd "$REPOS/widl" ; git log --pretty=format:'%aD' -1 "$i"|cut -d " " -f 2-4)
LD_LIBRARY_PATH="${XSLTLIB}" "$XSLPROC" --stringparam date "$DATE" "$SPECHOME/apis/$XSL" "$SPECHOME/apis/${i}procxml" > "$SPECHOME/apis/$(basename "$i" .widl).html"
done
cat > "$SPECHOME/apis/index.html" <<DELIM
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="webinos-apis.css" media="screen">
<script type="text/javascript" src="webinos-apis.js"></script>
<title>webinos Device APIs - working repository</title>
</head>
<body onload="prettyPrint()">
<div id="header">
<img alt="webinos" class="pull-left" src="webinos_logo.png" style="width: 60px;height:60px;"><h1 class="pull-left"><a href="/">webinos developer's documentation</a></h1>
<button id="btn"><ul>
<li><a href="http://webinos.org/" title="Foundation site">Foundation website</a></li>
<li><a href="https://developer.webinos.org/" title="Developer site">Developer Portal</a></li>
</ul>
Other Resources
</button>
</div>
<div id="content">
<div class="description">
<p>This page lists all API specifications that are defined or referenced/used within the webinos project.</p>
<p>The APIs listed here are to be considered 'work in progress'. The official stable webinos API specifications are located at
<a href='http://dev.webinos.org/deliverables/wp3/Deliverable34'>http://dev.webinos.org/deliverables/wp3/Deliverable34/</a></p>
<p>webinos is exposed under the <code>window.webinos</code> object. The <a href="http://dev.webinos.org/specifications/api/webinoscore.html">webinos Core Interface</a>, the
<a href="http://dev.webinos.org/specifications/api/servicediscovery.html">webinos Discovery API</a> and a few more webinos APIs are available directly
under this name space.</p>
<p>However, one of the key elements of webinos is that the framework provides means to <strong>bind to a service object in a remote execution
environment</strong>. The <a href="http://dev.webinos.org/specifications/api/servicediscovery.html">webinos Discovery API</a> defines how a service is
discovered and how an application can bind to a remote service. The service object will act as proxy for sending/receiving events to/from the remote
peer and hides the complexity of sending/receiving message between the peers in a trusted manner. This mechanism is not limited to webinos defined
APIs but is also available for the APIs defined by W3C referenced below and also to user defined APIs.</p>
<p>Most webinos APIs defines services that are discoverable through the
<a href="http://dev.webinos.org/specifications/api/servicediscovery.html">webinos Discovery API</a> and are therefore not exposed directly under
the <code>window.webinos</code> object. Instead these APIs inherit the general <a href="http://dev.webinos.org/specifications/api/servicediscovery.html#::Service">webinos Service Interface</a> that is defined in the
<a href="http://dev.webinos.org/specifications/api/servicediscovery.html">webinos Discovery API</a> </p>
<p>The Github repository for the webinos API specifications source files is <a href='https://github.com/webinos/webinos-api-specifications'>Github webinos API specifications</a>.</p>
</div>
<div class="api">
<h2 class="head">APIs Specified by webinos</h2>
<table><thead><tr><th>Specification</th><th>Summary</th></thead><tbody>
DELIM
for i in $WIDLFILES
do
if [ "$i" != "foo.widl" ] && [ "$i" != "calendar.widl" ] && [ "$i" != "gallery.widl" ] ;
then
basename2=$(basename "$i" .widl)
htmlfile="$SPECHOME/apis/"$basename2".html"
LD_LIBRARY_PATH="${XSLTLIB}" "$XSLPROC" --novalid --stringparam basename "$basename2" --html "$REPOS/resources/getAPIdata.xsl" "$htmlfile" >> "$SPECHOME/apis/index.html"
fi
#basename2="$(echo ${basename2:0:1} | tr 'a-z' 'A-Z' )""${basename2:1}"
#echo '<li><a href="./'"$(basename "$i" .widl).html"'">'"$basename2"' API</a><br /></li>' >> "$SPECHOME/apis/index.html"
done
echo '</tbody></table>' >> "$SPECHOME/apis/index.html"
echo ' <h2 class=head>Referred APIs used by webinos</h2>' >> "$SPECHOME/apis/index.html"
echo '<table><thead><tr><th>Specification</th><th>Summary</th><th>Inheritance of webinos Service interface</th><th>Feature URI</th></thead><tbody>' >> "$SPECHOME/apis/index.html"
echo '<tr><td><a href=http://www.w3.org/TR/2011/WD-orientation-event-20111201/>The W3C DeviceOrientation Event specification</a></td><td><p>' >> "$SPECHOME/apis/index.html"
echo 'This specification defines several new DOM event types that provide information about the physical orientation and motion of a hosting device.<br/></p></td><td><code>interface DeviceOrientation : Service {<br/>...<br/>};</code></td><td><code>http://webinos.org/api/w3c/deviceorientation</code></td></tr>' >> "$SPECHOME/apis/index.html"
echo '<tr><td><a href=http://www.w3.org/TR/2011/WD-FileAPI-20111020/>The W3C File API </a></td><td><p>' >> "$SPECHOME/apis/index.html"
echo 'This specification provides an API for representing file objects in web applications, as well as programmatically selecting them and accessing their data.<br/></p></td><td>N/A</td><td><code>http://webinos.org/api/w3c/file</code> (all file APIs)<br /><code>http://webinos.org/api/w3c/file/read</code> (file read only)</td></tr>' >> "$SPECHOME/apis/index.html"
echo '<tr><td><a href=http://www.w3.org/TR/2012/WD-file-writer-api-20120417/>The W3C File API: Writer </a></td><td><p>' >> "$SPECHOME/apis/index.html"
echo 'This specification defines an API for writing to files from web applications. This API is designed to be used in conjunction with, and depends on definitions in, other APIs and elements on the web platform such as the W3C File API.<br/></p></td><td>N/A</td><td><code>http://webinos.org/api/w3c/file</code> (all file APIs)<br /><code>http://webinos.org/api/w3c/file/write</code> (file write only)</td></tr>' >> "$SPECHOME/apis/index.html"
echo '<tr><td><a href=http://www.w3.org/TR/2012/WD-file-system-api-20120417/>The W3C File API: Directories and System</a></td><td><p>' >> "$SPECHOME/apis/index.html"
echo 'This specification defines an API to navigate file system hierarchies, and defines a means by which a user agent may expose sandboxed sections of a user local filesystem to web applications. It builds on the File Writer API, which in turn built on the File API, each adding a different kind of functionality.<br/></p></td><td><code>interface LocalFileSystem : Service {<br/>...<br/>};<br /><br/>interface LocalFileSystemSync : Service {<br/>...<br/>};</code></td><td><code>http://webinos.org/api/w3c/file</code> (all file APIs)</td></tr>' >> "$SPECHOME/apis/index.html"
echo '<tr><td><a href=http://www.w3.org/TR/2012/PR-geolocation-API-20120510/>The W3C Geolocation API</a></td><td><p>' >> "$SPECHOME/apis/index.html"
echo 'This specification defines an API that provides scripted access to geographical location information associated with the hosting device.<br/></p></td><td><code>interface Geolocation : Service {<br/>...<br/>};</code></td><td><code>http://webinos.org/api/w3c/geolocation</code></td></tr>' >> "$SPECHOME/apis/index.html"
echo '<tr><td><a href=http://www.w3.org/TR/2013/WD-mediacapture-streams-20130903/>The W3C Media Capture and Streams API</a></td><td><p>' >> "$SPECHOME/apis/index.html"
echo 'This specification defines an API that provides access to the audio, image and video capture capabilities of the device.' >> "$SPECHOME/apis/index.html"
echo '<br/></p></td><td><code>interface NavigatorUserMedia : Service {<br/>...<br/>};</code></td><td><code>http://webinos.org/api/w3c/mediastream</code></td></tr>' >> "$SPECHOME/apis/index.html"
echo '<tr><td><a href=http://www.w3.org/TR/2013/WD-webrtc-20130910/>The W3C WebRTC API</a></td><td><p>' >> "$SPECHOME/apis/index.html"
echo 'This specification defines an API that allows to establish peer-to-peer connections between browsers, and transmit media streams and data over these connections.' >> "$SPECHOME/apis/index.html"
echo '<br/></p></td><td>N/A</td><td><code>http://webinos.org/api/w3c/webrtc</code></td></tr>' >> "$SPECHOME/apis/index.html"
echo '</tbody></table></div></div>' >> "$SPECHOME/apis/index.html"
echo '</body>' >> "$SPECHOME/apis/index.html"
echo '</html>' >> "$SPECHOME/apis/index.html"
rm "$SPECHOME"/apis/*.widlprocxml
rm "$SPECHOME"/apis/*.widl
rm "$SPECHOME/apis/$DTD"
rm "$SPECHOME/apis/$XSL"
rm "$SPECHOME/apis/$XMLSOURCES"