Commit 4eb57723 authored by Thomas Lechauve's avatar Thomas Lechauve

Create a manifest file for offline usage

Added a bash script to increment release number of the manifest file, in
order to force browser to refresh the cache application when rebuilding
application.
parent 7d83942b
...@@ -17,6 +17,8 @@ DEVCSS = slapos.css ...@@ -17,6 +17,8 @@ DEVCSS = slapos.css
FINALJS = slapos.js FINALJS = slapos.js
FINALCSS = slapos.css FINALCSS = slapos.css
MANIFESTNAME = $(DEVDIR)/slapos.manifest
all: dev all: dev
######################################### #########################################
...@@ -26,6 +28,9 @@ all: dev ...@@ -26,6 +28,9 @@ all: dev
# Emulate server responses with sinonjs # Emulate server responses with sinonjs
fake: dev ${DEVDIR}/js/fake.js fake: dev ${DEVDIR}/js/fake.js
more ${DEVDIR}/js/fake.js >> ${DEVDIR}/$(DEVJS) more ${DEVDIR}/js/fake.js >> ${DEVDIR}/$(DEVJS)
echo "http://www.system-linux.eu/public/images/kvm-logo.png" >> $(MANIFESTNAME)
echo "http://www.w3.org/html/logo/downloads/HTML5_Badge_512.png" >> $(MANIFESTNAME)
echo "http://7.mshcdn.com/wp-content/uploads/2011/01/html5-logo-1.jpg" >> $(MANIFESTNAME)
${DEVDIR}/js/fake.js: js/utils/fake.js ${DEVDIR}/js/fake.js: js/utils/fake.js
@mkdir -p $(@D) @mkdir -p $(@D)
...@@ -41,6 +46,19 @@ JSFILES = $(find $(JSDIR) -name 'tests' -prune -o -name 'lib' -prune -o -name "* ...@@ -41,6 +46,19 @@ JSFILES = $(find $(JSDIR) -name 'tests' -prune -o -name 'lib' -prune -o -name "*
dev: ${DEVDIR}/lib/sinon.js ${DEVDIR}/lib/jquery.js ${DEVDIR}/lib/qunit.js ${DEVDIR}/lib/qunit.css ${DEVDIR}/lib/jquery-mobile.js ${DEVDIR}/lib/modernizr.js ${DEVDIR}/lib/mustache.js ${DEVDIR}/lib/spin.js ${DEVDIR}/lib/swipe.js ${DEVDIR}/lib/route.js ${DEVDIR}/lib/url.js $(patsubst %.js, ${DEVDIR}/js/%.js, $(JSFILES)) ${DEVDIR}/index.html ${DEVDIR}/$(DEVJS) ${DEVDIR}/$(DEVCSS) manifest dev: ${DEVDIR}/lib/sinon.js ${DEVDIR}/lib/jquery.js ${DEVDIR}/lib/qunit.js ${DEVDIR}/lib/qunit.css ${DEVDIR}/lib/jquery-mobile.js ${DEVDIR}/lib/modernizr.js ${DEVDIR}/lib/mustache.js ${DEVDIR}/lib/spin.js ${DEVDIR}/lib/swipe.js ${DEVDIR}/lib/route.js ${DEVDIR}/lib/url.js $(patsubst %.js, ${DEVDIR}/js/%.js, $(JSFILES)) ${DEVDIR}/index.html ${DEVDIR}/$(DEVJS) ${DEVDIR}/$(DEVCSS) manifest
manifest: $(DEVDIR)/index.html $(DEVDIR)/$(DEVJS) $(DEVDIR)/$(DEVCSS)
@if test -f $(MANIFESTNAME); then \
./inc_manifest_release.sh $(MANIFESTNAME); \
else \
echo "CACHE MANIFEST" > $(MANIFESTNAME); \
echo "#rel 1" >> $(MANIFESTNAME); \
echo "index.html" >> $(MANIFESTNAME); \
echo $(DEVJS) >> $(MANIFESTNAME); \
echo $(DEVCSS) >> $(MANIFESTNAME); \
echo "NETWORK:" >> $(MANIFESTNAME); \
echo "http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" >> $(MANIFESTNAME); \
fi
${DEVDIR}/index.html: index.html ${DEVDIR}/index.html: index.html
@mkdir -p $(@D) @mkdir -p $(@D)
cp $< $@ cp $< $@
......
#/bin/bash
# Increment release number of manifest file
MANIFESTNAME=$1
REL=`awk '/^#rel/{$2++; print}' $MANIFESTNAME`
sed "s/^#rel.*\+/${REL}/g" $MANIFESTNAME > $MANIFESTNAME.edited
mv $MANIFESTNAME.edited $MANIFESTNAME
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html manifest="slapos.manifest">
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment