Skip to content

Commit aef0f88

Browse files
committed
Merge pull request openlayers#1482 from ahocevar/dev-dir
Update script that builds the dev site
2 parents cf7c4cb + 8cc840f commit aef0f88

File tree

1 file changed

+48
-99
lines changed

1 file changed

+48
-99
lines changed

tools/update_dev_dir.sh

Lines changed: 48 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,52 @@
11
#!/bin/sh
22

3-
# check to see if the hosted examples or API docs need an update
4-
cd /osgeo/openlayers/repos/openlayers
5-
REMOTE_HEAD=`git ls-remote https://github.com/openlayers/ol2/ | grep HEAD | awk '{print $1}'`
6-
LOCAL_HEAD=`git rev-parse HEAD`
7-
8-
# if there's something different in the remote, update and build
9-
if [ ! o$REMOTE_HEAD = o$LOCAL_HEAD ]; then
10-
11-
git checkout master
12-
git clean -f
13-
git pull origin master
14-
15-
# copy everything over to the dev dir within the website (keep the clone clean)
16-
rsync -r --exclude=.git . /osgeo/openlayers/sites/openlayers.org/dev
17-
18-
# make examples use built lib
19-
cd /osgeo/openlayers/sites/openlayers.org/dev/tools
20-
21-
python exampleparser.py /osgeo/openlayers/repos/openlayers/examples /osgeo/openlayers/sites/openlayers.org/dev/examples
22-
23-
if [ ! -f closure-compiler.jar ]; then
24-
wget -c http://closure-compiler.googlecode.com/files/compiler-latest.zip
25-
unzip compiler-latest.zip
26-
mv compiler.jar closure-compiler.jar
27-
fi
28-
29-
cd /osgeo/openlayers/sites/openlayers.org/dev/build
30-
./build.py -c closure tests.cfg
31-
./build.py -c closure mobile.cfg OpenLayers.mobile.js
32-
./build.py -c closure light.cfg OpenLayers.light.js
33-
./build.py -c none tests.cfg OpenLayers.debug.js
34-
./build.py -c none mobile.cfg OpenLayers.mobile.debug.js
35-
./build.py -c none light.cfg OpenLayers.light.debug.js
36-
cp OpenLayers*.js ..
37-
38-
cd /osgeo/openlayers/sites/openlayers.org/dev
39-
sed -i -e 's!../lib/OpenLayers.js?mobile!../OpenLayers.mobile.js!' examples/*.html
40-
sed -i -e 's!../lib/OpenLayers.js!../OpenLayers.js!' examples/*.html
41-
42-
# update the API docs
43-
if [ ! -d /osgeo/openlayers/sites/dev.openlayers.org/apidocs ]; then
44-
mkdir -p /osgeo/openlayers/sites/dev.openlayers.org/apidocs
45-
fi
46-
if [ ! -d /osgeo/openlayers/sites/dev.openlayers.org/docs ]; then
47-
mkdir -p /osgeo/openlayers/sites/dev.openlayers.org/docs
48-
fi
49-
naturaldocs --input lib --output HTML /osgeo/openlayers/sites/dev.openlayers.org/apidocs -p apidoc_config -s Default OL
50-
naturaldocs --input lib --output HTML /osgeo/openlayers/sites/dev.openlayers.org/docs -p doc_config -s Default OL
51-
52-
fi
53-
54-
# check to see if the website needs an update
55-
cd /osgeo/openlayers/repos/website
56-
REMOTE_HEAD=`git ls-remote https://github.com/openlayers/website/ | grep HEAD | awk '{print $1}'`
57-
LOCAL_HEAD=`git rev-parse HEAD`
58-
59-
# if there's something different in the remote, update the clone
60-
if [ ! o$REMOTE_HEAD = o$LOCAL_HEAD ]; then
61-
62-
git checkout master
63-
git clean -f
64-
git pull origin master
65-
66-
# copy everything over to the website dir (keep the clone clean)
67-
# can't use --delete here because of nested dev dir from above
68-
rsync -r --exclude=.git . /osgeo/openlayers/sites/openlayers.org
69-
3+
# Script that builds http://dev.openlayers.org/ or a similar website.
4+
# To get started, download an OpenLayers zipball from
5+
# https://github.com/openlayers/ol2/archive/master.zip, unpack it, change into
6+
# the tools/ directory, and run this script.
7+
# Once installed, to update the website, just change into the tools/ directory
8+
# and run this script again.
9+
10+
echo "<html><head><title>OpenLayers 2 Dev Website</title></head></body><h3>OpenLayers 2 Dev Website</h3><ul><li><a href='examples/'>Examples</a></li><li><a href='apidocs/'>API docs</a></li><li><a href='docs/'>Developer docs (use at your own risk)</a></li><li><a href='sandbox/'>Developer sandboxes (no official code in there)</a></li></ul>" > ../index.html
11+
12+
git clone git://github.com/openlayers/ol2.git
13+
14+
rsync -r --exclude=.git ol2/* ../
15+
16+
# make examples use built lib
17+
cd ol2/tools
18+
19+
python exampleparser.py ../examples ../../../examples
20+
21+
cd ../build
22+
./build.py tests.cfg
23+
./build.py mobile.cfg OpenLayers.mobile.js
24+
./build.py light.cfg OpenLayers.light.js
25+
./build.py -c none tests.cfg OpenLayers.debug.js
26+
./build.py -c none mobile.cfg OpenLayers.mobile.debug.js
27+
./build.py -c none light.cfg OpenLayers.light.debug.js
28+
cp OpenLayers*.js ../../../
29+
30+
cd ../../../
31+
sed -i -e 's!../lib/OpenLayers.js?mobile!../OpenLayers.mobile.js!' examples/*.html
32+
sed -i -e 's!../lib/OpenLayers.js!../OpenLayers.js!' examples/*.html
33+
# Update Bing key
34+
sed -i -e 's!AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf!ApTJzdkyN1DdFKkRAE6QIDtzihNaf6IWJsT-nQ_2eMoO4PN__0Tzhl2-WgJtXFSp!' examples/*.js
35+
36+
# update the API docs
37+
if [ ! -d apidocs ]; then
38+
mkdir -p apidocs
7039
fi
71-
72-
# check to see if prose docs need an update
73-
cd /osgeo/openlayers/repos/docs
74-
REMOTE_HEAD=`git ls-remote https://github.com/openlayers/docs/ | grep HEAD | awk '{print $1}'`
75-
LOCAL_HEAD=`git rev-parse HEAD`
76-
77-
# if there's something different in the remote, update the clone
78-
if [ ! o$REMOTE_HEAD = o$LOCAL_HEAD ]; then
79-
80-
git checkout master
81-
git clean -f
82-
git pull origin master
83-
84-
mkdir -p /osgeo/openlayers/sites/docs.openlayers.org /tmp/ol/docs/build/doctrees
85-
sphinx-build -b html -d /tmp/ol/docs/build/doctrees . /osgeo/openlayers/sites/docs.openlayers.org
86-
87-
fi
88-
89-
## UPDATES FROM THE OLD SVN REPO
90-
91-
# Get current 'Last Changed Rev'
92-
SVNREV=`svn info http://svn.openlayers.org/ | grep 'Revision' | awk '{print $2}'`
93-
94-
# Get the last svn rev
95-
touch /tmp/ol_svn_rev
96-
OLD_SVNREV="o`cat /tmp/ol_svn_rev`"
97-
98-
# If they're not equal, do some work.
99-
if [ ! o$SVNREV = $OLD_SVNREV ]; then
100-
svn up /osgeo/openlayers/repos/old_svn_repo/
101-
# Record the revision
102-
echo -n $SVNREV > /tmp/ol_svn_rev
40+
if [ ! -d docs ]; then
41+
mkdir -p docs
10342
fi
43+
cd tools/ol2/
44+
wget http://www.mirrorservice.org/sites/downloads.sourceforge.net/n/na/naturaldocs/Stable%20Releases/1.52/NaturalDocs-1.52.zip
45+
unzip NaturalDocs-1.52.zip
46+
perl NaturalDocs --input lib --output HTML ../../apidocs -p apidoc_config -s Default OL
47+
perl NaturalDocs --input lib --output HTML ../../docs -p doc_config -s Default OL
48+
cd ../
49+
rm -Rf ol2
50+
cd ../
51+
svn export --force https://svn.osgeo.org/openlayers/sandbox/
52+
cd tools/

0 commit comments

Comments
 (0)